Mercurial > hg
changeset 26005:6f4a280298c1
changelog: add way to call the reachableroots C implementation
This patch is part of a series of patches to speed up the computation of
revset.reachableroots 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 reachableroots is 10-50x faster and smartlog on
is 2x-5x faster.
This patch allows us to call the new C implementation of reachableroots from
python by creating an entry point in the changelog class.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 06 Aug 2015 22:10:31 -0700 |
parents | ff89383a97db |
children | 1ffd97cbf9a2 |
files | mercurial/changelog.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu Aug 06 21:28:45 2015 -0700 +++ b/mercurial/changelog.py Thu Aug 06 22:10:31 2015 -0700 @@ -18,6 +18,7 @@ encoding, error, revlog, + revset, util, ) @@ -184,6 +185,16 @@ self.rev(self.node(0)) return self._nodecache + def reachableroots(self, minroot, heads, roots, includepath=False): + reachable = self.index.reachableroots(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: