[PATCH] Move function 'patchtext' from mdiff.py to manifest.py because it is only used in manifest

Andrey Somov py4fun at gmail.com
Wed Oct 12 01:30:02 CDT 2011


# HG changeset patch
# User Andrey Somov <py4fun at gmail.com>
# Date 1318457467 -7200
# Node ID f6a12299c73aadc9142ed10cff78caa6f054fd2b
# Parent  dac2edce4e4a7eb63ff2c1bb6ab2289c0bcec9e5
Move function 'patchtext' from mdiff.py to manifest.py because it is only used in manifest

diff -r dac2edce4e4a -r f6a12299c73a mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Oct 12 18:59:59 2011 -0500
+++ b/mercurial/manifest.py	Thu Oct 13 00:11:07 2011 +0200
@@ -33,10 +33,20 @@
         mfdict = manifestdict()
         parsers.parse_manifest(mfdict, mfdict._flags, lines)
         return mfdict
+    
+    def _patchtext(self, bin):
+        pos = 0
+        t = []
+        while pos < len(bin):
+            p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
+            pos += 12
+            t.append(bin[pos:pos + l])
+            pos += l
+        return "".join(t)
 
     def readdelta(self, node):
         r = self.rev(node)
-        return self.parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
+        return self.parse(self._patchtext(self.revdiff(self.deltaparent(r), r)))
 
     def readfast(self, node):
         '''use the faster of readdelta or read'''
diff -r dac2edce4e4a -r f6a12299c73a mercurial/mdiff.py
--- a/mercurial/mdiff.py	Wed Oct 12 18:59:59 2011 -0500
+++ b/mercurial/mdiff.py	Thu Oct 13 00:11:07 2011 +0200
@@ -253,16 +253,6 @@
         for x in yieldhunk(hunk):
             yield x
 
-def patchtext(bin):
-    pos = 0
-    t = []
-    while pos < len(bin):
-        p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
-        pos += 12
-        t.append(bin[pos:pos + l])
-        pos += l
-    return "".join(t)
-
 def patch(a, bin):
     if len(a) == 0:
         # skip over trivial delta header


More information about the Mercurial-devel mailing list