mercurial/manifest.py
branchstable
changeset 14687 15200b46165b
parent 14632 4819241ec1ad
child 15657 d976b1ef6760
--- a/mercurial/manifest.py	Wed Jun 01 16:32:48 2011 -0500
+++ b/mercurial/manifest.py	Sat Jun 18 17:03:01 2011 -0500
@@ -38,6 +38,14 @@
         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)
+        deltaparent = self.deltaparent(r)
+        if deltaparent != revlog.nullrev and deltaparent 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
@@ -134,7 +142,7 @@
             # if this is changed to support newlines in filenames,
             # be sure to check the templates/ dir again (especially *-raw.tmpl)
             hex, flags = revlog.hex, map.flags
-            text = ''.join("%s\000%s%s\n" % (f, hex(map[f]), flags(f))
+            text = ''.join("%s\0%s%s\n" % (f, hex(map[f]), flags(f))
                            for f in files)
             arraytext = array.array('c', text)
             cachedelta = None
@@ -164,7 +172,7 @@
                 # bs will either be the index of the item or the insert point
                 start, end = self._search(addbuf, f, start)
                 if not todelete:
-                    l = "%s\000%s%s\n" % (f, revlog.hex(map[f]), map.flags(f))
+                    l = "%s\0%s%s\n" % (f, revlog.hex(map[f]), map.flags(f))
                 else:
                     if start == end:
                         # item we want to delete was not found, error out