aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-12-16 11:15:59 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-12-16 11:15:59 -0500
commit07c988b2217ac42c7e29cfd321d68c45a4e4b3ef (patch)
tree5d417edd430851fbeb9f04762960fc0def5fb482
parent40386e66ce0effbb0d35127b222961c19dee12a1 (diff)
downloadb4-07c988b2217ac42c7e29cfd321d68c45a4e4b3ef.tar.gz
Recognize merged PRs when attempting auto-base
When we come across a pull request that doesn't list its base (i.e. not generated using git-request-pull), we try to figure out the base ourselves by doing merge-base. However, if the pull request is already merged, then that is going to be a useless operation, so recognize this situation and bail out early. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/pr.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/b4/pr.py b/b4/pr.py
index 095d782..0ff68f8 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -255,6 +255,9 @@ def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True, fpopts=None):
logger.critical(out)
raise RuntimeError('Could not find common ancestry')
lmsg.pr_base_commit = out.strip()
+ if lmsg.pr_base_commit == lmsg.pr_tip_commit:
+ logger.critical('Cannot auto-discover merge-base on a merged pull request.')
+ raise RuntimeError('Cannot find merge-base on a merged pull request')
logger.info('Generating patches starting from the base-commit')
@@ -461,6 +464,7 @@ def main(cmdargs):
try:
msgs = explode(tc, lmsg, mailfrom=cmdargs.mailfrom, retrieve_links=cmdargs.getlinks)
except RuntimeError:
+ logger.critical('Nothing exploded.')
sys.exit(1)
if msgs: