X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/f80bef4918840e4290f03f291d8b4dbb98b12d80..42fc7623404159ca33ba5ef1bd74ca4c339d827a:/stgit/commands/refresh.py diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py index 306e7b3..2d164cd 100644 --- a/stgit/commands/refresh.py +++ b/stgit/commands/refresh.py @@ -65,7 +65,15 @@ options = [make_option('-f', '--force', help = 'use COMMNAME as the committer name'), make_option('--commemail', help = 'use COMMEMAIL as the committer ' \ - 'e-mail')] + 'e-mail'), + make_option('-p', '--patch', + help = 'refresh (applied) PATCH instead of the top one'), + make_option('--sign', + help = 'add Signed-off-by line', + action = 'store_true'), + make_option('--ack', + help = 'add Acked-by line', + action = 'store_true')] def func(parser, options, args): @@ -74,9 +82,17 @@ def func(parser, options, args): if autoresolved != 'yes': check_conflicts() - patch = crt_series.get_current() - if not patch: - raise CmdException, 'No patches applied' + if options.patch: + if args: + raise CmdException, \ + 'Only full refresh is available with the --patch option' + patch = options.patch + if not crt_series.patch_applied(patch): + raise CmdException, 'Patches "%s" not applied' % patch + else: + patch = crt_series.get_current() + if not patch: + raise CmdException, 'No patches applied' if not options.force: check_head_top_equal() @@ -91,11 +107,27 @@ def func(parser, options, args): if options.author: options.authname, options.authemail = name_email(options.author) + if options.sign: + sign_str = 'Signed-off-by' + if options.ack: + raise CmdException, '--ack and --sign were both specified' + elif options.ack: + sign_str = 'Acked-by' + else: + sign_str = None + if git.local_changes() \ or not crt_series.head_top_equal() \ or options.edit or options.message \ or options.authname or options.authemail or options.authdate \ - or options.commname or options.commemail: + or options.commname or options.commemail \ + or options.sign or options.ack: + + if options.patch: + applied = crt_series.get_applied() + between = applied[:applied.index(patch):-1] + pop_patches(between, keep = True) + print 'Refreshing patch "%s"...' % patch, sys.stdout.flush() @@ -110,7 +142,11 @@ def func(parser, options, args): author_date = options.authdate, committer_name = options.commname, committer_email = options.commemail, - backup = True) + backup = True, sign_str = sign_str) + + if options.patch: + between.reverse() + push_patches(between) print 'done' else: