[PATCH 2 of 9] branchmap: improve computation of target tip

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Dec 26 20:32:58 UTC 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1356314243 -3600
# Node ID fbf90f3d261f274c1e690026c1a95fd787d3facc
# Parent  2745467aa74ecaeb7c4c244c65a8e05fb2fc10a9
branchmap: improve computation of target tip

With revision filtering the effective revision number of "tip" may be lower than:

    len(changelog) - 1

We now use a more correct version preventing useless writing on disk in some
case.

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -58,11 +58,11 @@ def updatecache(repo):
         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 = len(repo) - 1
+    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._branchcache = partial
 



More information about the Mercurial-devel mailing list