[PATCH 2 of 4] cmdutil: store a local ref to repo.hiddenrevs in getgraphlogrevs

Siddharth Agarwal sid0 at fb.com
Fri Dec 28 18:56:38 CST 2012


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1356740676 28800
# Node ID d518e5bb7e24789992eacb6a07c6eb74308413da
# Parent  794951c412ac05bad45cf6aa3f91b64f20f8b539
cmdutil: store a local ref to repo.hiddenrevs in getgraphlogrevs

On a repository with over 400,000 changesets, this speeds graphlog up by
around 0.03 seconds (~20% with a small limit).

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1453,7 +1453,8 @@ def getgraphlogrevs(repo, pats, opts):
     if not opts.get('hidden'):
         # --hidden is still experimental and not worth a dedicated revset
         # yet. Fortunately, filtering revision number is fast.
-        revs = (r for r in revs if r not in repo.hiddenrevs)
+        hiddenrevs = repo.hiddenrevs
+        revs = (r for r in revs if r not in hiddenrevs)
     else:
         revs = iter(revs)
     return revs, expr, filematcher


More information about the Mercurial-devel mailing list