diff mercurial/revlog.py @ 14141:bd1cbfe5db5c

bundler: make parsechunk return the base revision of the delta
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 30 Apr 2011 10:00:41 +0200
parents bc101902a68d
children da635d3c5620
line wrap: on
line diff
--- a/mercurial/revlog.py	Sun May 01 15:22:30 2011 +0200
+++ b/mercurial/revlog.py	Sat Apr 30 10:00:41 2011 +0200
@@ -1131,14 +1131,15 @@
             # loop through our set of deltas
             chain = None
             while 1:
-                chunkdata = bundle.parsechunk()
+                chunkdata = bundle.parsechunk(chain)
                 if not chunkdata:
                     break
                 node = chunkdata['node']
                 p1 = chunkdata['p1']
                 p2 = chunkdata['p2']
                 cs = chunkdata['cs']
-                delta = chunkdata['data']
+                deltabase = chunkdata['deltabase']
+                delta = chunkdata['delta']
 
                 link = linkmapper(cs)
                 if (node in self.nodemap and
@@ -1168,15 +1169,13 @@
                             raise LookupError(p, self.indexfile,
                                               _('unknown parent'))
 
-                if not chain:
-                    # retrieve the parent revision of the delta chain
-                    chain = p1
-                    if not chain in self.nodemap:
-                        raise LookupError(chain, self.indexfile, _('unknown base'))
+                if deltabase not in self.nodemap:
+                    raise LookupError(deltabase, self.indexfile,
+                                      _('unknown delta base'))
 
-                chainrev = self.rev(chain)
+                baserev = self.rev(deltabase)
                 chain = self._addrevision(node, None, transaction, link,
-                                          p1, p2, (chainrev, delta), ifh, dfh)
+                                          p1, p2, (baserev, delta), ifh, dfh)
                 if not dfh and not self._inline:
                     # addrevision switched from inline to conventional
                     # reopen the index