From: Catalin Marinas Date: Fri, 22 May 2009 08:53:38 +0000 (+0100) Subject: Reinstate the --annotate option for refresh X-Git-Tag: v0.15-rc1~16 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/d11f4f2ab1c7823c214eec0335e50b89b42f0d3e Reinstate the --annotate option for refresh It is sometimes useful to add some notes to the log entry when a patch was refreshed. This option was dropped when the command was updated to the new infrastructure as there was no logging support at that time. The note will be visible with 'stg log {-g,-f}' Signed-off-by: Catalin Marinas --- diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py index 5a5f979..c5a0aeb 100644 --- a/stgit/commands/refresh.py +++ b/stgit/commands/refresh.py @@ -61,6 +61,8 @@ options = [ short = 'Refresh (applied) PATCH instead of the top patch'), opt('-e', '--edit', action = 'store_true', short = 'Invoke an editor for the patch description'), + opt('-a', '--annotate', metavar = 'NOTE', + short = 'Annotate the patch log entry') ] + (argparse.message_options(save_template = False) + argparse.sign_options() + argparse.author_options()) @@ -200,9 +202,13 @@ def absorb_unapplied(trans, iw, patch_name, temp_name, edit_fun): # leave the temp patch for the user. return False -def absorb(stack, patch_name, temp_name, edit_fun): +def absorb(stack, patch_name, temp_name, edit_fun, annotate = None): """Absorb the temp patch into the target patch.""" - trans = transaction.StackTransaction(stack, 'refresh') + if annotate: + log_msg = 'refresh\n\n' + annotate + else: + log_msg = 'refresh' + trans = transaction.StackTransaction(stack, log_msg) iw = stack.repository.default_iw f = { True: absorb_applied, False: absorb_unapplied }[patch_name in trans.applied] @@ -252,4 +258,5 @@ def func(parser, options, args): diff_flags = [], replacement_diff = None) assert not failed_diff return cd - return absorb(stack, patch_name, temp_name, edit_fun) + return absorb(stack, patch_name, temp_name, edit_fun, + annotate = options.annotate)