chiark / gitweb /
[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 b6e24d918ca1a657e1a3500ec880dbb40fb461be..a636ad2a6203c3417b7d4195d56c503d51240c82 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 433e4526b92dd7f3bf0c3cc7ff604a076e615ce7..7847a38dd186cfe69828339e24d5cf9e10c9014a 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 45dabb49d4a58bf6cd7581650496093bb66d899e..335b554b40649b106123de3bbb85d49521d0f26d 100755 (executable)
@@ -49,7 +49,6 @@ test_expect_failure \
 test_expect_success \
        'Undo the previous push' \
        '
-       stg status --reset &&
        stg push --undo
        '
 
index 34162f42618944e1f62625230d4e5640d9b6845d..59dc134ad7b05bd61e4767e51317a0373ae4df05 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 "
        '