git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGit PATCH 0/8] Miscellaneous fixes and improvements
@ 2007-10-07 23:17 Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 1/8] Add --ack/--sign options to "stg new" Karl Hasselström
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Also available from

  git://repo.or.cz/stgit/kha.git safe

---

Karl Hasselström (8):
      Remove the --force flag to "stg rebase" and "stg pull"
      Discard stderr output from git-rev-parse
      Simplify debug level error checking
      Make a common superclass for all StGit exceptions
      Don't split long and short description in "stg edit"
      Fix up the help text for "stg edit"
      New test: "stg pop --keep"
      Add --ack/--sign options to "stg new"


 stgit/commands/common.py      |   14 ++++----------
 stgit/commands/edit.py        |   33 +++++++++++++++-----------------
 stgit/commands/new.py         |    6 ++++--
 stgit/commands/pull.py        |    5 +----
 stgit/commands/rebase.py      |    5 +----
 stgit/config.py               |    3 ++-
 stgit/exception.py            |    3 +++
 stgit/git.py                  |    6 ++++--
 stgit/gitmergeonefile.py      |    3 ++-
 stgit/main.py                 |   15 ++++-----------
 stgit/run.py                  |    5 +++--
 stgit/stack.py                |   14 +++++++++-----
 stgit/utils.py                |    3 ++-
 t/t1204-pop-keep.sh           |   42 +++++++++++++++++++++++++++++++++++++++++
 t/t2100-pull-policy-fetch.sh  |   14 --------------
 t/t2102-pull-policy-rebase.sh |   24 -----------------------
 16 files changed, 96 insertions(+), 99 deletions(-)
 create mode 100644 stgit/exception.py
 create mode 100755 t/t1204-pop-keep.sh

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [StGit PATCH 1/8] Add --ack/--sign options to "stg new"
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 2/8] New test: "stg pop --keep" Karl Hasselström
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/new.py |    6 ++++--
 stgit/stack.py        |   10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)


diff --git a/stgit/commands/new.py b/stgit/commands/new.py
index f192e34..59671ab 100644
--- a/stgit/commands/new.py
+++ b/stgit/commands/new.py
@@ -54,7 +54,8 @@ options = [make_option('-m', '--message',
            make_option('--commname',
                        help = 'use COMMNAME as the committer name'),
            make_option('--commemail',
-                       help = 'use COMMEMAIL as the committer e-mail')]
+                       help = 'use COMMEMAIL as the committer e-mail')
+           ] + make_sign_options()
 
 
 def func(parser, options, args):
@@ -79,4 +80,5 @@ def func(parser, options, args):
                          author_email = options.authemail,
                          author_date = options.authdate,
                          committer_name = options.commname,
-                         committer_email = options.commemail)
+                         committer_email = options.commemail,
+                         sign_str = options.sign_str)
diff --git a/stgit/stack.py b/stgit/stack.py
index d889f37..4d1a066 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -847,7 +847,7 @@ class Series(PatchSet):
                   top = None, bottom = None, commit = True,
                   author_name = None, author_email = None, author_date = None,
                   committer_name = None, committer_email = None,
-                  before_existing = False):
+                  before_existing = False, sign_str = None):
         """Creates a new patch, either pointing to an existing commit object,
         or by creating a new commit object.
         """
@@ -865,13 +865,17 @@ class Series(PatchSet):
 
         # TODO: move this out of the stgit.stack module, it is really
         # for higher level commands to handle the user interaction
+        def sign(msg):
+            return add_sign_line(msg, sign_str,
+                                 committer_name or git.committer().name,
+                                 committer_email or git.committer().email)
         if not message and can_edit:
             descr = edit_file(
-                self, None,
+                self, sign(''),
                 'Please enter the description for the patch above.',
                 show_patch)
         else:
-            descr = message
+            descr = sign(message)
 
         head = git.get_head()
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 2/8] New test: "stg pop --keep"
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 1/8] Add --ack/--sign options to "stg new" Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 3/8] Fix up the help text for "stg edit" Karl Hasselström
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t1204-pop-keep.sh |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100755 t/t1204-pop-keep.sh


