From 07c988b2217ac42c7e29cfd321d68c45a4e4b3ef Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 16 Dec 2020 11:15:59 -0500 Subject: 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 --- b4/pr.py | 4 ++++ 1 file changed, 4 insertions(+) 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: -- cgit v1.2.3