[PATCH 03 of 10 V2] branchmap: improve computation of target tip

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Dec 27 18:56:18 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1356314243 -3600
# Node ID 43650a9b9e09a53169ddd7e1535b816e470b3e5b
# Parent  6beb15cc7bca594bd301779954f1fdce593c45ab
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