diff --git a/t/t1204-pop-keep.sh b/t/t1204-pop-keep.sh
new file mode 100755
index 0000000..40cd2a2
--- /dev/null
+++ b/t/t1204-pop-keep.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='Test "stg pop -keep"'
+. ./test-lib.sh
+stg init
+
+test_expect_success 'Create a few patches' '
+    for i in 0 1 2; do
+        stg new p$i -m p$i &&
+        echo "patch$i" >> patch$i.txt &&
+        stg add patch$i.txt &&
+        stg refresh
+    done &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success 'Make some non-conflicting local changes' '
+    echo "local" >> patch0.txt
+'
+
+test_expect_success 'Pop two patches, keeping local changes' '
+    stg pop -n 2 --keep &&
+    [ "$(echo $(stg applied))" = "p0" ] &&
+    [ "$(echo $(stg unapplied))" = "p1 p2" ] &&
+    [ "$(echo $(ls patch?.txt))" = "patch0.txt" ] &&
+    [ "$(echo $(cat patch0.txt))" = "patch0 local" ]
+'
+
+test_expect_success 'Reset and push patches again' '
+    git reset --hard &&
+    stg push -a
+'
+
+test_expect_success 'Pop a patch without local changes' '
+    stg pop --keep &&
+    [ "$(echo $(stg applied))" = "p0 p1" ] &&
+    [ "$(echo $(stg unapplied))" = "p2" ] &&
+    [ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]
+'
+
+test_done

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 3/8] Fix up the help text for "stg edit"
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 1/8] Add --ack/--sign options to "stg new" Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 2/8] New test: "stg pop --keep" Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 4/8] Don't split long and short description in " Karl Hasselström
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

The sentence structure was strange, and the example format was
somewhat misleading (StGit doesn't care about sign-off lines, for
example).

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/edit.py |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)


diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index 63c710b..e968e25 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -30,19 +30,25 @@ from stgit import stack, git
 help = 'edit a patch description or diff'
 usage = """%prog [options] [<patch>]
 
-Edit the given patch (defaulting to the current one) description,
-author information or its diff (if the '--diff' option is
-passed). Without any other option, the command invokes the editor with
-the patch description and diff in the form below:
+Edit the description and author information of the given patch (or the
+current patch if no patch name was given). With --diff, also edit the
+diff.
 
-  Subject line
+The editor is invoked with the following contents:
 
-  From: author information
+  Patch short description
+
+  From: A U Thor <author@example.com>
   Date: creation date
 
-  Patch description
+  Patch long description
+
+If --diff was specified, the diff appears at the bottom, after a
+separator:
+
+  ---
 
-  Signed-off-by: author
+  Diff text
 
 Command-line options can be used to modify specific information
 without invoking the editor.
@@ -54,7 +60,7 @@ these files using the '--file' and '--diff' options.
 """
 
 options = [make_option('-d', '--diff',
-                       help = 'allow the editing of the patch diff',
+                       help = 'edit the patch diff',
                        action = 'store_true'),
            make_option('-f', '--file',
                        help = 'use FILE instead of invoking the editor'),

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 4/8] Don't split long and short description in "stg edit"
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
                   ` (2 preceding siblings ...)
  2007-10-07 23:17 ` [StGit PATCH 3/8] Fix up the help text for "stg edit" Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:40   ` David Brown
  2007-10-07 23:17 ` [StGit PATCH 5/8] Make a common superclass for all StGit exceptions Karl Hasselström
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

"stg edit" used to present the patch information like this:

  Short description

  From: ...
  Date: ...

  Long description

If the project follows the git convention with a single-line short
description and follwed by a blank line and the rest of the
description, this merely looks a little odd. However, for projects
that don't follow that convention, presenting the first line
separately is actively inconvenient; for example, it breaks emacs's
fill-paragraph command.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/edit.py |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)


diff --git a/stgit/commands/edit.py b/stgit/commands/edit.py
index e968e25..223c628 100644
--- a/stgit/commands/edit.py
+++ b/stgit/commands/edit.py
@@ -36,12 +36,10 @@ diff.
 
 The editor is invoked with the following contents:
 
-  Patch short description
-
   From: A U Thor <author@example.com>
   Date: creation date
 
