Patchwork [2,of,9] branchmap: improve computation of target tip

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 26, 2012, 8:32 p.m.
Message ID <fbf90f3d261f274c1e69.1356553978@yamac.local>
Download mbox | patch
Permalink /patch/297/
State Superseded, archived
Commit 59ac9a551bf4aa72cc9b2e4e167f7ac03179fbaf
Headers show

Comments

Pierre-Yves David - Dec. 26, 2012, 8:32 p.m.
# 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.

Patch

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