##// END OF EJS Templates
revlog: add revmap back to revlog.addgroup...
Durham Goode -
r34292:1db9abf4 default
parent child Browse files
Show More
@@ -245,8 +245,8 b' class cg1unpacker(object):'
245 # no new manifest will be created and the manifest group will
245 # no new manifest will be created and the manifest group will
246 # be empty during the pull
246 # be empty during the pull
247 self.manifestheader()
247 self.manifestheader()
248 deltas = self.deltaiter(revmap)
248 deltas = self.deltaiter()
249 repo.manifestlog._revlog.addgroup(deltas, trp)
249 repo.manifestlog._revlog.addgroup(deltas, revmap, trp)
250 repo.ui.progress(_('manifests'), None)
250 repo.ui.progress(_('manifests'), None)
251 self.callback = None
251 self.callback = None
252
252
@@ -308,8 +308,8 b' class cg1unpacker(object):'
308 efiles.update(cl.readfiles(node))
308 efiles.update(cl.readfiles(node))
309
309
310 self.changelogheader()
310 self.changelogheader()
311 deltas = self.deltaiter(csmap)
311 deltas = self.deltaiter()
312 cgnodes = cl.addgroup(deltas, trp, addrevisioncb=onchangelog)
312 cgnodes = cl.addgroup(deltas, csmap, trp, addrevisioncb=onchangelog)
313 efiles = len(efiles)
313 efiles = len(efiles)
314
314
315 if not cgnodes:
315 if not cgnodes:
@@ -430,7 +430,7 b' class cg1unpacker(object):'
430 ret = deltaheads + 1
430 ret = deltaheads + 1
431 return ret
431 return ret
432
432
433 def deltaiter(self, linkmapper):
433 def deltaiter(self):
434 """
434 """
435 returns an iterator of the deltas in this changegroup
435 returns an iterator of the deltas in this changegroup
436
436
@@ -446,10 +446,9 b' class cg1unpacker(object):'
446 delta = chunkdata['delta']
446 delta = chunkdata['delta']
447 flags = chunkdata['flags']
447 flags = chunkdata['flags']
448
448
449 link = linkmapper(cs)
450 chain = node
449 chain = node
451
450
452 yield (node, p1, p2, link, deltabase, delta, flags)
451 yield (node, p1, p2, cs, deltabase, delta, flags)
453
452
454 class cg2unpacker(cg1unpacker):
453 class cg2unpacker(cg1unpacker):
455 """Unpacker for cg2 streams.
454 """Unpacker for cg2 streams.
@@ -491,8 +490,8 b' class cg3unpacker(cg2unpacker):'
491 d = chunkdata["filename"]
490 d = chunkdata["filename"]
492 repo.ui.debug("adding %s revisions\n" % d)
491 repo.ui.debug("adding %s revisions\n" % d)
493 dirlog = repo.manifestlog._revlog.dirlog(d)
492 dirlog = repo.manifestlog._revlog.dirlog(d)
494 deltas = self.deltaiter(revmap)
493 deltas = self.deltaiter()
495 if not dirlog.addgroup(deltas, trp):
494 if not dirlog.addgroup(deltas, revmap, trp):
496 raise error.Abort(_("received dir revlog group is empty"))
495 raise error.Abort(_("received dir revlog group is empty"))
497
496
498 class headerlessfixup(object):
497 class headerlessfixup(object):
@@ -983,8 +982,8 b' def _addchangegroupfiles(repo, source, r'
983 fl = repo.file(f)
982 fl = repo.file(f)
984 o = len(fl)
983 o = len(fl)
985 try:
984 try:
986 deltas = source.deltaiter(revmap)
985 deltas = source.deltaiter()
987 if not fl.addgroup(deltas, trp):
986 if not fl.addgroup(deltas, revmap, trp):
988 raise error.Abort(_("received file revlog group is empty"))
987 raise error.Abort(_("received file revlog group is empty"))
989 except error.CensoredBaseError as e:
988 except error.CensoredBaseError as e:
990 raise error.Abort(_("received delta base is censored: %s") % e)
989 raise error.Abort(_("received delta base is censored: %s") % e)
@@ -1910,7 +1910,7 b' class revlog(object):'
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
@@ -1944,7 +1944,8 b' class revlog(object):'
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)
@@ -119,7 +119,7 b" def addgroupcopy(rlog, tr, destname=b'_d"
119 'deltabase': rlog.node(deltaparent),
119 'deltabase': rlog.node(deltaparent),
120 'delta': rlog.revdiff(deltaparent, r)}
120 'delta': rlog.revdiff(deltaparent, r)}
121
121
122 def deltaiter(self, linkmapper):
122 def deltaiter(self):
123 chain = None
123 chain = None
124 for chunkdata in iter(lambda: self.deltachunk(chain), {}):
124 for chunkdata in iter(lambda: self.deltachunk(chain), {}):
125 node = chunkdata['node']
125 node = chunkdata['node']
@@ -130,17 +130,16 b" def addgroupcopy(rlog, tr, destname=b'_d"
130 delta = chunkdata['delta']
130 delta = chunkdata['delta']
131 flags = chunkdata['flags']
131 flags = chunkdata['flags']
132
132
133 link = linkmapper(cs)
134 chain = node
133 chain = node
135
134
136 yield (node, p1, p2, link, deltabase, delta, flags)
135 yield (node, p1, p2, cs, deltabase, delta, flags)
137
136
138 def linkmap(lnode):
137 def linkmap(lnode):
139 return rlog.rev(lnode)
138 return rlog.rev(lnode)
140
139
141 dlog = newrevlog(destname, recreate=True)
140 dlog = newrevlog(destname, recreate=True)
142 dummydeltas = dummychangegroup().deltaiter(linkmap)
141 dummydeltas = dummychangegroup().deltaiter()
143 dlog.addgroup(dummydeltas, tr)
142 dlog.addgroup(dummydeltas, linkmap, tr)
144 return dlog
143 return dlog
145
144
146 def lowlevelcopy(rlog, tr, destname=b'_destrevlog.i'):
145 def lowlevelcopy(rlog, tr, destname=b'_destrevlog.i'):
General Comments 0
You need to be logged in to leave comments. Login now