diff mercurial/bundlerepo.py @ 14144:3c3c53d8343a

unbundler: separate delta and header parsing Add header parsing for changelog and manifest (currently no headers might change for next-gen bundle).
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 30 Apr 2011 19:01:24 +0200
parents cb91ea6af733
children d8ba6fb2ce15
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Sat Apr 30 11:03:28 2011 +0200
+++ b/mercurial/bundlerepo.py	Sat Apr 30 19:01:24 2011 +0200
@@ -34,7 +34,7 @@
         n = len(self)
         chain = None
         while 1:
-            chunkdata = bundle.parsechunk(chain)
+            chunkdata = bundle.deltachunk(chain)
             if not chunkdata:
                 break
             node = chunkdata['node']
@@ -197,6 +197,8 @@
 
     @util.propertycache
     def changelog(self):
+        # consume the header if it exists
+        self.bundle.changelogheader()
         c = bundlechangelog(self.sopener, self.bundle)
         self.manstart = self.bundle.tell()
         return c
@@ -204,6 +206,8 @@
     @util.propertycache
     def manifest(self):
         self.bundle.seek(self.manstart)
+        # consume the header if it exists
+        self.bundle.manifestheader()
         m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
         self.filestart = self.bundle.tell()
         return m
@@ -225,12 +229,13 @@
         if not self.bundlefilespos:
             self.bundle.seek(self.filestart)
             while 1:
-                chunk = self.bundle.chunk()
-                if not chunk:
+                chunkdata = self.bundle.filelogheader()
+                if not chunkdata:
                     break
-                self.bundlefilespos[chunk] = self.bundle.tell()
+                fname = chunkdata['filename']
+                self.bundlefilespos[fname] = self.bundle.tell()
                 while 1:
-                    c = self.bundle.chunk()
+                    c = self.bundle.deltachunk(None)
                     if not c:
                         break