comparison mercurial/changelog.py @ 26011:ce77436162a5

changelog: trust C implementation of reachableroots more There are no remaining codepaths in reachableroots where it will return None, so just trust it completely and simplify this method. Result by revset ================ Revision: 0) Revision 1c75249e159b: style: adjust whitespaces in webutil.py 1) Revision d1d91b8090c6: changelog: trust C implementation of reachableroots more revset #0: 0::tip plain 0) 0.067684 1) 0.006622 9% revset #1: 0::@ plain 0) 0.068249 1) 0.009394 13% IOW this is a 10x speedup in my repo for hg itself for 0::tip and similar revsets now that the C code is correctly wired up.
author Augie Fackler <augie@google.com>
date Tue, 11 Aug 2015 15:06:02 -0400
parents 6f4a280298c1
children b68c9d232db6
comparison
equal deleted inserted replaced
26010:2c03e521a0c5 26011:ce77436162a5
184 # XXX need filtering too 184 # XXX need filtering too
185 self.rev(self.node(0)) 185 self.rev(self.node(0))
186 return self._nodecache 186 return self._nodecache
187 187
188 def reachableroots(self, minroot, heads, roots, includepath=False): 188 def reachableroots(self, minroot, heads, roots, includepath=False):
189 reachable = self.index.reachableroots(minroot, heads, roots, 189 return revset.baseset(sorted(
190 includepath) 190 self.index.reachableroots(minroot, heads, roots, 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 191
198 def headrevs(self): 192 def headrevs(self):
199 if self.filteredrevs: 193 if self.filteredrevs:
200 try: 194 try:
201 return self.index.headrevsfiltered(self.filteredrevs) 195 return self.index.headrevsfiltered(self.filteredrevs)