[StGit PATCH 7/9] Reinstate the --annotate option for refresh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <catalin.marinas@xxxxxxxxx>
---
 stgit/commands/refresh.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

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)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]