[PATCH 5 of 6 V4] changelog: add way to call the revsbetween C implementation
Laurent Charignon
lcharignon at fb.com
Fri Aug 7 13:35:53 CDT 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1438924231 25200
# Thu Aug 06 22:10:31 2015 -0700
# Branch stable
# Node ID fc1351d02b62f64f628b363a598216e098b6fade
# Parent faed533c701ba8924ef4f3cb88dbf759bde523d8
changelog: add way to call the revsbetween C implementation
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 allows us to call the new C implementation of revsbetween from
python by creating an entry point in the changelog class.
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -7,7 +7,7 @@
from node import bin, hex, nullid
from i18n import _
-import util, error, revlog, encoding
+import util, error, revlog, encoding, revset
_defaultextra = {'branch': 'default'}
@@ -172,6 +172,15 @@
self.rev(self.node(0))
return self._nodecache
+ def revsbetween(self, minroot, heads, roots, includepath):
+ reachable = self.index.revsbetween(minroot, heads, roots, includepath)
+ if reachable is None:
+ # The C code hasn't been able to initialize a list, something went
+ # really wrong, let's rely on the pure implementation in that case
+ raise AttributeError()
+ else:
+ return revset.baseset(sorted(reachable))
+
def headrevs(self):
if self.filteredrevs:
try:
More information about the Mercurial-devel
mailing list