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

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 28, 2012, 12:56 a.m.
Message ID <43650a9b9e09a53169dd.1356656178@yamac.lan>
Download mbox | patch
Permalink /patch/308/
State Accepted
Commit 59ac9a551bf4aa72cc9b2e4e167f7ac03179fbaf
Headers show

Comments

Pierre-Yves David - Dec. 28, 2012, 12:56 a.m.
# 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.
Augie Fackler - Dec. 31, 2012, 11:41 p.m.
Queueing patches 2 and 3. Patch 1 appears to already have been applied.

On Dec 27, 2012, at 7:56 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:

> # 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
>

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