mercurial/revlog.py
changeset 23254 d23834b871ac
parent 22934 8a096d4d0862
child 23255 76effa770ff9
--- a/mercurial/revlog.py	Wed Nov 05 10:13:01 2014 +0000
+++ b/mercurial/revlog.py	Thu Nov 06 14:08:25 2014 -0800
@@ -350,6 +350,20 @@
             rev = base
             base = index[rev][3]
         return base
+    def chainlen(self, rev):
+        index = self.index
+        generaldelta = self._generaldelta
+        iterrev = rev
+        e = index[iterrev]
+        clen = 0
+        while iterrev != e[3]:
+            clen += 1
+            if generaldelta:
+                iterrev = e[3]
+            else:
+                iterrev -= 1
+            e = index[iterrev]
+        return clen
     def flags(self, rev):
         return self.index[rev][0] & 0xFFFF
     def rawsize(self, rev):