summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-09-29 16:11:21 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-09-29 16:11:21 -0400
commitbd64dab483f6302bbdd792c5e678c0ab51060cbe (patch)
treec2f51cf1b1319483e155fa164c955d6153133932
parent75e4e8102fd21760be2cf9bbe8301a8a33934b5a (diff)
downloadb4-bd64dab483f6302bbdd792c5e678c0ab51060cbe.tar.gz
shazam: allow configuring "git am" flags
Setting b4.git-am-flags should allow you to specify what additional flags to pass to "git am" before shazaming a bunch of patches on to the current branch. Example entry in ~/.gitconfig [b4] git-am-flags = -s Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/mbox.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index dc4cebb..5706a91 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -19,6 +19,7 @@ import shutil
import pathlib
import tempfile
import io
+import shlex
import urllib.parse
import xml.etree.ElementTree
@@ -252,8 +253,11 @@ def make_am(msgs, cmdargs, msgid):
b4.save_git_am_mbox(am_msgs, ifh)
ambytes = ifh.getvalue().encode()
if cmdargs.applyhere:
- # Blindly attempt to apply to the current tree
- ecode, out = b4.git_run_command(topdir, ['am'], stdin=ambytes, logstderr=True)
+ amflags = config.get('git-am-flags', '')
+ sp = shlex.shlex(amflags, posix=True)
+ sp.whitespace_split = True
+ amargs = list(sp)
+ ecode, out = b4.git_run_command(topdir, ['am'] + amargs, stdin=ambytes, logstderr=True)
logger.info(out.strip())
if ecode == 0:
thanks_record_am(lser, cherrypick=cherrypick)