comparison hgext/rebase.py @ 7636:e3f8c6d6b72e

error: move ParseError
author Matt Mackall <mpm@selenic.com>
date Sun, 11 Jan 2009 23:04:24 -0600
parents 4dd7b28003d2
children 92455c1d6f83
comparison
equal deleted inserted replaced
7635:d22c43724745 7636:e3f8c6d6b72e
11 11
12 For more information: 12 For more information:
13 http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject 13 http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject
14 ''' 14 '''
15 15
16 from mercurial import util, repair, merge, cmdutil, dispatch, commands 16 from mercurial import util, repair, merge, cmdutil, commands, error
17 from mercurial import extensions, ancestor 17 from mercurial import extensions, ancestor
18 from mercurial.commands import templateopts 18 from mercurial.commands import templateopts
19 from mercurial.node import nullrev 19 from mercurial.node import nullrev
20 from mercurial.i18n import _ 20 from mercurial.i18n import _
21 import os, errno 21 import os, errno
65 abortf = opts.get('abort') 65 abortf = opts.get('abort')
66 collapsef = opts.get('collapse', False) 66 collapsef = opts.get('collapse', False)
67 extrafn = opts.get('extrafn') 67 extrafn = opts.get('extrafn')
68 if opts.get('keepbranches', None): 68 if opts.get('keepbranches', None):
69 if extrafn: 69 if extrafn:
70 raise dispatch.ParseError('rebase', 70 raise error.ParseError(
71 _('cannot use both keepbranches and extrafn')) 71 'rebase', _('cannot use both keepbranches and extrafn'))
72 def extrafn(ctx, extra): 72 def extrafn(ctx, extra):
73 extra['branch'] = ctx.branch() 73 extra['branch'] = ctx.branch()
74 74
75 if contf or abortf: 75 if contf or abortf:
76 if contf and abortf: 76 if contf and abortf:
77 raise dispatch.ParseError('rebase', 77 raise error.ParseError('rebase',
78 _('cannot use both abort and continue')) 78 _('cannot use both abort and continue'))
79 if collapsef: 79 if collapsef:
80 raise dispatch.ParseError('rebase', 80 raise error.ParseError(
81 _('cannot use collapse with continue or abort')) 81 'rebase', _('cannot use collapse with continue or abort'))
82 82
83 if (srcf or basef or destf): 83 if (srcf or basef or destf):
84 raise dispatch.ParseError('rebase', 84 raise error.ParseError('rebase',
85 _('abort and continue do not allow specifying revisions')) 85 _('abort and continue do not allow specifying revisions'))
86 86
87 originalwd, target, state, collapsef, external = restorestatus(repo) 87 originalwd, target, state, collapsef, external = restorestatus(repo)
88 if abortf: 88 if abortf:
89 abort(repo, originalwd, target, state) 89 abort(repo, originalwd, target, state)
90 return 90 return
91 else: 91 else:
92 if srcf and basef: 92 if srcf and basef:
93 raise dispatch.ParseError('rebase', _('cannot specify both a ' 93 raise error.ParseError('rebase', _('cannot specify both a '
94 'revision and a base')) 94 'revision and a base'))
95 cmdutil.bail_if_changed(repo) 95 cmdutil.bail_if_changed(repo)
96 result = buildstate(repo, destf, srcf, basef, collapsef) 96 result = buildstate(repo, destf, srcf, basef, collapsef)
97 if result: 97 if result:
98 originalwd, target, state, external = result 98 originalwd, target, state, external = result
99 else: # Empty state built, nothing to rebase 99 else: # Empty state built, nothing to rebase