comparison mercurial/debugcommands.py @ 30502:6da030496667

debugcommands: move debug{create,apply}streambundleclone to the new module
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 17 Aug 2016 20:37:54 -0700
parents a87e469201f9
children 6bfb333a6f2f
comparison
equal deleted inserted replaced
30501:a87e469201f9 30502:6da030496667
25 hg, 25 hg,
26 lock as lockmod, 26 lock as lockmod,
27 revlog, 27 revlog,
28 scmutil, 28 scmutil,
29 simplemerge, 29 simplemerge,
30 streamclone,
30 ) 31 )
31 32
32 release = lockmod.release 33 release = lockmod.release
33 34
34 # We reuse the command table from commands because it is easier than 35 # We reuse the command table from commands because it is easier than
271 ui.write('%s -- %r\n' % (part.type, repr(part.params))) 272 ui.write('%s -- %r\n' % (part.type, repr(part.params)))
272 if part.type == 'changegroup': 273 if part.type == 'changegroup':
273 version = part.params.get('version', '01') 274 version = part.params.get('version', '01')
274 cg = changegroup.getunbundler(version, part, 'UN') 275 cg = changegroup.getunbundler(version, part, 'UN')
275 _debugchangegroup(ui, cg, all=all, indent=4, **opts) 276 _debugchangegroup(ui, cg, all=all, indent=4, **opts)
277
278 @command('debugcreatestreamclonebundle', [], 'FILE')
279 def debugcreatestreamclonebundle(ui, repo, fname):
280 """create a stream clone bundle file
281
282 Stream bundles are special bundles that are essentially archives of
283 revlog files. They are commonly used for cloning very quickly.
284 """
285 requirements, gen = streamclone.generatebundlev1(repo)
286 changegroup.writechunks(ui, gen, fname)
287
288 ui.write(_('bundle requirements: %s\n') % ', '.join(sorted(requirements)))
289
290 @command('debugapplystreamclonebundle', [], 'FILE')
291 def debugapplystreamclonebundle(ui, repo, fname):
292 """apply a stream clone bundle file"""
293 f = hg.openpath(ui, fname)
294 gen = exchange.readbundle(ui, f, fname)
295 gen.apply(repo)