Mercurial > public > mercurial-scm > hg
comparison mercurial/changelog.py @ 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 | 85f442747153 |
children | ce77436162a5 |
comparison
equal
deleted
inserted
replaced
26004:ff89383a97db | 26005:6f4a280298c1 |
---|---|
16 | 16 |
17 from . import ( | 17 from . import ( |
18 encoding, | 18 encoding, |
19 error, | 19 error, |
20 revlog, | 20 revlog, |
21 revset, | |
21 util, | 22 util, |
22 ) | 23 ) |
23 | 24 |
24 _defaultextra = {'branch': 'default'} | 25 _defaultextra = {'branch': 'default'} |
25 | 26 |
182 def nodemap(self): | 183 def nodemap(self): |
183 # XXX need filtering too | 184 # XXX need filtering too |
184 self.rev(self.node(0)) | 185 self.rev(self.node(0)) |
185 return self._nodecache | 186 return self._nodecache |
186 | 187 |
188 def reachableroots(self, minroot, heads, roots, includepath=False): | |
189 reachable = self.index.reachableroots(minroot, heads, roots, | |
190 includepath) | |
191 if reachable is None: | |
192 # The C code hasn't been able to initialize a list, something went | |
193 # really wrong, let's rely on the pure implementation in that case | |
194 raise AttributeError() | |
195 else: | |
196 return revset.baseset(sorted(reachable)) | |
197 | |
187 def headrevs(self): | 198 def headrevs(self): |
188 if self.filteredrevs: | 199 if self.filteredrevs: |
189 try: | 200 try: |
190 return self.index.headrevsfiltered(self.filteredrevs) | 201 return self.index.headrevsfiltered(self.filteredrevs) |
191 # AttributeError covers non-c-extension environments and | 202 # AttributeError covers non-c-extension environments and |