changeset 26230:6b16a3538c20

unionrepo: take delta base in account with building unified revlog When general delta is enabled, the base is actually meaningful and should be used. With general delta is enabled, test-unionrepo.t crash without this fix.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 10 Sep 2015 16:14:39 -0700
parents d1530c6e8613
children 87c9c562c37a
files mercurial/unionrepo.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/unionrepo.py	Wed Sep 09 22:27:48 2015 -0400
+++ b/mercurial/unionrepo.py	Thu Sep 10 16:14:39 2015 -0700
@@ -49,7 +49,7 @@
         for rev2 in self.revlog2:
             rev = self.revlog2.index[rev2]
             # rev numbers - in revlog2, very different from self.rev
-            _start, _csize, _rsize, _base, linkrev, p1rev, p2rev, node = rev
+            _start, _csize, _rsize, base, linkrev, p1rev, p2rev, node = rev
 
             if linkmapper is None: # link is to same revlog
                 assert linkrev == rev2 # we never link back
@@ -57,6 +57,9 @@
             else: # rev must be mapped from repo2 cl to unified cl by linkmapper
                 link = linkmapper(linkrev)
 
+            if linkmapper is not None: # link is to same revlog
+                base = linkmapper(base)
+
             if node in self.nodemap:
                 # this happens for the common revlog revisions
                 self.bundlerevs.add(self.nodemap[node])
@@ -65,7 +68,7 @@
             p1node = self.revlog2.node(p1rev)
             p2node = self.revlog2.node(p2rev)
 
-            e = (None, None, None, None,
+            e = (None, None, None, base,
                  link, self.rev(p1node), self.rev(p2node), node)
             self.index.insert(-1, e)
             self.nodemap[node] = n