Patchwork [2,of,2] obsolete: prefetch the repo.obsstore used in phasedivergence loop

login
register
mail settings
Submitter Boris Feld
Date Nov. 2, 2018, 8:58 a.m.
Message ID <2ba5875c72c1f3475a46.1541149084@localhost.localdomain>
Download mbox | patch
Permalink /patch/36322/
State Accepted
Headers show

Comments

Boris Feld - Nov. 2, 2018, 8:58 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1539904028 -7200
#      Fri Oct 19 01:07:08 2018 +0200
# Node ID 2ba5875c72c1f3475a465c2aa7a6463ab4a31704
# Parent  a2497966bf47a02572bbad448458d5a4b94fe77e
# EXP-Topic bettertroubles
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2ba5875c72c1
obsolete: prefetch the repo.obsstore used in phasedivergence loop

The speedup is probably quite negligible, but it cannot hurt.
Augie Fackler - Nov. 2, 2018, 6:55 p.m.
On Fri, Nov 02, 2018 at 09:58:04AM +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1539904028 -7200
> #      Fri Oct 19 01:07:08 2018 +0200
> # Node ID 2ba5875c72c1f3475a465c2aa7a6463ab4a31704
> # Parent  a2497966bf47a02572bbad448458d5a4b94fe77e
> # EXP-Topic bettertroubles
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 2ba5875c72c1
> obsolete: prefetch the repo.obsstore used in phasedivergence loop

queued, thanks

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -916,11 +916,12 @@  def _computephasedivergentset(repo):
     cl = repo.changelog
     torev = cl.nodemap.get
     tonode = cl.node
+    obsstore = repo.obsstore
     for rev in repo.revs('(not public()) and (not obsolete())'):
         # We only evaluate mutable, non-obsolete revision
         node = tonode(rev)
         # (future) A cache of predecessors may worth if split is very common
-        for pnode in obsutil.allpredecessors(repo.obsstore, [node],
+        for pnode in obsutil.allpredecessors(obsstore, [node],
                                    ignoreflags=bumpedfix):
             prev = torev(pnode) # unfiltered! but so is phasecache
             if (prev is not None) and (phase(repo, prev) <= public):