{"thread":{"id":"10183","subject":"[StGit PATCH 1/8] Add --ack/--sign options to \"stg new\"","startedAt":"2007-10-07T23:17:12Z","lastAt":"2007-10-08T06:41:42Z","messageCount":11,"participants":["Karl Hasselström","David Brown"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"55109","messageId":"20071007231446.12626.14259.stgit@yoghurt","threadId":"10183","inReplyTo":null,"subject":"[StGit PATCH 0/8] Miscellaneous fixes and improvements","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:12Z","receivedAt":"2007-10-07T23:17:12Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Also available from\n\n  git://repo.or.cz/stgit/kha.git safe\n\n---\n\nKarl Hasselström (8):\n      Remove the --force flag to \"stg rebase\" and \"stg pull\"\n      Discard stderr output from git-rev-parse\n      Simplify debug level error checking\n      Make a common superclass for all StGit exceptions\n      Don't split long and short description in \"stg edit\"\n      Fix up the help text for \"stg edit\"\n      New test: \"stg pop --keep\"\n      Add --ack/--sign options to \"stg new\"\n\n\n stgit/commands/common.py      |   14 ++++----------\n stgit/commands/edit.py        |   33 +++++++++++++++-----------------\n stgit/commands/new.py         |    6 ++++--\n stgit/commands/pull.py        |    5 +----\n stgit/commands/rebase.py      |    5 +----\n stgit/config.py               |    3 ++-\n stgit/exception.py            |    3 +++\n stgit/git.py                  |    6 ++++--\n stgit/gitmergeonefile.py      |    3 ++-\n stgit/main.py                 |   15 ++++-----------\n stgit/run.py                  |    5 +++--\n stgit/stack.py                |   14 +++++++++-----\n stgit/utils.py                |    3 ++-\n t/t1204-pop-keep.sh           |   42 +++++++++++++++++++++++++++++++++++++++++\n t/t2100-pull-policy-fetch.sh  |   14 --------------\n t/t2102-pull-policy-rebase.sh |   24 -----------------------\n 16 files changed, 96 insertions(+), 99 deletions(-)\n create mode 100644 stgit/exception.py\n create mode 100755 t/t1204-pop-keep.sh\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55108","messageId":"20071007231718.12626.20660.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 1/8] Add --ack/--sign options to \"stg new\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:18Z","receivedAt":"2007-10-07T23:17:18Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Signed-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/new.py |    6 ++++--\n stgit/stack.py        |   10 +++++++---\n 2 files changed, 11 insertions(+), 5 deletions(-)\n\n\ndiff --git a/stgit/commands/new.py b/stgit/commands/new.py\nindex f192e34..59671ab 100644\n--- a/stgit/commands/new.py\n+++ b/stgit/commands/new.py\n@@ -54,7 +54,8 @@ options = [make_option('-m', '--message',\n            make_option('--commname',\n                        help = 'use COMMNAME as the committer name'),\n            make_option('--commemail',\n-                       help = 'use COMMEMAIL as the committer e-mail')]\n+                       help = 'use COMMEMAIL as the committer e-mail')\n+           ] + make_sign_options()\n \n \n def func(parser, options, args):\n@@ -79,4 +80,5 @@ def func(parser, options, args):\n                          author_email = options.authemail,\n                          author_date = options.authdate,\n                          committer_name = options.commname,\n-                         committer_email = options.commemail)\n+                         committer_email = options.commemail,\n+                         sign_str = options.sign_str)\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex d889f37..4d1a066 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -847,7 +847,7 @@ class Series(PatchSet):\n                   top = None, bottom = None, commit = True,\n                   author_name = None, author_email = None, author_date = None,\n                   committer_name = None, committer_email = None,\n-                  before_existing = False):\n+                  before_existing = False, sign_str = None):\n         \"\"\"Creates a new patch, either pointing to an existing commit object,\n         or by creating a new commit object.\n         \"\"\"\n@@ -865,13 +865,17 @@ class Series(PatchSet):\n \n         # TODO: move this out of the stgit.stack module, it is really\n         # for higher level commands to handle the user interaction\n+        def sign(msg):\n+            return add_sign_line(msg, sign_str,\n+                                 committer_name or git.committer().name,\n+                                 committer_email or git.committer().email)\n         if not message and can_edit:\n             descr = edit_file(\n-                self, None,\n+                self, sign(''),\n                 'Please enter the description for the patch above.',\n                 show_patch)\n         else:\n-            descr = message\n+            descr = sign(message)\n \n         head = git.get_head()\n \n"},{"id":"55110","messageId":"20071007231724.12626.57217.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 2/8] New test: \"stg pop --keep\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:24Z","receivedAt":"2007-10-07T23:17:24Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Signed-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/t1204-pop-keep.sh |   42 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 42 insertions(+), 0 deletions(-)\n create mode 100755 t/t1204-pop-keep.sh\n\n\ndiff --git a/t/t1204-pop-keep.sh b/t/t1204-pop-keep.sh\nnew file mode 100755\nindex 0000000..40cd2a2\n--- /dev/null\n+++ b/t/t1204-pop-keep.sh\n@@ -0,0 +1,42 @@\n+#!/bin/sh\n+\n+test_description='Test \"stg pop -keep\"'\n+. ./test-lib.sh\n+stg init\n+\n+test_expect_success 'Create a few patches' '\n+    for i in 0 1 2; do\n+        stg new p$i -m p$i &&\n+        echo \"patch$i\" >> patch$i.txt &&\n+        stg add patch$i.txt &&\n+        stg refresh\n+    done &&\n+    [ \"$(echo $(stg applied))\" = \"p0 p1 p2\" ] &&\n+    [ \"$(echo $(stg unapplied))\" = \"\" ]\n+'\n+\n+test_expect_success 'Make some non-conflicting local changes' '\n+    echo \"local\" >> patch0.txt\n+'\n+\n+test_expect_success 'Pop two patches, keeping local changes' '\n+    stg pop -n 2 --keep &&\n+    [ \"$(echo $(stg applied))\" = \"p0\" ] &&\n+    [ \"$(echo $(stg unapplied))\" = \"p1 p2\" ] &&\n+    [ \"$(echo $(ls patch?.txt))\" = \"patch0.txt\" ] &&\n+    [ \"$(echo $(cat patch0.txt))\" = \"patch0 local\" ]\n+'\n+\n+test_expect_success 'Reset and push patches again' '\n+    git reset --hard &&\n+    stg push -a\n+'\n+\n+test_expect_success 'Pop a patch without local changes' '\n+    stg pop --keep &&\n+    [ \"$(echo $(stg applied))\" = \"p0 p1\" ] &&\n+    [ \"$(echo $(stg unapplied))\" = \"p2\" ] &&\n+    [ \"$(echo $(ls patch?.txt))\" = \"patch0.txt patch1.txt\" ]\n+'\n+\n+test_done\n"},{"id":"55112","messageId":"20071007231729.12626.64039.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 3/8] Fix up the help text for \"stg edit\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:30Z","receivedAt":"2007-10-07T23:17:30Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"The sentence structure was strange, and the example format was\nsomewhat misleading (StGit doesn't care about sign-off lines, for\nexample).\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/edit.py |   24 +++++++++++++++---------\n 1 files changed, 15 insertions(+), 9 deletions(-)\n\n\ndiff --git a/stgit/commands/edit.py b/stgit/commands/edit.py\nindex 63c710b..e968e25 100644\n--- a/stgit/commands/edit.py\n+++ b/stgit/commands/edit.py\n@@ -30,19 +30,25 @@ from stgit import stack, git\n help = 'edit a patch description or diff'\n usage = \"\"\"%prog [options] [<patch>]\n \n-Edit the given patch (defaulting to the current one) description,\n-author information or its diff (if the '--diff' option is\n-passed). Without any other option, the command invokes the editor with\n-the patch description and diff in the form below:\n+Edit the description and author information of the given patch (or the\n+current patch if no patch name was given). With --diff, also edit the\n+diff.\n \n-  Subject line\n+The editor is invoked with the following contents:\n \n-  From: author information\n+  Patch short description\n+\n+  From: A U Thor <author@example.com>\n   Date: creation date\n \n-  Patch description\n+  Patch long description\n+\n+If --diff was specified, the diff appears at the bottom, after a\n+separator:\n+\n+  ---\n \n-  Signed-off-by: author\n+  Diff text\n \n Command-line options can be used to modify specific information\n without invoking the editor.\n@@ -54,7 +60,7 @@ these files using the '--file' and '--diff' options.\n \"\"\"\n \n options = [make_option('-d', '--diff',\n-                       help = 'allow the editing of the patch diff',\n+                       help = 'edit the patch diff',\n                        action = 'store_true'),\n            make_option('-f', '--file',\n                        help = 'use FILE instead of invoking the editor'),\n"},{"id":"55111","messageId":"20071007231735.12626.81744.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 4/8] Don't split long and short description in \"stg edit\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:35Z","receivedAt":"2007-10-07T23:17:35Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"\"stg edit\" used to present the patch information like this:\n\n  Short description\n\n  From: ...\n  Date: ...\n\n  Long description\n\nIf the project follows the git convention with a single-line short\ndescription and follwed by a blank line and the rest of the\ndescription, this merely looks a little odd. However, for projects\nthat don't follow that convention, presenting the first line\nseparately is actively inconvenient; for example, it breaks emacs's\nfill-paragraph command.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/edit.py |   17 ++++-------------\n 1 files changed, 4 insertions(+), 13 deletions(-)\n\n\ndiff --git a/stgit/commands/edit.py b/stgit/commands/edit.py\nindex e968e25..223c628 100644\n--- a/stgit/commands/edit.py\n+++ b/stgit/commands/edit.py\n@@ -36,12 +36,10 @@ diff.\n \n The editor is invoked with the following contents:\n \n-  Patch short description\n-\n   From: A U Thor <author@example.com>\n   Date: creation date\n \n-  Patch long description\n+  Patch description\n \n If --diff was specified, the diff appears at the bottom, after a\n separator:\n@@ -135,22 +133,15 @@ def __edit_update_patch(pname, options):\n \n     # generate the file to be edited\n     descr = patch.get_description().strip()\n-    descr_lines = descr.split('\\n')\n     authdate = patch.get_authdate()\n \n-    short_descr = descr_lines[0].rstrip()\n-    long_descr = reduce(lambda x, y: x + '\\n' + y,\n-                        descr_lines[1:], '').strip()\n-\n-    tmpl = '%(shortdescr)s\\n\\n' \\\n-           'From: %(authname)s <%(authemail)s>\\n'\n+    tmpl = 'From: %(authname)s <%(authemail)s>\\n'\n     if authdate:\n         tmpl += 'Date: %(authdate)s\\n'\n-    tmpl += '\\n%(longdescr)s\\n'\n+    tmpl += '\\n%(descr)s\\n'\n \n     tmpl_dict = {\n-        'shortdescr': short_descr,\n-        'longdescr': long_descr,\n+        'descr': descr,\n         'authname': patch.get_authname(),\n         'authemail': patch.get_authemail(),\n         'authdate': patch.get_authdate()\n"},{"id":"55113","messageId":"20071007231741.12626.97806.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 5/8] Make a common superclass for all StGit exceptions","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:41Z","receivedAt":"2007-10-07T23:17:41Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This makes it easier to catch them all. (Indeed, the very long list of\nexceptions to catch in main.py was missing some of the exceptions.)\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/common.py |    5 +++--\n stgit/config.py          |    3 ++-\n stgit/exception.py       |    3 +++\n stgit/git.py             |    3 ++-\n stgit/gitmergeonefile.py |    3 ++-\n stgit/main.py            |   11 +++--------\n stgit/run.py             |    5 +++--\n stgit/stack.py           |    3 ++-\n stgit/utils.py           |    3 ++-\n 9 files changed, 22 insertions(+), 17 deletions(-)\n create mode 100644 stgit/exception.py\n\n\ndiff --git a/stgit/commands/common.py b/stgit/commands/common.py\nindex 0fc157a..27a616f 100644\n--- a/stgit/commands/common.py\n+++ b/stgit/commands/common.py\n@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n import sys, os, os.path, re\n from optparse import OptionParser, make_option\n \n+from stgit.exception import *\n from stgit.utils import *\n from stgit.out import *\n from stgit import stack, git, basedir\n@@ -30,11 +31,11 @@ crt_series = None\n \n \n # Command exception class\n-class CmdException(Exception):\n+class CmdException(StgException):\n     pass\n \n # Utility functions\n-class RevParseException(Exception):\n+class RevParseException(StgException):\n     \"\"\"Revision spec parse error.\"\"\"\n     pass\n \ndiff --git a/stgit/config.py b/stgit/config.py\nindex 51818bd..3eabc8c 100644\n--- a/stgit/config.py\n+++ b/stgit/config.py\n@@ -20,9 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n \n import os, re\n from stgit import basedir\n+from stgit.exception import *\n from stgit.run import *\n \n-class GitConfigException(Exception):\n+class GitConfigException(StgException):\n     pass\n \n class GitConfig:\ndiff --git a/stgit/exception.py b/stgit/exception.py\nnew file mode 100644\nindex 0000000..9933e64\n--- /dev/null\n+++ b/stgit/exception.py\n@@ -0,0 +1,3 @@\n+class StgException(Exception):\n+    \"\"\"Base class for all StGit exceptions.\"\"\"\n+    pass\ndiff --git a/stgit/git.py b/stgit/git.py\nindex a0493bc..0026fd8 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n import sys, os, re, gitmergeonefile\n from shutil import copyfile\n \n+from stgit.exception import *\n from stgit import basedir\n from stgit.utils import *\n from stgit.out import *\n@@ -28,7 +29,7 @@ from stgit.run import *\n from stgit.config import config\n \n # git exception class\n-class GitException(Exception):\n+class GitException(StgException):\n     pass\n \n # When a subprocess has a problem, we want the exception to be a\ndiff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py\nindex 2aa5ef8..058b6ac 100644\n--- a/stgit/gitmergeonefile.py\n+++ b/stgit/gitmergeonefile.py\n@@ -19,13 +19,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n \"\"\"\n \n import sys, os\n+from stgit.exception import *\n from stgit import basedir\n from stgit.config import config, file_extensions, ConfigOption\n from stgit.utils import append_string\n from stgit.out import *\n from stgit.run import *\n \n-class GitMergeException(Exception):\n+class GitMergeException(StgException):\n     pass\n \n \ndiff --git a/stgit/main.py b/stgit/main.py\nindex 2c8716b..f54330d 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -255,13 +255,10 @@ def main():\n \n     # These modules are only used from this point onwards and do not\n     # need to be imported earlier\n+    from stgit.exception import StgException\n     from stgit.config import config_setup\n     from ConfigParser import ParsingError, NoSectionError\n-    from stgit.stack import Series, StackException\n-    from stgit.git import GitException\n-    from stgit.commands.common import CmdException\n-    from stgit.gitmergeonefile import GitMergeException\n-    from stgit.utils import EditorException\n+    from stgit.stack import Series\n \n     try:\n         debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])\n@@ -284,9 +281,7 @@ def main():\n             stgit.commands.common.crt_series = command.crt_series\n \n         command.func(parser, options, args)\n-    except (IOError, ParsingError, NoSectionError, CmdException,\n-            StackException, GitException, GitMergeException,\n-            EditorException), err:\n+    except (StgException, IOError, ParsingError, NoSectionError), err:\n         print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)\n         if debug_level > 0:\n             raise\ndiff --git a/stgit/run.py b/stgit/run.py\nindex 7986f3b..989bb27 100644\n--- a/stgit/run.py\n+++ b/stgit/run.py\n@@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n \n import datetime, os, subprocess\n \n-from  stgit.out import *\n+from stgit.exception import *\n+from stgit.out import *\n \n-class RunException(Exception):\n+class RunException(StgException):\n     \"\"\"Thrown when something bad happened when we tried to run the\n     subprocess.\"\"\"\n     pass\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 4d1a066..bdb4e38 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n import sys, os, re\n from email.Utils import formatdate\n \n+from stgit.exception import *\n from stgit.utils import *\n from stgit.out import *\n from stgit.run import *\n@@ -30,7 +31,7 @@ from shutil import copyfile\n \n \n # stack exception class\n-class StackException(Exception):\n+class StackException(StgException):\n     pass\n \n class FilterUntil:\ndiff --git a/stgit/utils.py b/stgit/utils.py\nindex 857c0f0..3a480c0 100644\n--- a/stgit/utils.py\n+++ b/stgit/utils.py\n@@ -2,6 +2,7 @@\n \"\"\"\n \n import errno, optparse, os, os.path, re, sys\n+from stgit.exception import *\n from stgit.config import config\n from stgit.out import *\n \n@@ -166,7 +167,7 @@ def rename(basedir, file1, file2):\n         # file1's parent dir may not be empty after move\n         pass\n \n-class EditorException(Exception):\n+class EditorException(StgException):\n     pass\n \n def call_editor(filename):\n"},{"id":"55114","messageId":"20071007231747.12626.26660.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 6/8] Simplify debug level error checking","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:47Z","receivedAt":"2007-10-07T23:17:47Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Signed-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/main.py |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\n\ndiff --git a/stgit/main.py b/stgit/main.py\nindex f54330d..19ba2bd 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -261,9 +261,7 @@ def main():\n     from stgit.stack import Series\n \n     try:\n-        debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])\n-    except KeyError:\n-        debug_level = 0\n+        debug_level = int(os.environ.get('STGIT_DEBUG_LEVEL', 0))\n     except ValueError:\n         out.error('Invalid STGIT_DEBUG_LEVEL environment variable')\n         sys.exit(1)\n"},{"id":"55115","messageId":"20071007231753.12626.35320.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 7/8] Discard stderr output from git-rev-parse","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:17:53Z","receivedAt":"2007-10-07T23:17:53Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This gets rid of the annoying \"fatal: Needed a single revision\"\nmessages that were printed in addition to StGit's own error message.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/git.py |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\n\ndiff --git a/stgit/git.py b/stgit/git.py\nindex 0026fd8..812b77a 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -301,7 +301,8 @@ def rev_parse(git_id):\n     \"\"\"Parse the string and return a verified SHA1 id\n     \"\"\"\n     try:\n-        return GRun('git-rev-parse', '--verify', git_id).output_one_line()\n+        return GRun('git-rev-parse', '--verify', git_id\n+                    ).discard_stderr().output_one_line()\n     except GitRunException:\n         raise GitException, 'Unknown revision: %s' % git_id\n \n"},{"id":"55116","messageId":"20071007231830.12626.30574.stgit@yoghurt","threadId":"10183","inReplyTo":"20071007231446.12626.14259.stgit@yoghurt","subject":"[StGit PATCH 8/8] Remove the --force flag to \"stg rebase\" and \"stg pull\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T23:18:30Z","receivedAt":"2007-10-07T23:18:30Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Instead, always behave as if the force flag was given; that is, don't\ncheck if rebasing would leave a dangling commit behind. Reasons:\n\n  * The check for this was very strict and caused a lot of false\n    positives.\n\n  * Everything is recorded in the reflog, so we can't actually lose\n    commits.\n\nThis fixes bug 9181.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/common.py      |    9 +--------\n stgit/commands/pull.py        |    5 +----\n stgit/commands/rebase.py      |    5 +----\n stgit/stack.py                |    1 -\n t/t2100-pull-policy-fetch.sh  |   14 --------------\n t/t2102-pull-policy-rebase.sh |   24 ------------------------\n 6 files changed, 3 insertions(+), 55 deletions(-)\n\n\ndiff --git a/stgit/commands/common.py b/stgit/commands/common.py\nindex 27a616f..9815400 100644\n--- a/stgit/commands/common.py\n+++ b/stgit/commands/common.py\n@@ -318,14 +318,7 @@ def address_or_alias(addr_str):\n                  for addr in addr_str.split(',')]\n     return ', '.join([addr for addr in addr_list if addr])\n \n-def prepare_rebase(force=None):\n-    if not force:\n-        # Be sure we won't loose results of stg-(un)commit by error.\n-        # Do not require an existing orig-base for compatibility with 0.12 and earlier.\n-        origbase = crt_series._get_field('orig-base')\n-        if origbase and crt_series.get_base() != origbase:\n-            raise CmdException, 'Rebasing would possibly lose data'\n-\n+def prepare_rebase():\n     # pop all patches\n     applied = crt_series.get_applied()\n     if len(applied) > 0:\ndiff --git a/stgit/commands/pull.py b/stgit/commands/pull.py\nindex 070db99..237bdd9 100644\n--- a/stgit/commands/pull.py\n+++ b/stgit/commands/pull.py\n@@ -43,9 +43,6 @@ options = [make_option('-n', '--nopush',\n                        action = 'store_true'),\n            make_option('-m', '--merged',\n                        help = 'check for patches merged upstream',\n-                       action = 'store_true'),\n-           make_option('--force',\n-                       help = 'force rebase even if the stack based was moved by (un)commits',\n                        action = 'store_true')]\n \n def func(parser, options, args):\n@@ -81,7 +78,7 @@ def func(parser, options, args):\n     if policy not in ['pull', 'fetch-rebase', 'rebase']:\n         raise GitConfigException, 'Unsupported pull-policy \"%s\"' % policy\n \n-    applied = prepare_rebase(force=options.force)\n+    applied = prepare_rebase()\n \n     # pull the remote changes\n     if policy == 'pull':\ndiff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py\nindex c68f8e7..513729a 100644\n--- a/stgit/commands/rebase.py\n+++ b/stgit/commands/rebase.py\n@@ -34,9 +34,6 @@ options = [make_option('-n', '--nopush',\n                        action = 'store_true'),\n            make_option('-m', '--merged',\n                        help = 'check for patches merged upstream',\n-                       action = 'store_true'),\n-           make_option('--force',\n-                       help = 'force rebase even if the stack based was moved by (un)commits',\n                        action = 'store_true')]\n \n def func(parser, options, args):\n@@ -56,7 +53,7 @@ def func(parser, options, args):\n     if git_id(args[0]) == None:\n         raise GitException, 'Unknown revision: %s' % args[0]\n         \n-    applied = prepare_rebase(force=options.force)\n+    applied = prepare_rebase()\n     rebase(args[0])\n     post_rebase(applied, options.nopush, options.merged)\n \ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex bdb4e38..94856b8 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -623,7 +623,6 @@ class Series(PatchSet):\n \n         self.create_empty_field('applied')\n         self.create_empty_field('unapplied')\n-        self._set_field('orig-base', git.get_head())\n \n         config.set(self.format_version_key(), str(FORMAT_VERSION))\n \ndiff --git a/t/t2100-pull-policy-fetch.sh b/t/t2100-pull-policy-fetch.sh\nindex 1f50069..28901b1 100755\n--- a/t/t2100-pull-policy-fetch.sh\n+++ b/t/t2100-pull-policy-fetch.sh\n@@ -55,18 +55,4 @@ test_expect_success \\\n     test `wc -l <clone/file2` = 3\n     '\n \n-# this one exercises the guard against commits\n-# (use a new file to avoid mistaking a conflict for a success)\n-test_expect_success \\\n-    'New upstream commit and commit a patch in clone' \\\n-    '\n-    (cd upstream && stg new u2 -m u2 &&\n-     echo a > file3 && stg add file3 && stg refresh) &&\n-    (cd clone && stg commit && stg new c2 -m c2 &&\n-     echo a >> file && stg refresh)\n-    '\n-test_expect_success \\\n-    'Try to  and commit a patch in clone' \\\n-    '(cd clone && ! stg pull)'\n-\n test_done\ndiff --git a/t/t2102-pull-policy-rebase.sh b/t/t2102-pull-policy-rebase.sh\nindex b2fbfcf..ce2e32f 100755\n--- a/t/t2102-pull-policy-rebase.sh\n+++ b/t/t2102-pull-policy-rebase.sh\n@@ -36,28 +36,4 @@ test_expect_success \\\n     test `wc -l <file2` = 2\n     '\n \n-# this one exercises the guard against commits\n-# (use a new file to avoid mistaking a conflict for a success)\n-test_expect_success \\\n-    'New commit in parent and commit a patch in stack' \\\n-    '\n-    stg branch parent && stg new u2 -m u2 &&\n-     echo c > file3 && stg add file3 && stg refresh &&\n-    stg branch stack && stg commit && stg new c2 -m c2 &&\n-     echo a >> file && stg refresh\n-    '\n-test_expect_success \\\n-    'Try to pull/rebase now that stack base has moved' \\\n-    '! stg pull'\n-\n-test_expect_success \\\n-    'Force the pull/rebase, but do not push yet' \\\n-    'stg pull --force --nopush'\n-test_expect_success \\\n-    '...check we lost the committed patch' \\\n-    '! test -e file'\n-test_expect_success \\\n-    '...and check we get a conflict while pushing' \\\n-    '! stg push'\n-\n test_done\n"},{"id":"55133","messageId":"20071007234009.GA19073@old.davidb.org","threadId":"10183","inReplyTo":"20071007231735.12626.81744.stgit@yoghurt","subject":"Re: [StGit PATCH 4/8] Don't split long and short description in \"stg edit\"","fromName":"David Brown","fromEmail":"git@davidb.org","sentAt":"2007-10-07T23:40:10Z","receivedAt":"2007-10-07T23:40:10Z","isPatch":true,"sender":{"key":"git@davidb.org","avatar":"https://gravatar.com/avatar/94c86a2938470a74c2eac5e2b69afc0871f79a660295c02219597aba8cb101c1?d=mp&s=160"},"body":"On Mon, Oct 08, 2007 at 01:17:35AM +0200, Karl Hasselström wrote:\n>\"stg edit\" used to present the patch information like this:\n>\n>  Short description\n>\n>  From: ...\n>  Date: ...\n>\n>  Long description\n>\n>If the project follows the git convention with a single-line short\n>description and follwed by a blank line and the rest of the\n>description, this merely looks a little odd. However, for projects\n>that don't follow that convention, presenting the first line\n>separately is actively inconvenient; for example, it breaks emacs's\n>fill-paragraph command.\n\nI think this fix is better to begin with.  I found it especially confusing\nwhen there was only a single line commit message.  Now the header looks\nlike a header :-)\n\nDavid\n"},{"id":"55165","messageId":"20071008064142.GA6170@diana.vm.bytemark.co.uk","threadId":"10183","inReplyTo":"20071007234009.GA19073@old.davidb.org","subject":"Re: [StGit PATCH 4/8] Don't split long and short description in \"stg edit\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-08T06:41:42Z","receivedAt":"2007-10-08T06:41:42Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-07 16:40:10 -0700, David Brown wrote:\n\n> On Mon, Oct 08, 2007 at 01:17:35AM +0200, Karl Hasselström wrote:\n>\n> > \"stg edit\" used to present the patch information like this:\n>\n> I think this fix is better to begin with. I found it especially\n> confusing when there was only a single line commit message. Now the\n> header looks like a header :-)\n\nYes, that case was confusing too.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}