Add a --review option to stg edit, which adds a
Reviewed-by: line to the commit message, by analogy
with the existing --sign and --ack.

Signed-off-by: Peter Maydell <[email protected]>
---
I need to add a reviewed-by tag to patches I'm managing
in an stg stack pretty frequently; extending the existing
support for acked-by and signed-off-by to reviewed-by saves
a lot of manual editing.

 stgit/argparse.py | 8 ++++++--
 t/t3300-edit.sh   | 6 ++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/stgit/argparse.py b/stgit/argparse.py
index f03495e..43c6cf9 100644
--- a/stgit/argparse.py
+++ b/stgit/argparse.py
@@ -110,7 +110,7 @@ def sign_options():
     def callback(option, opt_str, value, parser, sign_str):
         if parser.values.sign_str not in [None, sign_str]:
             raise optparse.OptionValueError(
-                '--ack and --sign were both specified')
+                'Cannot give more than one of --ack, --sign, --review')
         parser.values.sign_str = sign_str
     return [
         opt('--sign', action = 'callback', dest = 'sign_str', args = [],
@@ -120,7 +120,11 @@ def sign_options():
         opt('--ack', action = 'callback', dest = 'sign_str', args = [],
             callback = callback, callback_args = ('Acked-by',),
             short = 'Add "Acked-by:" line', long = """
-            Add an "Acked-by:" line to the end of the patch.""")]
+            Add an "Acked-by:" line to the end of the patch."""),
+        opt('--review', action = 'callback', dest = 'sign_str', args = [],
+            callback = callback, callback_args = ('Reviewed-by',),
+            short = 'Add "Reviewed-by:" line', long = """
+            Add a "Reviewed-by:" line to the end of the patch.""")]
 
 def message_options(save_template):
     def no_dup(parser):
diff --git a/t/t3300-edit.sh b/t/t3300-edit.sh
index efd3368..f29fdf6 100755
--- a/t/t3300-edit.sh
+++ b/t/t3300-edit.sh
@@ -177,6 +177,12 @@ test_expect_success 'Acknowledge a patch' '
     test "$(msg HEAD^)" = "$m//Acked-by: C O Mitter <[email protected]>"
 '
 
+test_expect_success 'Review a patch' '
+    m=$(msg HEAD^) &&
+    stg edit --review p1 &&
+    test "$(msg HEAD^)" = "$m//Reviewed-by: C O Mitter <[email protected]>"
+'
+
 test_expect_success 'Set author' '
     stg edit p2 --author "Jane Austin <[email protected]>" &&
     test "$(auth HEAD)" = "Jane Austin, [email protected]"
-- 
1.9.1


_______________________________________________
stgit-users mailing list
[email protected]
https://mail.gna.org/listinfo/stgit-users

Reply via email to