##// END OF EJS Templates
alias: improved diagnostic when arguments include --cwd, etc....
Dan Villiom Podlaski Christiansen -
r11695:ee8f36a6 default
parent child Browse files
Show More
@@ -223,6 +223,18 b' class cmdalias(object):'
223 cmd = args.pop(0)
223 cmd = args.pop(0)
224 args = map(util.expandpath, args)
224 args = map(util.expandpath, args)
225
225
226 for invalidarg in ("--cwd", "-R", "--repository", "--repo"):
227 if _earlygetopt([invalidarg], args):
228 def fn(ui, *args):
229 ui.warn(_("error in definition for alias '%s': %s may only "
230 "be given on the command line\n")
231 % (self.name, invalidarg))
232 return 1
233
234 self.fn = fn
235 self.badalias = True
236 return
237
226 try:
238 try:
227 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
239 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
228 if len(tableentry) > 2:
240 if len(tableentry) > 2:
@@ -8,6 +8,10 b' unknown = bargle'
8 ambiguous = s
8 ambiguous = s
9 recursive = recursive
9 recursive = recursive
10 nodefinition =
10 nodefinition =
11 no--cwd = status --cwd elsewhere
12 no-R = status -R elsewhere
13 no--repo = status --repo elsewhere
14 no--repository = status --repository elsewhere
11 mylog = log
15 mylog = log
12 lognull = log -r null
16 lognull = log -r null
13 shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
17 shortlog = log --template '{rev} {node|short} | {date|isodate}\n'
@@ -42,6 +46,16 b" echo '% no definition'"
42 hg nodef
46 hg nodef
43 hg help nodef
47 hg help nodef
44
48
49 echo '% invalid options'
50 hg no--cwd
51 hg help no--cwd
52 hg no-R
53 hg help no-R
54 hg no--repo
55 hg help no--repo
56 hg no--repository
57 hg help no--repository
58
45 cd alias
59 cd alias
46
60
47 echo '% no usage'
61 echo '% no usage'
@@ -11,6 +11,15 b" alias 'recursive' resolves to unknown co"
11 % no definition
11 % no definition
12 no definition for alias 'nodefinition'
12 no definition for alias 'nodefinition'
13 no definition for alias 'nodefinition'
13 no definition for alias 'nodefinition'
14 % invalid options
15 error in definition for alias 'no--cwd': --cwd may only be given on the command line
16 error in definition for alias 'no--cwd': --cwd may only be given on the command line
17 error in definition for alias 'no-R': -R may only be given on the command line
18 error in definition for alias 'no-R': -R may only be given on the command line
19 error in definition for alias 'no--repo': --repo may only be given on the command line
20 error in definition for alias 'no--repo': --repo may only be given on the command line
21 error in definition for alias 'no--repository': --repository may only be given on the command line
22 error in definition for alias 'no--repository': --repository may only be given on the command line
14 % no usage
23 % no usage
15 no rollback information available
24 no rollback information available
16 adding foo
25 adding foo
General Comments 0
You need to be logged in to leave comments. Login now