changeset 13711:ed913fd7837b

manifest: add readfast method
author Matt Mackall <mpm@selenic.com>
date Sun, 20 Mar 2011 19:43:28 -0500
parents cb8d0bc8c021
children c4706accf310
files mercurial/manifest.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Sun Mar 20 19:43:28 2011 -0500
+++ b/mercurial/manifest.py	Sun Mar 20 19:43:28 2011 -0500
@@ -38,6 +38,13 @@
         r = self.rev(node)
         return self.parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
 
+    def readfast(self, node):
+        '''use the faster of readdelta or read'''
+        r = self.rev(node)
+        if self.deltaparent(r) in self.parentrevs(r):
+            return self.readdelta(node)
+        return self.read(node)
+
     def read(self, node):
         if node == revlog.nullid:
             return manifestdict() # don't upset local cache