Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 34299:311f6ccf8f23
debug: update debugbundle to use new deltaiter api
Changegroup now has a deltaiter api for easy iteration over a series of deltas.
Let's use that in the debugbundle command.
Differential Revision: https://phab.mercurial-scm.org/D744
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 20 Sep 2017 09:28:30 -0700 |
parents | ada8a19672ab |
children | 12c42bcd4133 |
comparison
equal
deleted
inserted
replaced
34298:1db9abf407c5 | 34299:311f6ccf8f23 |
---|---|
261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n") | 261 ui.write(("%sformat: id, p1, p2, cset, delta base, len(delta)\n") |
262 % indent_string) | 262 % indent_string) |
263 | 263 |
264 def showchunks(named): | 264 def showchunks(named): |
265 ui.write("\n%s%s\n" % (indent_string, named)) | 265 ui.write("\n%s%s\n" % (indent_string, named)) |
266 chain = None | 266 for deltadata in gen.deltaiter(): |
267 for chunkdata in iter(lambda: gen.deltachunk(chain), {}): | 267 node, p1, p2, cs, deltabase, delta, flags = deltadata |
268 node = chunkdata['node'] | |
269 p1 = chunkdata['p1'] | |
270 p2 = chunkdata['p2'] | |
271 cs = chunkdata['cs'] | |
272 deltabase = chunkdata['deltabase'] | |
273 delta = chunkdata['delta'] | |
274 ui.write("%s%s %s %s %s %s %s\n" % | 268 ui.write("%s%s %s %s %s %s %s\n" % |
275 (indent_string, hex(node), hex(p1), hex(p2), | 269 (indent_string, hex(node), hex(p1), hex(p2), |
276 hex(cs), hex(deltabase), len(delta))) | 270 hex(cs), hex(deltabase), len(delta))) |
277 chain = node | |
278 | 271 |
279 chunkdata = gen.changelogheader() | 272 chunkdata = gen.changelogheader() |
280 showchunks("changelog") | 273 showchunks("changelog") |
281 chunkdata = gen.manifestheader() | 274 chunkdata = gen.manifestheader() |
282 showchunks("manifest") | 275 showchunks("manifest") |
285 showchunks(fname) | 278 showchunks(fname) |
286 else: | 279 else: |
287 if isinstance(gen, bundle2.unbundle20): | 280 if isinstance(gen, bundle2.unbundle20): |
288 raise error.Abort(_('use debugbundle2 for this file')) | 281 raise error.Abort(_('use debugbundle2 for this file')) |
289 chunkdata = gen.changelogheader() | 282 chunkdata = gen.changelogheader() |
290 chain = None | 283 for deltadata in gen.deltaiter(): |
291 for chunkdata in iter(lambda: gen.deltachunk(chain), {}): | 284 node, p1, p2, cs, deltabase, delta, flags = deltadata |
292 node = chunkdata['node'] | |
293 ui.write("%s%s\n" % (indent_string, hex(node))) | 285 ui.write("%s%s\n" % (indent_string, hex(node))) |
294 chain = node | |
295 | 286 |
296 def _debugobsmarkers(ui, part, indent=0, **opts): | 287 def _debugobsmarkers(ui, part, indent=0, **opts): |
297 """display version and markers contained in 'data'""" | 288 """display version and markers contained in 'data'""" |
298 opts = pycompat.byteskwargs(opts) | 289 opts = pycompat.byteskwargs(opts) |
299 data = part.read() | 290 data = part.read() |