diff mercurial/revlog.py @ 16786:2631cd5dd244

revlog: switch to a C version of headrevs The C implementation is more than 100 times faster than the Python version (which is still available as a fallback). In a repo with 330,000 revs and a stale .hg/cache/tags file, this patch improves the performance of "hg tip" from 2.2 to 1.6 seconds.
author Bryan O'Sullivan <bryano@fb.com>
date Sat, 19 May 2012 19:44:58 -0700
parents 93f8b9565257
children 107a3270a24a
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat May 19 19:44:23 2012 -0700
+++ b/mercurial/revlog.py	Sat May 19 19:44:58 2012 -0700
@@ -635,6 +635,10 @@
         return (orderedout, roots, heads)
 
     def headrevs(self):
+        try:
+            return self.index.headrevs()
+        except AttributeError:
+            pass
         count = len(self)
         if not count:
             return [nullrev]