From 48bdd2a2de11bfac3ac25fcb9930dbbf44fcddef Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 22 Jun 2021 10:10:16 -0400 Subject: Additional --guess-base refinements Use --all by default, instead of limiting ourselves just to the current HEAD. This is actually a faster operation, because we don't have to pre-filter results. Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'b4/mbox.py') diff --git a/b4/mbox.py b/b4/mbox.py index 98bd920..7adfecd 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -230,23 +230,26 @@ def make_am(msgs, cmdargs, msgid): logger.critical(' Base: %s', base_commit) else: if topdir is not None: + guessed = False checked, mismatches = lser.check_applies_clean(topdir, at=cmdargs.guessbranch) if len(mismatches) == 0 and checked != mismatches: + guessed = True logger.critical(' Base: current tree') - elif len(mismatches) and cmdargs.guessbase: + if not guessed and cmdargs.guessbase: logger.critical(' attempting to guess base-commit...') try: - base_commit, mismatches = lser.find_base(topdir, branches=cmdargs.guessbranch, - maxdays=cmdargs.guessdays) + base_commit, nblobs, mismatches = lser.find_base(topdir, branches=cmdargs.guessbranch, + maxdays=cmdargs.guessdays) if mismatches == 0: logger.critical(' Base: %s (exact match)', base_commit) + elif nblobs == mismatches: + logger.critical(' Base: failed to guess base') else: - logger.critical(' Base: %s (best guess, %s blobs not matched)', base_commit, - mismatches) + logger.critical(' Base: %s (best guess, %s/%s blobs matched)', base_commit, + nblobs-mismatches, nblobs) except IndexError: - logger.critical(' Base: not specified') - pass - else: + logger.critical(' Base: failed to guess base') + elif not cmdargs.guessbase: logger.critical(' Base: not specified') else: logger.critical(' Base: not specified') -- cgit v1.2.3