[PATCH 2 of 6 V2] revset: adds includepath argument to revsbetween
Laurent Charignon
lcharignon at fb.com
Fri Aug 7 04:28:19 CDT 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1434770334 25200
# Fri Jun 19 20:18:54 2015 -0700
# Branch stable
# Node ID 812d9212f1474df436453d08b7c71a44549524a3
# Parent c5d77654f500692aae08a0f5b0026e200b0971b7
revset: adds includepath argument to revsbetween
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.
This patch adds a new argument to revsbetween called includepath. This allows us
to compute grandparent with revsbetween and remove the code of grandparent in
the next patch.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -78,7 +78,7 @@
return generatorset(iterate(), iterasc=True)
-def revsbetween(repo, roots, heads):
+def revsbetween(repo, roots, heads, includepath=True):
"""Return all paths between roots and heads, inclusive of both endpoint
sets."""
if not roots:
@@ -101,6 +101,8 @@
rev = nextvisit()
if rev in roots:
reached(rev)
+ if not includepath:
+ continue
parents = parentrevs(rev)
seen[rev] = parents
for parent in parents:
@@ -108,6 +110,8 @@
dovisit(parent)
if not reachable:
return baseset()
+ if not includepath:
+ return reachable
for rev in sorted(seen):
for parent in seen[rev]:
if parent in reachable:
More information about the Mercurial-devel
mailing list