mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
error: move ParseError
This commit is contained in:
parent
c25ea87091
commit
d3bf622cc2
@ -13,7 +13,7 @@ For more information:
|
||||
http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject
|
||||
'''
|
||||
|
||||
from mercurial import util, repair, merge, cmdutil, dispatch, commands
|
||||
from mercurial import util, repair, merge, cmdutil, commands, error
|
||||
from mercurial import extensions, ancestor
|
||||
from mercurial.commands import templateopts
|
||||
from mercurial.node import nullrev
|
||||
@ -67,21 +67,21 @@ def rebase(ui, repo, **opts):
|
||||
extrafn = opts.get('extrafn')
|
||||
if opts.get('keepbranches', None):
|
||||
if extrafn:
|
||||
raise dispatch.ParseError('rebase',
|
||||
_('cannot use both keepbranches and extrafn'))
|
||||
raise error.ParseError(
|
||||
'rebase', _('cannot use both keepbranches and extrafn'))
|
||||
def extrafn(ctx, extra):
|
||||
extra['branch'] = ctx.branch()
|
||||
|
||||
if contf or abortf:
|
||||
if contf and abortf:
|
||||
raise dispatch.ParseError('rebase',
|
||||
_('cannot use both abort and continue'))
|
||||
raise error.ParseError('rebase',
|
||||
_('cannot use both abort and continue'))
|
||||
if collapsef:
|
||||
raise dispatch.ParseError('rebase',
|
||||
_('cannot use collapse with continue or abort'))
|
||||
raise error.ParseError(
|
||||
'rebase', _('cannot use collapse with continue or abort'))
|
||||
|
||||
if (srcf or basef or destf):
|
||||
raise dispatch.ParseError('rebase',
|
||||
raise error.ParseError('rebase',
|
||||
_('abort and continue do not allow specifying revisions'))
|
||||
|
||||
originalwd, target, state, collapsef, external = restorestatus(repo)
|
||||
@ -90,8 +90,8 @@ def rebase(ui, repo, **opts):
|
||||
return
|
||||
else:
|
||||
if srcf and basef:
|
||||
raise dispatch.ParseError('rebase', _('cannot specify both a '
|
||||
'revision and a base'))
|
||||
raise error.ParseError('rebase', _('cannot specify both a '
|
||||
'revision and a base'))
|
||||
cmdutil.bail_if_changed(repo)
|
||||
result = buildstate(repo, destf, srcf, basef, collapsef)
|
||||
if result:
|
||||
|
@ -12,9 +12,6 @@ import util, commands, hg, lock, fancyopts, extensions, hook, error
|
||||
import cmdutil
|
||||
import ui as _ui
|
||||
|
||||
class ParseError(Exception):
|
||||
"""Exception raised on errors in parsing the command line."""
|
||||
|
||||
def run():
|
||||
"run the command in sys.argv"
|
||||
sys.exit(dispatch(sys.argv[1:]))
|
||||
@ -52,7 +49,7 @@ def _runcatch(ui, args):
|
||||
ui.print_exc()
|
||||
raise
|
||||
|
||||
except ParseError, inst:
|
||||
except error.ParseError, inst:
|
||||
if inst.args[0]:
|
||||
ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
|
||||
commands.help_(ui, inst.args[0])
|
||||
@ -167,7 +164,7 @@ def _parse(ui, args):
|
||||
try:
|
||||
args = fancyopts.fancyopts(args, commands.globalopts, options)
|
||||
except fancyopts.getopt.GetoptError, inst:
|
||||
raise ParseError(None, inst)
|
||||
raise error.ParseError(None, inst)
|
||||
|
||||
if args:
|
||||
cmd, args = args[0], args[1:]
|
||||
@ -189,7 +186,7 @@ def _parse(ui, args):
|
||||
try:
|
||||
args = fancyopts.fancyopts(args, c, cmdoptions)
|
||||
except fancyopts.getopt.GetoptError, inst:
|
||||
raise ParseError(cmd, inst)
|
||||
raise error.ParseError(cmd, inst)
|
||||
|
||||
# separate global options back out
|
||||
for o in commands.globalopts:
|
||||
@ -375,7 +372,7 @@ def _runcommand(ui, options, cmd, cmdfunc):
|
||||
try:
|
||||
return cmdfunc()
|
||||
except util.SignatureError:
|
||||
raise ParseError(cmd, _("invalid arguments"))
|
||||
raise error.ParseError(cmd, _("invalid arguments"))
|
||||
|
||||
if options['profile']:
|
||||
import hotshot, hotshot.stats
|
||||
|
@ -24,3 +24,6 @@ class LookupError(RevlogError, KeyError):
|
||||
|
||||
def __str__(self):
|
||||
return RevlogError.__str__(self)
|
||||
|
||||
class ParseError(Exception):
|
||||
"""Exception raised on errors in parsing the command line."""
|
||||
|
Loading…
Reference in New Issue
Block a user