summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-05-25 15:48:06 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-05-25 15:48:06 -0400
commit12a69d7c5018c0dc0188e8f79933f2f7cb257c57 (patch)
tree5a24176dc64834cef0d56fb668dd3fe9ab578ccb
parent59be08453137a3b9c6a25dc6787b5066a88a84cd (diff)
downloadb4-12a69d7c5018c0dc0188e8f79933f2f7cb257c57.tar.gz
Backfill series before diffing them
Make sure we a) attempt to backfill the series if they are incomplete, b) error out if the series is incomplete anyway Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py3
-rw-r--r--b4/diff.py15
2 files changed, 14 insertions, 4 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 3cdad1c..ab8f034 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -680,6 +680,9 @@ class LoreSeries:
# Logic largely borrowed from gj_tools
seenfiles = set()
for lmsg in self.patches[1:]:
+ if lmsg is None:
+ logger.critical('ERROR: v%s series incomplete; unable to create a fake-am range', self.revision)
+ return None, None
logger.debug('Looking at %s', lmsg.full_subject)
lmsg.load_hashes()
if not len(lmsg.blob_indexes):
diff --git a/b4/diff.py b/b4/diff.py
index ab23b0c..33a8b0c 100644
--- a/b4/diff.py
+++ b/b4/diff.py
@@ -30,11 +30,12 @@ def diff_same_thread_series(cmdargs):
savefile = mkstemp('b4-diff-to')[1]
# Do we have a cache of this lookup?
cachedir = b4.get_cache_dir()
+ cachebase = urllib.parse.quote_plus(msgid)
if wantvers:
- cachefile = os.path.join(cachedir, '%s-%s.diff.mbx' % (urllib.parse.quote_plus(msgid),
- '-'.join([str(x) for x in wantvers])))
- else:
- cachefile = os.path.join(cachedir, '%s-latest.diff.mbx' % urllib.parse.quote_plus(msgid))
+ cachebase += '-' + '-'.join([str(x) for x in wantvers])
+ if cmdargs.useproject:
+ cachebase += '-' + cmdargs.useproject
+ cachefile = os.path.join(cachedir, '%s.diff.mbx' % cachebase)
if os.path.exists(cachefile) and not cmdargs.nocache:
logger.info('Using cached copy of the lookup')
shutil.copyfile(cachefile, savefile)
@@ -79,6 +80,12 @@ def diff_same_thread_series(cmdargs):
if lower not in lmbx.series:
return None, None
+ if not lmbx.series[lower].complete:
+ lmbx.backfill(lower)
+
+ if not lmbx.series[upper].complete:
+ lmbx.backfill(upper)
+
return lmbx.series[lower], lmbx.series[upper]