Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
help = 'annotate the patch log entry'),
make_option('-m', '--message',
help = 'replace the patch description with MESSAGE'),
help = 'annotate the patch log entry'),
make_option('-m', '--message',
help = 'replace the patch description with MESSAGE'),
+ make_option('--save-template', metavar = 'FILE',
+ help = 'save the patch to FILE in the format used by -f'),
make_option('--author', metavar = '"NAME <EMAIL>"',
help = 'replae the author details with "NAME <EMAIL>"'),
make_option('--authname',
make_option('--author', metavar = '"NAME <EMAIL>"',
help = 'replae the author details with "NAME <EMAIL>"'),
make_option('--authname',
-def __edit_update_patch(pname, options):
- """Edit the given patch interactively.
+def __generate_file(pname, fname, options):
+ """Generate a file containing the description to edit
"""
patch = crt_series.get_patch(pname)
"""
patch = crt_series.get_patch(pname)
+ # write the file to be edited
+ f = open(fname, 'w+')
+ f.write(text)
+ f.close()
+
+def __edit_update_patch(pname, options):
+ """Edit the given patch interactively.
+ """
if options.diff:
fname = '.stgit-edit.diff'
else:
fname = '.stgit-edit.txt'
if options.diff:
fname = '.stgit-edit.diff'
else:
fname = '.stgit-edit.txt'
- # write the file to be edited
- f = open(fname, 'w+')
- f.write(text)
- f.close()
+ __generate_file(pname, fname, options)
# invoke the editor
call_editor(fname)
# invoke the editor
call_editor(fname)
log = 'edit',
notes = options.annotate)
out.done()
log = 'edit',
notes = options.annotate)
out.done()
+ elif options.save_template:
+ __generate_file(pname, options.save_template, options)
elif options.file:
__update_patch(pname, options.file, options)
else:
elif options.file:
__update_patch(pname, options.file, options)
else: