diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-22 17:55:05 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-05-22 17:55:05 -0400 |
commit | a73711ad65e0f5d9ad155713fea2e609cd7fc188 (patch) | |
tree | b4262a156dc28474b298a9b8bd8e547038d59228 /b4/mbox.py | |
parent | 6ab6ed4dacb2c238ab35087cae9dd8c72feb2304 (diff) | |
download | b4-a73711ad65e0f5d9ad155713fea2e609cd7fc188.tar.gz |
Add ability to diff arbitrary mbox files
Sometimes we are unable to properly look up previous series -- usually
because the cover letter title changes. For those cases, it is now
possible to diff two arbitrary mbox files prepared with "b4 am -T".
There's also a smattering of other fixes in there because I'm too
lazy to properly stage my patches.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/mbox.py')
-rw-r--r-- | b4/mbox.py | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -173,7 +173,7 @@ def mbox_to_am(mboxfile, cmdargs): checked, mismatches = lser.check_applies_clean(topdir) if mismatches == 0 and checked != mismatches: cleanmsg = ' (applies clean to current tree)' - else: + elif cmdargs.guessbase: # Look at the last 10 tags and see if it applies cleanly to # any of them. I'm not sure how useful this is, but I'm going # to put it in for now and maybe remove later if it causes @@ -324,18 +324,18 @@ def get_extra_series(mboxfile, direction=1, wantvers=None, nocache=False): # Ignore replies or counters above 1 if lsub.reply or lsub.counter > 1: continue - if latest_revision is None or lsub.revision > latest_revision: - # New revision + if base_msg is not None: + logger.debug('Current base_msg: %s', base_msg['Subject']) + logger.debug('Checking the subject on %s', lsub.full_subject) + if latest_revision is None or lsub.revision >= latest_revision: latest_revision = lsub.revision - if lsub.counter == 0: + if lsub.counter == 0 and not lsub.counters_inferred: # And a cover letter, nice. This is the easy case base_msg = msg seen_covers.append(latest_revision) - continue - if lsub.counter == 1: - if latest_revision not in seen_covers: - # A patch/series without a cover letter - base_msg = msg + elif lsub.counter == 1 and latest_revision not in seen_covers: + # A patch/series without a cover letter + base_msg = msg # Get subject info from base_msg again lsub = b4.LoreSubject(base_msg['Subject']) @@ -371,7 +371,7 @@ def get_extra_series(mboxfile, direction=1, wantvers=None, nocache=False): try: tree = xml.etree.ElementTree.fromstring(resp.content) except xml.etree.ElementTree.ParseError as ex: - logger.debug('Unable to parse results, ignoring', ex) + logger.debug('Unable to parse results, ignoring: %s', ex) resp.close() mbx.close() return |