X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/26aab5b04fa4ba13f48948de73e497cf0a315ad1..3c6fbd2cb3fd1d2a18585d3c13cd4517021b2f36:/stgit/commands/push.py diff --git a/stgit/commands/push.py b/stgit/commands/push.py index 6325483..a4b507e 100644 --- a/stgit/commands/push.py +++ b/stgit/commands/push.py @@ -66,8 +66,10 @@ def func(parser, options, args): print 'Undoing the "%s" push...' % patch, sys.stdout.flush() resolved_all() - crt_series.undo_push() - print 'done' + if crt_series.undo_push(): + print 'done' + else: + print 'done (patch unchanged)' print_crt_patch() return @@ -106,7 +108,9 @@ def func(parser, options, args): elif len(args) == 0: patches = [unapplied[0]] elif len(args) == 1: - patches = [args[0]] + patches = args + if patches[0] not in unapplied: + raise CmdException, 'Patch "%s" not unapplied' % patches[0] else: parser.error('incorrect number of arguments') @@ -116,7 +120,21 @@ def func(parser, options, args): if options.reverse: patches.reverse() - for p in patches: + print 'Trying fast-forward...' + + forwarded = crt_series.forward_patches(patches) + if forwarded > 1: + print 'Fast-forwarded patches "%s" - "%s"' % (patches[0], + patches[forwarded - 1]) + elif forwarded == 1: + print 'Fast-forwarded patch "%s"' % patches[0] + else: + print 'Fast-forwarding failed, using normal pushing' + + for p in patches[forwarded:]: + if p not in unapplied: + raise CmdException, 'Patch "%s" not unapplied' % p + print 'Pushing patch "%s"...' % p, sys.stdout.flush()