##// END OF EJS Templates
branchmap: split a long condition in branchcache.validfor(), add comments...
av6 -
r49568:02e9ad08 default
parent child Browse files
Show More
@@ -352,17 +352,25 b' class branchcache(object):'
352 return filename
352 return filename
353
353
354 def validfor(self, repo):
354 def validfor(self, repo):
355 """Is the cache content valid regarding a repo
355 """check that cache contents are valid for (a subset of) this repo
356
356
357 - False when cached tipnode is unknown or if we detect a strip.
357 - False when the order of changesets changed or if we detect a strip.
358 - True when cache is up to date or a subset of current repo."""
358 - True when cache is up-to-date for the current repo or its subset."""
359 try:
359 try:
360 return (self.tipnode == repo.changelog.node(self.tiprev)) and (
360 node = repo.changelog.node(self.tiprev)
361 self.filteredhash
362 == scmutil.filteredhash(repo, self.tiprev, needobsolete=True)
363 )
364 except IndexError:
361 except IndexError:
362 # changesets were stripped and now we don't even have enough to
363 # find tiprev
365 return False
364 return False
365 if self.tipnode != node:
366 # tiprev doesn't correspond to tipnode: repo was stripped, or this
367 # repo has a different order of changesets
368 return False
369 tiphash = scmutil.filteredhash(repo, self.tiprev, needobsolete=True)
370 # hashes don't match if this repo view has a different set of filtered
371 # revisions (e.g. due to phase changes) or obsolete revisions (e.g.
372 # history was rewritten)
373 return self.filteredhash == tiphash
366
374
367 def _branchtip(self, heads):
375 def _branchtip(self, heads):
368 """Return tuple with last open head in heads and false,
376 """Return tuple with last open head in heads and false,
General Comments 0
You need to be logged in to leave comments. Login now