Patchwork [1,of,6,V5] revset: make revsbetween public

mail settings
Submitter Pierre-Yves David
Date Aug. 7, 2015, 9:06 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/10152/
State Accepted
Headers show


Pierre-Yves David - Aug. 7, 2015, 9:06 p.m.
# HG changeset patch
# User Laurent Charignon <>
# 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/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -76,11 +76,11 @@  def _revdescendants(repo, revs, followfi
                         yield i
     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
     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):