-  Patch long description
+  Patch description
 
 If --diff was specified, the diff appears at the bottom, after a
 separator:
@@ -135,22 +133,15 @@ def __edit_update_patch(pname, options):
 
     # generate the file to be edited
     descr = patch.get_description().strip()
-    descr_lines = descr.split('\n')
     authdate = patch.get_authdate()
 
-    short_descr = descr_lines[0].rstrip()
-    long_descr = reduce(lambda x, y: x + '\n' + y,
-                        descr_lines[1:], '').strip()
-
-    tmpl = '%(shortdescr)s\n\n' \
-           'From: %(authname)s <%(authemail)s>\n'
+    tmpl = 'From: %(authname)s <%(authemail)s>\n'
     if authdate:
         tmpl += 'Date: %(authdate)s\n'
-    tmpl += '\n%(longdescr)s\n'
+    tmpl += '\n%(descr)s\n'
 
     tmpl_dict = {
-        'shortdescr': short_descr,
-        'longdescr': long_descr,
+        'descr': descr,
         'authname': patch.get_authname(),
         'authemail': patch.get_authemail(),
         'authdate': patch.get_authdate()

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 5/8] Make a common superclass for all StGit exceptions
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
                   ` (3 preceding siblings ...)
  2007-10-07 23:17 ` [StGit PATCH 4/8] Don't split long and short description in " Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 6/8] Simplify debug level error checking Karl Hasselström
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This makes it easier to catch them all. (Indeed, the very long list of
exceptions to catch in main.py was missing some of the exceptions.)

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/common.py |    5 +++--
 stgit/config.py          |    3 ++-
 stgit/exception.py       |    3 +++
 stgit/git.py             |    3 ++-
 stgit/gitmergeonefile.py |    3 ++-
 stgit/main.py            |   11 +++--------
 stgit/run.py             |    5 +++--
 stgit/stack.py           |    3 ++-
 stgit/utils.py           |    3 ++-
 9 files changed, 22 insertions(+), 17 deletions(-)
 create mode 100644 stgit/exception.py


diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 0fc157a..27a616f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 import sys, os, os.path, re
 from optparse import OptionParser, make_option
 
+from stgit.exception import *
 from stgit.utils import *
 from stgit.out import *
 from stgit import stack, git, basedir
@@ -30,11 +31,11 @@ crt_series = None
 
 
 # Command exception class
-class CmdException(Exception):
+class CmdException(StgException):
     pass
 
 # Utility functions
-class RevParseException(Exception):
+class RevParseException(StgException):
     """Revision spec parse error."""
     pass
 
diff --git a/stgit/config.py b/stgit/config.py
index 51818bd..3eabc8c 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -20,9 +20,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 import os, re
 from stgit import basedir
+from stgit.exception import *
 from stgit.run import *
 
-class GitConfigException(Exception):
+class GitConfigException(StgException):
     pass
 
 class GitConfig:
diff --git a/stgit/exception.py b/stgit/exception.py
new file mode 100644
index 0000000..9933e64
--- /dev/null
+++ b/stgit/exception.py
@@ -0,0 +1,3 @@
+class StgException(Exception):
+    """Base class for all StGit exceptions."""
+    pass
diff --git a/stgit/git.py b/stgit/git.py
index a0493bc..0026fd8 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 import sys, os, re, gitmergeonefile
 from shutil import copyfile
 
+from stgit.exception import *
 from stgit import basedir
 from stgit.utils import *
 from stgit.out import *
@@ -28,7 +29,7 @@ from stgit.run import *
 from stgit.config import config
 
 # git exception class
-class GitException(Exception):
+class GitException(StgException):
     pass
 
 # When a subprocess has a problem, we want the exception to be a
diff --git a/stgit/gitmergeonefile.py b/stgit/gitmergeonefile.py
index 2aa5ef8..058b6ac 100644
--- a/stgit/gitmergeonefile.py
+++ b/stgit/gitmergeonefile.py
@@ -19,13 +19,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
 import sys, os
+from stgit.exception import *
 from stgit import basedir
 from stgit.config import config, file_extensions, ConfigOption
 from stgit.utils import append_string
 from stgit.out import *
 from stgit.run import *
 
