mercurial/changelog.py
changeset 22484 2b5940f64750
parent 21544 667df8f478d1
child 23014 f00813325c5a
--- a/mercurial/changelog.py	Tue Sep 16 23:47:34 2014 -0700
+++ b/mercurial/changelog.py	Tue Sep 16 16:03:21 2014 -0700
@@ -171,8 +171,13 @@
 
     def headrevs(self):
         if self.filteredrevs:
-            # XXX we should fix and use the C version
-            return self._headrevs()
+            try:
+                return self.index.headrevs(self.filteredrevs)
+            # AttributeError covers non-c-extension environments.
+            # TypeError allows us work with old c extensions.
+            except (AttributeError, TypeError):
+                return self._headrevs()
+
         return super(changelog, self).headrevs()
 
     def strip(self, *args, **kwargs):