unionrepo: fill in uncompressed length of revlog entry
authorYuya Nishihara <yuya@tcha.org>
Sat, 26 May 2018 11:31:51 +0900
changeset 38176 df5f6881cebd
parent 38175 fbe239064064
child 38177 7fa3408f83ef
unionrepo: fill in uncompressed length of revlog entry It can be either -1 or a valid length, but shouldn't be None. IIUC, we can simply trust the length retrieved from the revlog to be overlaid. I don't bother thinking whether the compressed length can be copied as well. We'll need to fix it later.
mercurial/unionrepo.py
--- a/mercurial/unionrepo.py	Sun Apr 29 19:48:16 2018 -0400
+++ b/mercurial/unionrepo.py	Sat May 26 11:31:51 2018 +0900
@@ -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
             flags = _start & 0xFFFF
 
             if linkmapper is None: # link is to same revlog
@@ -69,7 +69,9 @@
             p1node = self.revlog2.node(p1rev)
             p2node = self.revlog2.node(p2rev)
 
-            e = (flags, None, None, base,
+            # TODO: it's probably wrong to set compressed length to None, but
+            # I have no idea if csize is valid in the base revlog context.
+            e = (flags, None, rsize, base,
                  link, self.rev(p1node), self.rev(p2node), node)
             self.index.insert(-1, e)
             self.nodemap[node] = n