-class GitMergeException(Exception):
+class GitMergeException(StgException):
     pass
 
 
diff --git a/stgit/main.py b/stgit/main.py
index 2c8716b..f54330d 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -255,13 +255,10 @@ def main():
 
     # These modules are only used from this point onwards and do not
     # need to be imported earlier
+    from stgit.exception import StgException
     from stgit.config import config_setup
     from ConfigParser import ParsingError, NoSectionError
-    from stgit.stack import Series, StackException
-    from stgit.git import GitException
-    from stgit.commands.common import CmdException
-    from stgit.gitmergeonefile import GitMergeException
-    from stgit.utils import EditorException
+    from stgit.stack import Series
 
     try:
         debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
@@ -284,9 +281,7 @@ def main():
             stgit.commands.common.crt_series = command.crt_series
 
         command.func(parser, options, args)
-    except (IOError, ParsingError, NoSectionError, CmdException,
-            StackException, GitException, GitMergeException,
-            EditorException), err:
+    except (StgException, IOError, ParsingError, NoSectionError), err:
         print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
         if debug_level > 0:
             raise
diff --git a/stgit/run.py b/stgit/run.py
index 7986f3b..989bb27 100644
--- a/stgit/run.py
+++ b/stgit/run.py
@@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 import datetime, os, subprocess
 
-from  stgit.out import *
+from stgit.exception import *
+from stgit.out import *
 
-class RunException(Exception):
+class RunException(StgException):
     """Thrown when something bad happened when we tried to run the
     subprocess."""
     pass
diff --git a/stgit/stack.py b/stgit/stack.py
index 4d1a066..bdb4e38 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 import sys, os, re
 from email.Utils import formatdate
 
+from stgit.exception import *
 from stgit.utils import *
 from stgit.out import *
 from stgit.run import *
@@ -30,7 +31,7 @@ from shutil import copyfile
 
 
 # stack exception class
-class StackException(Exception):
+class StackException(StgException):
     pass
 
 class FilterUntil:
