Show More
@@ -245,7 +245,8 b' class cg1unpacker(object):' | |||
|
245 | 245 | # no new manifest will be created and the manifest group will |
|
246 | 246 | # be empty during the pull |
|
247 | 247 | self.manifestheader() |
|
248 | repo.manifestlog._revlog.addgroup(self, revmap, trp) | |
|
248 | deltas = self.deltaiter(revmap) | |
|
249 | repo.manifestlog._revlog.addgroup(deltas, trp) | |
|
249 | 250 | repo.ui.progress(_('manifests'), None) |
|
250 | 251 | self.callback = None |
|
251 | 252 | |
@@ -307,7 +308,8 b' class cg1unpacker(object):' | |||
|
307 | 308 | efiles.update(cl.readfiles(node)) |
|
308 | 309 | |
|
309 | 310 | self.changelogheader() |
|
310 | cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog) | |
|
311 | deltas = self.deltaiter(csmap) | |
|
312 | cgnodes = cl.addgroup(deltas, trp, addrevisioncb=onchangelog) | |
|
311 | 313 | efiles = len(efiles) |
|
312 | 314 | |
|
313 | 315 | if not cgnodes: |
@@ -428,6 +430,27 b' class cg1unpacker(object):' | |||
|
428 | 430 | ret = deltaheads + 1 |
|
429 | 431 | return ret |
|
430 | 432 | |
|
433 | def deltaiter(self, linkmapper): | |
|
434 | """ | |
|
435 | returns an iterator of the deltas in this changegroup | |
|
436 | ||
|
437 | Useful for passing to the underlying storage system to be stored. | |
|
438 | """ | |
|
439 | chain = None | |
|
440 | for chunkdata in iter(lambda: self.deltachunk(chain), {}): | |
|
441 | node = chunkdata['node'] | |
|
442 | p1 = chunkdata['p1'] | |
|
443 | p2 = chunkdata['p2'] | |
|
444 | cs = chunkdata['cs'] | |
|
445 | deltabase = chunkdata['deltabase'] | |
|
446 | delta = chunkdata['delta'] | |
|
447 | flags = chunkdata['flags'] | |
|
448 | ||
|
449 | link = linkmapper(cs) | |
|
450 | chain = node | |
|
451 | ||
|
452 | yield (node, p1, p2, link, deltabase, delta, flags) | |
|
453 | ||
|
431 | 454 | class cg2unpacker(cg1unpacker): |
|
432 | 455 | """Unpacker for cg2 streams. |
|
433 | 456 | |
@@ -468,7 +491,8 b' class cg3unpacker(cg2unpacker):' | |||
|
468 | 491 | d = chunkdata["filename"] |
|
469 | 492 | repo.ui.debug("adding %s revisions\n" % d) |
|
470 | 493 | dirlog = repo.manifestlog._revlog.dirlog(d) |
|
471 | if not dirlog.addgroup(self, revmap, trp): | |
|
494 | deltas = self.deltaiter(revmap) | |
|
495 | if not dirlog.addgroup(deltas, trp): | |
|
472 | 496 | raise error.Abort(_("received dir revlog group is empty")) |
|
473 | 497 | |
|
474 | 498 | class headerlessfixup(object): |
@@ -949,7 +973,8 b' def _addchangegroupfiles(repo, source, r' | |||
|
949 | 973 | fl = repo.file(f) |
|
950 | 974 | o = len(fl) |
|
951 | 975 | try: |
|
952 | if not fl.addgroup(source, revmap, trp): | |
|
976 | deltas = source.deltaiter(revmap) | |
|
977 | if not fl.addgroup(deltas, trp): | |
|
953 | 978 | raise error.Abort(_("received file revlog group is empty")) |
|
954 | 979 | except error.CensoredBaseError as e: |
|
955 | 980 | raise error.Abort(_("received delta base is censored: %s") % e) |
@@ -1872,7 +1872,7 b' class revlog(object):' | |||
|
1872 | 1872 | ifh.write(data[1]) |
|
1873 | 1873 | self.checkinlinesize(transaction, ifh) |
|
1874 | 1874 | |
|
1875 |
def addgroup(self, |
|
|
1875 | def addgroup(self, deltas, transaction, addrevisioncb=None): | |
|
1876 | 1876 | """ |
|
1877 | 1877 | add a delta group |
|
1878 | 1878 | |
@@ -1905,20 +1905,12 b' class revlog(object):' | |||
|
1905 | 1905 | ifh.flush() |
|
1906 | 1906 | try: |
|
1907 | 1907 | # loop through our set of deltas |
|
1908 |
|
|
|
1909 | for chunkdata in iter(lambda: cg.deltachunk(chain), {}): | |
|
1910 | node = chunkdata['node'] | |
|
1911 | p1 = chunkdata['p1'] | |
|
1912 | p2 = chunkdata['p2'] | |
|
1913 | cs = chunkdata['cs'] | |
|
1914 | deltabase = chunkdata['deltabase'] | |
|
1915 | delta = chunkdata['delta'] | |
|
1916 | flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS | |
|
1908 | for data in deltas: | |
|
1909 | node, p1, p2, link, deltabase, delta, flags = data | |
|
1910 | flags = flags or REVIDX_DEFAULT_FLAGS | |
|
1917 | 1911 | |
|
1918 | 1912 | nodes.append(node) |
|
1919 | chain = node | |
|
1920 | 1913 | |
|
1921 | link = linkmapper(cs) | |
|
1922 | 1914 | if node in self.nodemap: |
|
1923 | 1915 | # this can happen if two branches make the same change |
|
1924 | 1916 | continue |
@@ -119,11 +119,28 b" def addgroupcopy(rlog, tr, destname=b'_d" | |||
|
119 | 119 | 'deltabase': rlog.node(deltaparent), |
|
120 | 120 | 'delta': rlog.revdiff(deltaparent, r)} |
|
121 | 121 | |
|
122 | def deltaiter(self, linkmapper): | |
|
123 | chain = None | |
|
124 | for chunkdata in iter(lambda: self.deltachunk(chain), {}): | |
|
125 | node = chunkdata['node'] | |
|
126 | p1 = chunkdata['p1'] | |
|
127 | p2 = chunkdata['p2'] | |
|
128 | cs = chunkdata['cs'] | |
|
129 | deltabase = chunkdata['deltabase'] | |
|
130 | delta = chunkdata['delta'] | |
|
131 | flags = chunkdata['flags'] | |
|
132 | ||
|
133 | link = linkmapper(cs) | |
|
134 | chain = node | |
|
135 | ||
|
136 | yield (node, p1, p2, link, deltabase, delta, flags) | |
|
137 | ||
|
122 | 138 | def linkmap(lnode): |
|
123 | 139 | return rlog.rev(lnode) |
|
124 | 140 | |
|
125 | 141 | dlog = newrevlog(destname, recreate=True) |
|
126 |
d |
|
|
142 | dummydeltas = dummychangegroup().deltaiter(linkmap) | |
|
143 | dlog.addgroup(dummydeltas, tr) | |
|
127 | 144 | return dlog |
|
128 | 145 | |
|
129 | 146 | def lowlevelcopy(rlog, tr, destname=b'_destrevlog.i'): |
General Comments 0
You need to be logged in to leave comments.
Login now