Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 34291:1db9abf407c5
revlog: add revmap back to revlog.addgroup
The recent c8b6ed51386b patch removed the linkmapper argument from addgroup, as
part of trying to make addgroup more agnostic from the changegroup format. It
turns out that the changegroup can't resolve linkrevs while iterating over the
deltas, because applying the deltas might affect the linkrev resolution. For
example, when applying a series of changelog entries, the linkmapper just
returns len(cl). If we're iterating over the deltas without applying them to the
changelog, this results in incorrect linkrevs. This was caught by the hgsql
extension, which reads the revisions before applying them.
The fix is to return linknodes as part of the delta iterator, and let the
consumer choose what to do.
Differential Revision: https://phab.mercurial-scm.org/D730
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 20 Sep 2017 09:22:22 -0700 |
parents | 448725a2ef73 |
children | 3c9691728237 |
comparison
equal
deleted
inserted
replaced
34290:4f969b9e0cf5 | 34291:1db9abf407c5 |
---|---|
1908 ifh.write(entry) | 1908 ifh.write(entry) |
1909 ifh.write(data[0]) | 1909 ifh.write(data[0]) |
1910 ifh.write(data[1]) | 1910 ifh.write(data[1]) |
1911 self.checkinlinesize(transaction, ifh) | 1911 self.checkinlinesize(transaction, ifh) |
1912 | 1912 |
1913 def addgroup(self, deltas, transaction, addrevisioncb=None): | 1913 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None): |
1914 """ | 1914 """ |
1915 add a delta group | 1915 add a delta group |
1916 | 1916 |
1917 given a set of deltas, add them to the revision log. the | 1917 given a set of deltas, add them to the revision log. the |
1918 first delta is against its parent, which should be in our | 1918 first delta is against its parent, which should be in our |
1942 dfh.flush() | 1942 dfh.flush() |
1943 ifh.flush() | 1943 ifh.flush() |
1944 try: | 1944 try: |
1945 # loop through our set of deltas | 1945 # loop through our set of deltas |
1946 for data in deltas: | 1946 for data in deltas: |
1947 node, p1, p2, link, deltabase, delta, flags = data | 1947 node, p1, p2, linknode, deltabase, delta, flags = data |
1948 link = linkmapper(linknode) | |
1948 flags = flags or REVIDX_DEFAULT_FLAGS | 1949 flags = flags or REVIDX_DEFAULT_FLAGS |
1949 | 1950 |
1950 nodes.append(node) | 1951 nodes.append(node) |
1951 | 1952 |
1952 if node in self.nodemap: | 1953 if node in self.nodemap: |