diff --git a/stgit/utils.py b/stgit/utils.py
index 857c0f0..3a480c0 100644
--- a/stgit/utils.py
+++ b/stgit/utils.py
@@ -2,6 +2,7 @@
 """
 
 import errno, optparse, os, os.path, re, sys
+from stgit.exception import *
 from stgit.config import config
 from stgit.out import *
 
@@ -166,7 +167,7 @@ def rename(basedir, file1, file2):
         # file1's parent dir may not be empty after move
         pass
 
-class EditorException(Exception):
+class EditorException(StgException):
     pass
 
 def call_editor(filename):

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 6/8] Simplify debug level error checking
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
                   ` (4 preceding siblings ...)
  2007-10-07 23:17 ` [StGit PATCH 5/8] Make a common superclass for all StGit exceptions Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:17 ` [StGit PATCH 7/8] Discard stderr output from git-rev-parse Karl Hasselström
  2007-10-07 23:18 ` [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull" Karl Hasselström
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/main.py |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)


diff --git a/stgit/main.py b/stgit/main.py
index f54330d..19ba2bd 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -261,9 +261,7 @@ def main():
     from stgit.stack import Series
 
     try:
-        debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
-    except KeyError:
-        debug_level = 0
+        debug_level = int(os.environ.get('STGIT_DEBUG_LEVEL', 0))
     except ValueError:
         out.error('Invalid STGIT_DEBUG_LEVEL environment variable')
         sys.exit(1)

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 7/8] Discard stderr output from git-rev-parse
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
                   ` (5 preceding siblings ...)
  2007-10-07 23:17 ` [StGit PATCH 6/8] Simplify debug level error checking Karl Hasselström
@ 2007-10-07 23:17 ` Karl Hasselström
  2007-10-07 23:18 ` [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull" Karl Hasselström
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:17 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This gets rid of the annoying "fatal: Needed a single revision"
messages that were printed in addition to StGit's own error message.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/git.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/stgit/git.py b/stgit/git.py
index 0026fd8..812b77a 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -301,7 +301,8 @@ def rev_parse(git_id):
     """Parse the string and return a verified SHA1 id
     """
     try:
-        return GRun('git-rev-parse', '--verify', git_id).output_one_line()
+        return GRun('git-rev-parse', '--verify', git_id
+                    ).discard_stderr().output_one_line()
     except GitRunException:
         raise GitException, 'Unknown revision: %s' % git_id
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull"
  2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
                   ` (6 preceding siblings ...)
  2007-10-07 23:17 ` [StGit PATCH 7/8] Discard stderr output from git-rev-parse Karl Hasselström
@ 2007-10-07 23:18 ` Karl Hasselström
  7 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-07 23:18 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

Instead, always behave as if the force flag was given; that is, don't
check if rebasing would leave a dangling commit behind. Reasons:

  * The check for this was very strict and caused a lot of false
    positives.

  * Everything is recorded in the reflog, so we can't actually lose
    commits.

This fixes bug 9181.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/common.py      |    9 +--------
 stgit/commands/pull.py        |    5 +----
 stgit/commands/rebase.py      |    5 +----
 stgit/stack.py                |    1 -
 t/t2100-pull-policy-fetch.sh  |   14 --------------
 t/t2102-pull-policy-rebase.sh |   24 ------------------------
 6 files changed, 3 insertions(+), 55 deletions(-)


diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 27a616f..9815400 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -318,14 +318,7 @@ def address_or_alias(addr_str):
                  for addr in addr_str.split(',')]
     return ', '.join([addr for addr in addr_list if addr])
 
-def prepare_rebase(force=None):
-    if not force:
-        # Be sure we won't loose results of stg-(un)commit by error.
-        # Do not require an existing orig-base for compatibility with 0.12 and earlier.
-        origbase = crt_series._get_field('orig-base')
-        if origbase and crt_series.get_base() != origbase:
-            raise CmdException, 'Rebasing would possibly lose data'
-
+def prepare_rebase():
     # pop all patches
     applied = crt_series.get_applied()
     if len(applied) > 0:
diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py
index 070db99..237bdd9 100644
--- a/stgit/commands/pull.py
+++ b/stgit/commands/pull.py
@@ -43,9 +43,6 @@ options = [make_option('-n', '--nopush',
                        action = 'store_true'),
            make_option('-m', '--merged',
                        help = 'check for patches merged upstream',
-                       action = 'store_true'),
-           make_option('--force',
-                       help = 'force rebase even if the stack based was moved by (un)commits',
                        action = 'store_true')]
 
 def func(parser, options, args):
@@ -81,7 +78,7 @@ def func(parser, options, args):
     if policy not in ['pull', 'fetch-rebase', 'rebase']:
         raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
 
-    applied = prepare_rebase(force=options.force)
+    applied = prepare_rebase()
 
     # pull the remote changes
     if policy == 'pull':
diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index c68f8e7..513729a 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -34,9 +34,6 @@ options = [make_option('-n', '--nopush',
                        action = 'store_true'),
            make_option('-m', '--merged',
                        help = 'check for patches merged upstream',
-                       action = 'store_true'),
-           make_option('--force',
-                       help = 'force rebase even if the stack based was moved by (un)commits',
                        action = 'store_true')]
 
 def func(parser, options, args):
@@ -56,7 +53,7 @@ def func(parser, options, args):
     if git_id(args[0]) == None:
         raise GitException, 'Unknown revision: %s' % args[0]
         
-    applied = prepare_rebase(force=options.force)
+    applied = prepare_rebase()
     rebase(args[0])
     post_rebase(applied, options.nopush, options.merged)
 
diff --git a/stgit/stack.py b/stgit/stack.py
index bdb4e38..94856b8 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -623,7 +623,6 @@ class Series(PatchSet):
 
         self.create_empty_field('applied')
         self.create_empty_field('unapplied')
-        self._set_field('orig-base', git.get_head())
 
         config.set(self.format_version_key(), str(FORMAT_VERSION))
 
diff --git a/t/t2100-pull-policy-fetch.sh b/t/t2100-pull-policy-fetch.sh
index 1f50069..28901b1 100755
--- a/t/t2100-pull-policy-fetch.sh
+++ b/t/t2100-pull-policy-fetch.sh
@@ -55,18 +55,4 @@ test_expect_success \
     test `wc -l <clone/file2` = 3
     '
 
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
-    'New upstream commit and commit a patch in clone' \
-    '
-    (cd upstream && stg new u2 -m u2 &&
-     echo a > file3 && stg add file3 && stg refresh) &&
-    (cd clone && stg commit && stg new c2 -m c2 &&
-     echo a >> file && stg refresh)
-    '
-test_expect_success \
-    'Try to  and commit a patch in clone' \
-    '(cd clone && ! stg pull)'
-
 test_done
diff --git a/t/t2102-pull-policy-rebase.sh b/t/t2102-pull-policy-rebase.sh
index b2fbfcf..ce2e32f 100755
--- a/t/t2102-pull-policy-rebase.sh
+++ b/t/t2102-pull-policy-rebase.sh
@@ -36,28 +36,4 @@ test_expect_success \
     test `wc -l <file2` = 2
     '
 
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
-    'New commit in parent and commit a patch in stack' \
-    '
-    stg branch parent && stg new u2 -m u2 &&
-     echo c > file3 && stg add file3 && stg refresh &&
-    stg branch stack && stg commit && stg new c2 -m c2 &&
-     echo a >> file && stg refresh
-    '
-test_expect_success \
-    'Try to pull/rebase now that stack base has moved' \
-    '! stg pull'
-
-test_expect_success \
-    'Force the pull/rebase, but do not push yet' \
-    'stg pull --force --nopush'
-test_expect_success \
-    '...check we lost the committed patch' \
-    '! test -e file'
-test_expect_success \
-    '...and check we get a conflict while pushing' \
-    '! stg push'
-
 test_done

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [StGit PATCH 4/8] Don't split long and short description in "stg edit"
  2007-10-07 23:17 ` [StGit PATCH 4/8] Don't split long and short description in " Karl Hasselström
@ 2007-10-07 23:40   ` David Brown
  2007-10-08  6:41     ` Karl Hasselström
  0 siblings, 1 reply; 11+ messages in thread
From: David Brown @ 2007-10-07 23:40 UTC (permalink / raw)
  To: Karl Hasselström; +Cc: Catalin Marinas, git

On Mon, Oct 08, 2007 at 01:17:35AM +0200, Karl Hasselström wrote:
>"stg edit" used to present the patch information like this:
>
>  Short description
>
>  From: ...
>  Date: ...
>
>  Long description
>
>If the project follows the git convention with a single-line short
>description and follwed by a blank line and the rest of the
>description, this merely looks a little odd. However, for projects
>that don't follow that convention, presenting the first line
>separately is actively inconvenient; for example, it breaks emacs's
>fill-paragraph command.

I think this fix is better to begin with.  I found it especially confusing
when there was only a single line commit message.  Now the header looks
like a header :-)

David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [StGit PATCH 4/8] Don't split long and short description in "stg edit"
  2007-10-07 23:40   ` David Brown
@ 2007-10-08  6:41     ` Karl Hasselström
  0 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-08  6:41 UTC (permalink / raw)
  To: Catalin Marinas, git

On 2007-10-07 16:40:10 -0700, David Brown wrote:

> On Mon, Oct 08, 2007 at 01:17:35AM +0200, Karl Hasselström wrote:
>
> > "stg edit" used to present the patch information like this:
>
> I think this fix is better to begin with. I found it especially
> confusing when there was only a single line commit message. Now the
> header looks like a header :-)

Yes, that case was confusing too.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-10-08  6:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-07 23:17 [StGit PATCH 0/8] Miscellaneous fixes and improvements Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 1/8] Add --ack/--sign options to "stg new" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 2/8] New test: "stg pop --keep" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 3/8] Fix up the help text for "stg edit" Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 4/8] Don't split long and short description in " Karl Hasselström
2007-10-07 23:40   ` David Brown
2007-10-08  6:41     ` Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 5/8] Make a common superclass for all StGit exceptions Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 6/8] Simplify debug level error checking Karl Hasselström
2007-10-07 23:17 ` [StGit PATCH 7/8] Discard stderr output from git-rev-parse Karl Hasselström
2007-10-07 23:18 ` [StGit PATCH 8/8] Remove the --force flag to "stg rebase" and "stg pull" Karl Hasselström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).