aboutsummaryrefslogtreecommitdiff
path: root/b4
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-12-14 13:58:42 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-12-14 13:58:42 -0500
commitb860e96fe695b73fde356da72ec70172189fbff7 (patch)
treeec8edfa132f2c5eeff41379213ea5bf63b130fd7 /b4
parent4e396d2091fe70d2217865a1836695e00b5067f2 (diff)
downloadb4-b860e96fe695b73fde356da72ec70172189fbff7.tar.gz
Allow passing extra opts to git-format-patch
We probably want to be able to tweak the output of git-format-patch based on which list we're running it for (e.g. passing --minimal or --histogram), so make it possible to pass extra parameters to the git command. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4')
-rw-r--r--b4/__init__.py4
-rw-r--r--b4/pr.py7
2 files changed, 8 insertions, 3 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 432a8cd..e936781 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2335,11 +2335,13 @@ def get_pi_thread_by_msgid(msgid, savefile, useproject=None, nocache=False):
@contextmanager
-def git_format_patches(gitdir, start, end, prefixes=None):
+def git_format_patches(gitdir, start, end, prefixes=None, extraopts=None):
with TemporaryDirectory() as tmpd:
gitargs = ['format-patch', '--cover-letter', '-o', tmpd, '--signature', f'b4 {__VERSION__}']
if prefixes is not None and len(prefixes):
gitargs += ['--subject-prefix', ' '.join(prefixes)]
+ if extraopts:
+ gitargs += extraopts
gitargs += ['%s..%s' % (start, end)]
ecode, out = git_run_command(gitdir, gitargs)
if ecode > 0:
diff --git a/b4/pr.py b/b4/pr.py
index ef390a2..e31afc1 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -239,7 +239,7 @@ def thanks_record_pr(lmsg):
logger.debug('Wrote %s for thanks tracking', filename)
-def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True):
+def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True, fpopts=None):
ecode = fetch_remote(gitdir, lmsg, check_sig=False, ty_track=False)
if ecode > 0:
sys.exit(ecode)
@@ -290,7 +290,7 @@ def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True):
# of the archived threads.
linked_ids.add(lmsg.msgid)
- with b4.git_format_patches(gitdir, lmsg.pr_base_commit, 'FETCH_HEAD', prefixes=prefixes) as pdir:
+ with b4.git_format_patches(gitdir, lmsg.pr_base_commit, 'FETCH_HEAD', prefixes=prefixes, extraopts=fpopts) as pdir:
if pdir is None:
sys.exit(1)
@@ -374,6 +374,9 @@ def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True):
seen_msgids = set()
for msgid in linked_ids:
+ # Did we already retrieve it as part of a previous tread?
+ if msgid in seen_msgids:
+ continue
savefile = mkstemp()[1]
mboxfile = b4.get_pi_thread_by_msgid(msgid, savefile)
if mboxfile is not None: