[PATCH 07 of 18 V2] branchmap: drop `_cacheabletip` usage in `updatecache`
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Jan 3 19:04:10 CST 2013
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357259155 -3600
# Node ID 4e5577b9b1c9e3582e7cf362cce5d3a7d454f821
# Parent 77feb265a5323d4d77009fbc4898482067a1d1cd
branchmap: drop `_cacheabletip` usage in `updatecache`
Nobody overwrite the `_cacheabletip` any more. We always update the cache for
the whole repo and write it to disk (or at list try to). The `updatecache` code
is simplied to remove the double phase logic associated with _cacheabletip.
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -66,25 +66,15 @@ def updatecache(repo):
if partial is None or not partial.validfor(repo):
partial = read(repo)
if partial is None:
partial = branchcache()
- catip = repo._cacheabletip()
- # if partial.tiprev == catip: cache is already up to date
- # if partial.tiprev > catip: we have uncachable element in `partial` can't
- # write on disk
- if partial.tiprev < catip:
- ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, catip))
+ revs = list(cl.revs(start=partial.tiprev +1))
+ if revs:
+ ctxgen = (repo[r] for r in revs)
partial.update(repo, ctxgen)
partial.write(repo)
- # If cacheable tip were lower than actual tip, we need to update the
- # cache up to tip. This update (from cacheable to actual tip) is not
- # written to disk since it's not cacheable.
- tiprev = cl.rev(cl.tip())
- if partial.tiprev < tiprev:
- ctxgen = (repo[r] for r in cl.revs(partial.tiprev + 1, tiprev))
- partial.update(repo, ctxgen)
repo._branchcaches[repo.filtername] = partial
class branchcache(dict):
"""A dict like object that hold branches heads cache"""
More information about the Mercurial-devel
mailing list