help = 'generate a new commit for the current patch'
-usage = '%prog [options]'
+usage = """%prog [options] [<files...>]
+
+Include the latest tree changes in the current patch. This command
+generates a new GIT commit object with the patch details, the previous
+one no longer being visible. The patch attributes like author,
+committer and description can be changed with the command line
+options. The '--force' option is useful when a commit object was
+created with a different tool but the changes need to be included in
+the current patch."""
options = [make_option('-f', '--force',
help = 'force the refresh even if HEAD and '\
help = 'invoke an editor for the patch '\
'description',
action = 'store_true'),
+ make_option('-s', '--showpatch',
+ help = 'show the patch content in the editor buffer',
+ action = 'store_true'),
+ make_option('--undo',
+ help = 'revert the commit generated by the last refresh',
+ action = 'store_true'),
make_option('-m', '--message',
help = 'use MESSAGE as the patch ' \
'description'),
def func(parser, options, args):
- if len(args) != 0:
- parser.error('incorrect number of arguments')
-
- if config.has_option('stgit', 'autoresolved'):
- autoresolved = config.get('stgit', 'autoresolved')
- else:
- autoresolved = 'no'
+ autoresolved = config.get('stgit', 'autoresolved')
if autoresolved != 'yes':
check_conflicts()
if not options.force:
check_head_top_equal()
+ if options.undo:
+ print 'Undoing the "%s" refresh...' % patch,
+ sys.stdout.flush()
+ crt_series.undo_refresh()
+ print 'done'
+ return
+
if options.author:
options.authname, options.authemail = name_email(options.author)
if autoresolved == 'yes':
resolved_all()
- crt_series.refresh_patch(message = options.message,
+ crt_series.refresh_patch(files = args,
+ message = options.message,
edit = options.edit,
+ show_patch = options.showpatch,
author_name = options.authname,
author_email = options.authemail,
author_date = options.authdate,
committer_name = options.commname,
- committer_email = options.commemail)
+ committer_email = options.commemail,
+ backup = True)
print 'done'
else: