Patchwork unionrepo: take delta base in account with building unified revlog

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 10, 2015, 11:18 p.m.
Message ID <f8147a4bf085ebde75cd.1441927124@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10473/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 10, 2015, 11:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1441926879 25200
#      Thu Sep 10 16:14:39 2015 -0700
# Node ID f8147a4bf085ebde75cd4bd2fb2e07cd6ae02a84
# Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
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.
Matt Mackall - Sept. 13, 2015, 12:43 a.m.
On Thu, 2015-09-10 at 16:18 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1441926879 25200
> #      Thu Sep 10 16:14:39 2015 -0700
> # Node ID f8147a4bf085ebde75cd4bd2fb2e07cd6ae02a84
> # Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
> unionrepo: take delta base in account with building unified revlog

Queued for default, thanks.

Patch

diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -47,27 +47,30 @@  class unionrevlog(revlog.revlog):
         self.repotiprev = n - 1
         self.bundlerevs = set() # used by 'bundle()' revset expression
         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
                 link = n
             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])
                 continue
 
             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
             self.bundlerevs.add(n)
             n += 1