branchmap: drop `_cacheabletip` usage in `updatecache`
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 04 Jan 2013 01:25:55 +0100
changeset 18218 d5655e742457
parent 18217 46cc3b74e1c5
child 18219 c565761dde6a
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.
mercurial/branchmap.py
--- a/mercurial/branchmap.py	Fri Dec 28 03:42:21 2012 +0100
+++ b/mercurial/branchmap.py	Fri Jan 04 01:25:55 2013 +0100
@@ -68,21 +68,11 @@
         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):