From: Catalin Marinas Date: Thu, 7 Dec 2006 22:02:42 +0000 (+0000) Subject: Make 'push --undo' safer X-Git-Tag: v0.14.3~389 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/539fb2921209bd3fd6165baa057f76f474aa5cb4 Make 'push --undo' safer 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 --- diff --git a/stgit/commands/push.py b/stgit/commands/push.py index a636ad2..b6e24d9 100644 --- a/stgit/commands/push.py +++ b/stgit/commands/push.py @@ -57,6 +57,9 @@ 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: @@ -66,7 +69,6 @@ def func(parser, options, args): print 'Undoing the "%s" push...' % patch, sys.stdout.flush() - resolved_all() if crt_series.undo_push(): print 'done' else: @@ -75,10 +77,6 @@ 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' diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh index 7847a38..433e452 100755 --- a/t/t1200-push-modified.sh +++ b/t/t1200-push-modified.sh @@ -51,7 +51,7 @@ test_expect_failure \ test_expect_success \ 'Rollback the push' \ - "(cd bar && stg push --undo + "(cd bar && stg status --reset && stg push --undo ) " diff --git a/t/t1202-push-undo.sh b/t/t1202-push-undo.sh index 335b554..45dabb4 100755 --- a/t/t1202-push-undo.sh +++ b/t/t1202-push-undo.sh @@ -49,6 +49,7 @@ test_expect_failure \ test_expect_success \ 'Undo the previous push' \ ' + stg status --reset && stg push --undo '