Show More
@@ -1486,6 +1486,11 b' def help_(ui, name=None, with_version=Fa' | |||||
1486 | helplist(_('list of commands:\n\n'), select) |
|
1486 | helplist(_('list of commands:\n\n'), select) | |
1487 | return |
|
1487 | return | |
1488 |
|
1488 | |||
|
1489 | # check if it's an invalid alias and display its error if it is | |||
|
1490 | if getattr(entry[0], 'badalias', False): | |||
|
1491 | entry[0](ui) | |||
|
1492 | return | |||
|
1493 | ||||
1489 | # synopsis |
|
1494 | # synopsis | |
1490 | if len(entry) > 2: |
|
1495 | if len(entry) > 2: | |
1491 | if entry[2].startswith('hg'): |
|
1496 | if entry[2].startswith('hg'): |
@@ -177,6 +177,7 b' class cmdalias(object):' | |||||
177 | self.opts = [] |
|
177 | self.opts = [] | |
178 | self.help = '' |
|
178 | self.help = '' | |
179 | self.norepo = True |
|
179 | self.norepo = True | |
|
180 | self.badalias = False | |||
180 |
|
181 | |||
181 | try: |
|
182 | try: | |
182 | cmdutil.findcmd(self.name, cmdtable, True) |
|
183 | cmdutil.findcmd(self.name, cmdtable, True) | |
@@ -189,6 +190,7 b' class cmdalias(object):' | |||||
189 | ui.warn(_("no definition for alias '%s'\n") % self.name) |
|
190 | ui.warn(_("no definition for alias '%s'\n") % self.name) | |
190 | return 1 |
|
191 | return 1 | |
191 | self.fn = fn |
|
192 | self.fn = fn | |
|
193 | self.badalias = True | |||
192 |
|
194 | |||
193 | return |
|
195 | return | |
194 |
|
196 | |||
@@ -217,12 +219,14 b' class cmdalias(object):' | |||||
217 | % (self.name, cmd)) |
|
219 | % (self.name, cmd)) | |
218 | return 1 |
|
220 | return 1 | |
219 | self.fn = fn |
|
221 | self.fn = fn | |
|
222 | self.badalias = True | |||
220 | except error.AmbiguousCommand: |
|
223 | except error.AmbiguousCommand: | |
221 | def fn(ui, *args): |
|
224 | def fn(ui, *args): | |
222 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ |
|
225 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ | |
223 | % (self.name, cmd)) |
|
226 | % (self.name, cmd)) | |
224 | return 1 |
|
227 | return 1 | |
225 | self.fn = fn |
|
228 | self.fn = fn | |
|
229 | self.badalias = True | |||
226 |
|
230 | |||
227 | def __call__(self, ui, *args, **opts): |
|
231 | def __call__(self, ui, *args, **opts): | |
228 | if self.shadows: |
|
232 | if self.shadows: |
@@ -25,15 +25,19 b' hg myinit alias' | |||||
25 |
|
25 | |||
26 | echo '% unknown' |
|
26 | echo '% unknown' | |
27 | hg unknown |
|
27 | hg unknown | |
|
28 | hg help unknown | |||
28 |
|
29 | |||
29 | echo '% ambiguous' |
|
30 | echo '% ambiguous' | |
30 | hg ambiguous |
|
31 | hg ambiguous | |
|
32 | hg help ambiguous | |||
31 |
|
33 | |||
32 | echo '% recursive' |
|
34 | echo '% recursive' | |
33 | hg recursive |
|
35 | hg recursive | |
|
36 | hg help recursive | |||
34 |
|
37 | |||
35 | echo '% no definition' |
|
38 | echo '% no definition' | |
36 | hg nodef |
|
39 | hg nodef | |
|
40 | hg help nodef | |||
37 |
|
41 | |||
38 | cd alias |
|
42 | cd alias | |
39 |
|
43 |
@@ -1,12 +1,16 b'' | |||||
1 | % basic |
|
1 | % basic | |
2 | % unknown |
|
2 | % unknown | |
3 | alias 'unknown' resolves to unknown command 'bargle' |
|
3 | alias 'unknown' resolves to unknown command 'bargle' | |
|
4 | alias 'unknown' resolves to unknown command 'bargle' | |||
4 | % ambiguous |
|
5 | % ambiguous | |
5 | alias 'ambiguous' resolves to ambiguous command 's' |
|
6 | alias 'ambiguous' resolves to ambiguous command 's' | |
|
7 | alias 'ambiguous' resolves to ambiguous command 's' | |||
6 | % recursive |
|
8 | % recursive | |
7 | alias 'recursive' resolves to unknown command 'recursive' |
|
9 | alias 'recursive' resolves to unknown command 'recursive' | |
|
10 | alias 'recursive' resolves to unknown command 'recursive' | |||
8 | % no definition |
|
11 | % no definition | |
9 | no definition for alias 'nodefinition' |
|
12 | no definition for alias 'nodefinition' | |
|
13 | no definition for alias 'nodefinition' | |||
10 | % no usage |
|
14 | % no usage | |
11 | no rollback information available |
|
15 | no rollback information available | |
12 | adding foo |
|
16 | adding foo |
General Comments 0
You need to be logged in to leave comments.
Login now