From afd622604f9ec4360d50b6e32b11fc66e44d62a1 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 7 May 2020 11:23:37 -0400 Subject: Do not crash when thread is incomplete Do not try to calculate indexes on a missing patch in an incomplete thread. Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 2 +- b4/command.py | 2 ++ b4/mbox.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/b4/__init__.py b/b4/__init__.py index cc93adc..a6b683e 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -585,7 +585,7 @@ class LoreSeries: mismatches = 0 seenfiles = set() for lmsg in self.patches[1:]: - if lmsg.blob_indexes is None: + if lmsg is None or lmsg.blob_indexes is None: continue for fn, bh in lmsg.blob_indexes: if fn in seenfiles: diff --git a/b4/command.py b/b4/command.py index 39ad3e5..54b79f5 100644 --- a/b4/command.py +++ b/b4/command.py @@ -61,7 +61,9 @@ def cmd_ty(cmdargs): def cmd(): + # noinspection PyTypeChecker parser = argparse.ArgumentParser( + prog='b4', description='A tool to work with public-inbox patches', formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) diff --git a/b4/mbox.py b/b4/mbox.py index 5494cab..a859c21 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -151,7 +151,7 @@ def mbox_to_am(mboxfile, cmdargs): else: best_matches = None # sort the tags by authordate - gitargs = ['tag', '-l', '--sort=-creatordate'] + gitargs = ['tag', '-l', '--sort=-taggerdate'] lines = b4.git_get_command_lines(None, gitargs) if lines: # Check last 10 tags @@ -159,7 +159,7 @@ def mbox_to_am(mboxfile, cmdargs): logger.debug('Checking base-commit possibility for %s', tag) checked, mismatches = lser.check_applies_clean(topdir, tag) if mismatches == 0 and checked != mismatches: - base_commit = tag + cleanmsg = ' (applies clean to: %s)' % tag break # did they all mismatch? if checked == mismatches: -- cgit v1.2.3