# HG changeset patch # User Matt Mackall # Date 1231736664 21600 # Node ID e3f8c6d6b72e635a08a4d87362e7a630c8d4cfcf # Parent d22c437247452f84125d33ddd3e036d12a583667 error: move ParseError diff -r d22c43724745 -r e3f8c6d6b72e hgext/rebase.py --- a/hgext/rebase.py Sun Jan 11 23:00:09 2009 -0600 +++ b/hgext/rebase.py Sun Jan 11 23:04:24 2009 -0600 @@ -13,7 +13,7 @@ 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 @@ 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 @@ 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: diff -r d22c43724745 -r e3f8c6d6b72e mercurial/dispatch.py --- a/mercurial/dispatch.py Sun Jan 11 23:00:09 2009 -0600 +++ b/mercurial/dispatch.py Sun Jan 11 23:04:24 2009 -0600 @@ -12,9 +12,6 @@ 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 @@ 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 @@ 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 @@ 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 @@ try: return cmdfunc() except util.SignatureError: - raise ParseError(cmd, _("invalid arguments")) + raise error.ParseError(cmd, _("invalid arguments")) if options['profile']: import hotshot, hotshot.stats diff -r d22c43724745 -r e3f8c6d6b72e mercurial/error.py --- a/mercurial/error.py Sun Jan 11 23:00:09 2009 -0600 +++ b/mercurial/error.py Sun Jan 11 23:04:24 2009 -0600 @@ -24,3 +24,6 @@ def __str__(self): return RevlogError.__str__(self) + +class ParseError(Exception): + """Exception raised on errors in parsing the command line."""