[PATCH 1 of 6 V5] revset: make revsbetween public

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 7 21:06:50 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1438938822 25200
#      Fri Aug 07 02:13:42 2015 -0700
# Node ID a82e03945c19bd8796b68d1f36faec73642b6e9f
# Parent  580bf4bebe5c0e0b629a1bdaa0f2c4e58695ab1b
revset: make revsbetween public

This patch is part of a series of patches to speed up the computation of
revset.revsbetween by introducing a C implementation. The main motivation is to
speed up smartlog on big repositories. At the end of the series, on our big
repositories the computation of revsbetween is 10-50x faster and smartlog on is
2x-5x faster.

Later in this serie, we want to reuse the implementation of revsbetween in the
changelog module, therefore, we make it public.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -76,11 +76,11 @@ def _revdescendants(repo, revs, followfi
                         yield i
                         break
 
     return generatorset(iterate(), iterasc=True)
 
-def _revsbetween(repo, roots, heads):
+def revsbetween(repo, roots, heads):
     """Return all paths between roots and heads, inclusive of both endpoint
     sets."""
     if not roots:
         return baseset()
     parentrevs = repo.changelog.parentrevs
@@ -395,11 +395,11 @@ def rangeset(repo, subset, x, y):
     # would be more efficient.
     return r & subset
 
 def dagrange(repo, subset, x, y):
     r = fullreposet(repo)
-    xs = _revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
+    xs = revsbetween(repo, getset(repo, r, x), getset(repo, r, y))
     # XXX We should combine with subset first: 'subset & baseset(...)'. This is
     # necessary to ensure we preserve the order in subset.
     return xs & subset
 
 def andset(repo, subset, x, y):


More information about the Mercurial-devel mailing list