[Revert] Make 'push --undo' safer
authorCatalin Marinas <catalin.marinas@gmail.com>
Thu, 7 Dec 2006 22:02:42 +0000 (22:02 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 6 Mar 2007 22:44:04 +0000 (22:44 +0000)
(reverting of commit 539fb2921209bd3fd6165baa057f76f474aa5cb4)

Make the push undoing a bit safer by asking the user to first clean
the local changes or conflicts rather than silently resetting them.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/push.py
t/t1200-push-modified.sh
t/t1202-push-undo.sh
t/t1400-patch-history.sh

index b6e24d9..a636ad2 100644 (file)
@@ -57,9 +57,6 @@ options = [make_option('-a', '--all',
 def func(parser, options, args):
     """Pushes the given patch or all onto the series
     """
-    check_conflicts()
-    check_local_changes()
-    check_head_top_equal()
 
     # If --undo is passed, do the work and exit
     if options.undo:
@@ -69,6 +66,7 @@ def func(parser, options, args):
 
         print 'Undoing the "%s" push...' % patch,
         sys.stdout.flush()
+        resolved_all()
         if crt_series.undo_push():
             print 'done'
         else:
@@ -77,6 +75,10 @@ def func(parser, options, args):
 
         return
 
+    check_local_changes()
+    check_conflicts()
+    check_head_top_equal()
+
     unapplied = crt_series.get_unapplied()
     if not unapplied:
         raise CmdException, 'No more patches to push'
index 433e452..7847a38 100755 (executable)
@@ -51,7 +51,7 @@ test_expect_failure \
 
 test_expect_success \
     'Rollback the push' \
-    "(cd bar && stg status --reset && stg push --undo
+    "(cd bar && stg push --undo
      )
 "
 
index 45dabb4..335b554 100755 (executable)
@@ -49,7 +49,6 @@ test_expect_failure \
 test_expect_success \
        'Undo the previous push' \
        '
-       stg status --reset &&
        stg push --undo
        '
 
index 34162f4..59dc134 100755 (executable)
@@ -81,7 +81,6 @@ test_expect_success \
 test_expect_success \
        'Check the push "undo" log' \
        '
-       stg status --reset &&
        stg push --undo &&
        stg log bar | grep -q -e "^undo "
        '