changelog: trust C implementation of reachableroots more
authorAugie Fackler <augie@google.com>
Tue, 11 Aug 2015 15:06:02 -0400
changeset 26011 ce77436162a5
parent 26010 2c03e521a0c5
child 26013 38f92d12357c
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.
mercurial/changelog.py
--- a/mercurial/changelog.py	Tue Aug 11 14:53:47 2015 -0400
+++ b/mercurial/changelog.py	Tue Aug 11 15:06:02 2015 -0400
@@ -186,14 +186,8 @@
         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))
+        return revset.baseset(sorted(
+            self.index.reachableroots(minroot, heads, roots, includepath)))
 
     def headrevs(self):
         if self.filteredrevs: