comparison mercurial/debugcommands.py @ 50578:003418163195

debug: slightly improve wording on the InputErrors from the previous patch
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 31 May 2023 12:00:21 -0300
parents 2f5270af57c7
children 720a23405fe9
comparison
equal deleted inserted replaced
50577:2f5270af57c7 50578:003418163195
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.InputError(_(b'invalid arguments')) 714 raise error.InputError(
715 _(b'cannot specify a revision with other arguments')
716 )
715 file_, rev = None, file_ 717 file_, rev = None, file_
716 elif rev is None: 718 elif rev is None:
717 raise error.InputError(_(b'invalid arguments')) 719 raise error.InputError(_(b'please specify a revision'))
718 r = cmdutil.openstorage(repo, b'debugdata', file_, opts) 720 r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
719 try: 721 try:
720 ui.write(r.rawdata(r.lookup(rev))) 722 ui.write(r.rawdata(r.lookup(rev)))
721 except KeyError: 723 except KeyError:
722 raise error.Abort(_(b'invalid revision identifier %s') % rev) 724 raise error.Abort(_(b'invalid revision identifier %s') % rev)
2630 ) 2632 )
2631 def debugnodemap(ui, repo, file_=None, **opts): 2633 def debugnodemap(ui, repo, file_=None, **opts):
2632 """write and inspect on disk nodemap""" 2634 """write and inspect on disk nodemap"""
2633 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'): 2635 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
2634 if file_ is not None: 2636 if file_ is not None:
2635 raise error.InputError(_(b'invalid arguments')) 2637 raise error.InputError(
2638 _(b'cannot specify a file with other arguments')
2639 )
2636 elif file_ is None: 2640 elif file_ is None:
2637 opts['changelog'] = True 2641 opts['changelog'] = True
2638 r = cmdutil.openstorage( 2642 r = cmdutil.openstorage(
2639 repo.unfiltered(), b'debugnodemap', file_, pycompat.byteskwargs(opts) 2643 repo.unfiltered(), b'debugnodemap', file_, pycompat.byteskwargs(opts)
2640 ) 2644 )
3559 3563
3560 Use --verbose to dump the sidedata content.""" 3564 Use --verbose to dump the sidedata content."""
3561 opts = pycompat.byteskwargs(opts) 3565 opts = pycompat.byteskwargs(opts)
3562 if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'): 3566 if opts.get(b'changelog') or opts.get(b'manifest') or opts.get(b'dir'):
3563 if rev is not None: 3567 if rev is not None:
3564 raise error.InputError(_(b'invalid arguments')) 3568 raise error.InputError(
3569 _(b'cannot specify a revision with other arguments')
3570 )
3565 file_, rev = None, file_ 3571 file_, rev = None, file_
3566 elif rev is None: 3572 elif rev is None:
3567 raise error.InputError(_(b'invalid arguments')) 3573 raise error.InputError(_(b'please specify a revision'))
3568 r = cmdutil.openstorage(repo, b'debugdata', file_, opts) 3574 r = cmdutil.openstorage(repo, b'debugdata', file_, opts)
3569 r = getattr(r, '_revlog', r) 3575 r = getattr(r, '_revlog', r)
3570 try: 3576 try:
3571 sidedata = r.sidedata(r.lookup(rev)) 3577 sidedata = r.sidedata(r.lookup(rev))
3572 except KeyError: 3578 except KeyError: