Refactor message printing
[stgit] / stgit / commands / push.py
index b6e24d9..17b32f6 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:
@@ -67,16 +64,20 @@ def func(parser, options, args):
         if not patch:
             raise CmdException, 'No patch to undo'
 
-        print 'Undoing the "%s" push...' % patch,
-        sys.stdout.flush()
+        out.start('Undoing push of "%s"' % patch)
+        resolved_all()
         if crt_series.undo_push():
-            print 'done'
+            out.done()
         else:
-            print 'done (patch unchanged)'
+            out.done('patch unchanged')
         print_crt_patch()
 
         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'