mercurial/debugcommands.py
changeset 50543 2f5270af57c7
parent 50525 8fb3e942473a
child 50544 003418163195
equal deleted inserted replaced
50542:dc201a09e82c 50543:2f5270af57c7
   709 def debugdata(ui, repo, file_, rev=None, **opts):
   709 def debugdata(ui, repo, file_, rev=None, **opts):
   710     """dump the contents of a data file revision"""
   710     """dump the contents of a data file revision"""
   711     opts = pycompat.byteskwargs(opts)
   711     opts = pycompat.byteskwargs(opts)
   712     if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
   712     if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
   713         if rev is not None:
   713         if rev is not None:
   714             raise error.CommandError(b'debugdata', _(b'invalid arguments'))
   714             raise error.InputError(_(b'invalid arguments'))
   715         file_, rev = None, file_
   715         file_, rev = None, file_
   716     elif rev is None:
   716     elif rev is None:
   717         raise error.CommandError(b'debugdata', _(b'invalid arguments'))
   717         raise error.InputError(_(b'invalid arguments'))
   718     r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
   718     r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
   719     try:
   719     try:
   720         ui.write(r.rawdata(r.lookup(rev)))
   720         ui.write(r.rawdata(r.lookup(rev)))
   721     except KeyError:
   721     except KeyError:
   722         raise error.Abort(_(b'invalid revision identifier %s') % rev)
   722         raise error.Abort(_(b'invalid revision identifier %s') % rev)
  2630 )
  2630 )
  2631 def debugnodemap(ui, repo, file_=None, **opts):
  2631 def debugnodemap(ui, repo, file_=None, **opts):
  2632     """write and inspect on disk nodemap"""
  2632     """write and inspect on disk nodemap"""
  2633     if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
  2633     if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
  2634         if file_ is not None:
  2634         if file_ is not None:
  2635             raise error.CommandError(b'debugnodemap', _(b'invalid arguments'))
  2635             raise error.InputError(_(b'invalid arguments'))
  2636     elif file_ is None:
  2636     elif file_ is None:
  2637         opts['changelog'] = True
  2637         opts['changelog'] = True
  2638     r = cmdutil.openstorage(
  2638     r = cmdutil.openstorage(
  2639         repo.unfiltered(), b'debugnodemap', file_, pycompat.byteskwargs(opts)
  2639         repo.unfiltered(), b'debugnodemap', file_, pycompat.byteskwargs(opts)
  2640     )
  2640     )
  3559 
  3559 
  3560     Use --verbose to dump the sidedata content."""
  3560     Use --verbose to dump the sidedata content."""
  3561     opts = pycompat.byteskwargs(opts)
  3561     opts = pycompat.byteskwargs(opts)
  3562     if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
  3562     if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
  3563         if rev is not None:
  3563         if rev is not None:
  3564             raise error.CommandError(b'debugdata', _(b'invalid arguments'))
  3564             raise error.InputError(_(b'invalid arguments'))
  3565         file_, rev = None, file_
  3565         file_, rev = None, file_
  3566     elif rev is None:
  3566     elif rev is None:
  3567         raise error.CommandError(b'debugdata', _(b'invalid arguments'))
  3567         raise error.InputError(_(b'invalid arguments'))
  3568     r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
  3568     r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
  3569     r = getattr(r, '_revlog', r)
  3569     r = getattr(r, '_revlog', r)
  3570     try:
  3570     try:
  3571         sidedata = r.sidedata(r.lookup(rev))
  3571         sidedata = r.sidedata(r.lookup(rev))
  3572     except KeyError:
  3572     except KeyError: