mercurial/commands.py
changeset 13741 b51bf961b3cb
parent 13727 ce47a0c10224
child 13747 cede00420e1e
equal deleted inserted replaced
13740:dcb51f156fa6 13741:b51bf961b3cb
  1267                         break
  1267                         break
  1268                     node = chunkdata['node']
  1268                     node = chunkdata['node']
  1269                     ui.write("%s\n" % hex(node))
  1269                     ui.write("%s\n" % hex(node))
  1270     finally:
  1270     finally:
  1271         f.close()
  1271         f.close()
       
  1272 
       
  1273 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
       
  1274     """retrieves a bundle from a repo
       
  1275 
       
  1276     Every ID must be a full-length hex node id string. Saves the bundle to the
       
  1277     given file.
       
  1278     """
       
  1279     repo = hg.repository(ui, repopath)
       
  1280     if not repo.capable('getbundle'):
       
  1281         raise util.Abort("getbundle() not supported by target repository")
       
  1282     args = {}
       
  1283     if common:
       
  1284         args['common'] = [bin(s) for s in common]
       
  1285     if head:
       
  1286         args['heads'] = [bin(s) for s in head]
       
  1287     bundle = repo.getbundle('debug', **args)
       
  1288 
       
  1289     bundletype = opts.get('type', 'bzip2').lower()
       
  1290     btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
       
  1291     bundletype = btypes.get(bundletype)
       
  1292     if bundletype not in changegroup.bundletypes:
       
  1293         raise util.Abort(_('unknown bundle type specified with --type'))
       
  1294     changegroup.writebundle(bundle, bundlepath, bundletype)
  1272 
  1295 
  1273 def debugpushkey(ui, repopath, namespace, *keyinfo):
  1296 def debugpushkey(ui, repopath, namespace, *keyinfo):
  1274     '''access the pushkey key/value protocol
  1297     '''access the pushkey key/value protocol
  1275 
  1298 
  1276     With two args, list the keys in the given namespace.
  1299     With two args, list the keys in the given namespace.
  4495         (debugdate,
  4518         (debugdate,
  4496          [('e', 'extended', None, _('try extended date formats'))],
  4519          [('e', 'extended', None, _('try extended date formats'))],
  4497          _('[-e] DATE [RANGE]')),
  4520          _('[-e] DATE [RANGE]')),
  4498     "debugdata": (debugdata, [], _('FILE REV')),
  4521     "debugdata": (debugdata, [], _('FILE REV')),
  4499     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
  4522     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
       
  4523     "debuggetbundle":
       
  4524         (debuggetbundle,
       
  4525          [('H', 'head', [], _('id of head node'), _('ID')),
       
  4526           ('C', 'common', [], _('id of common node'), _('ID')),
       
  4527           ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
       
  4528          ],
       
  4529          _('REPO FILE [-H|-C ID]...')),
  4500     "debugignore": (debugignore, [], ''),
  4530     "debugignore": (debugignore, [], ''),
  4501     "debugindex": (debugindex,
  4531     "debugindex": (debugindex,
  4502                    [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
  4532                    [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
  4503                    _('FILE')),
  4533                    _('FILE')),
  4504     "debugindexdot": (debugindexdot, [], _('FILE')),
  4534     "debugindexdot": (debugindexdot, [], _('FILE')),
  4867     "version": (version_, []),
  4897     "version": (version_, []),
  4868 }
  4898 }
  4869 
  4899 
  4870 norepo = ("clone init version help debugcommands debugcomplete"
  4900 norepo = ("clone init version help debugcommands debugcomplete"
  4871           " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
  4901           " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
  4872           " debugknown debugbundle")
  4902           " debugknown debuggetbundle debugbundle")
  4873 optionalrepo = ("identify paths serve showconfig debugancestor debugdag"
  4903 optionalrepo = ("identify paths serve showconfig debugancestor debugdag"
  4874                 " debugdata debugindex debugindexdot")
  4904                 " debugdata debugindex debugindexdot")