Show More
@@ -2234,11 +2234,6 b' def _parsealiasdecl(decl):' | |||||
2234 | return (decl, None, None, parseerrordetail(inst)) |
|
2234 | return (decl, None, None, parseerrordetail(inst)) | |
2235 |
|
2235 | |||
2236 | class revsetalias(object): |
|
2236 | class revsetalias(object): | |
2237 | funcre = re.compile('^([^(]+)\(([^)]+)\)$') |
|
|||
2238 | args = None |
|
|||
2239 |
|
||||
2240 | # error message at parsing, or None |
|
|||
2241 | error = None |
|
|||
2242 | # whether own `error` information is already shown or not. |
|
2237 | # whether own `error` information is already shown or not. | |
2243 | # this avoids showing same warning multiple times at each `findaliases`. |
|
2238 | # this avoids showing same warning multiple times at each `findaliases`. | |
2244 | warned = False |
|
2239 | warned = False | |
@@ -2249,18 +2244,17 b' class revsetalias(object):' | |||||
2249 | h = heads(default) |
|
2244 | h = heads(default) | |
2250 | b($1) = ancestors($1) - ancestors(default) |
|
2245 | b($1) = ancestors($1) - ancestors(default) | |
2251 | ''' |
|
2246 | ''' | |
2252 | m = self.funcre.search(name) |
|
2247 | self.name, self.tree, self.args, self.error = _parsealiasdecl(name) | |
2253 |
if |
|
2248 | if self.error: | |
2254 | self.name = m.group(1) |
|
2249 | self.error = _('failed to parse the declaration of revset alias' | |
2255 | self.tree = ('func', ('symbol', m.group(1))) |
|
2250 | ' "%s": %s') % (self.name, self.error) | |
2256 | self.args = [x.strip() for x in m.group(2).split(',')] |
|
2251 | return | |
|
2252 | ||||
|
2253 | if self.args: | |||
2257 | for arg in self.args: |
|
2254 | for arg in self.args: | |
2258 | # _aliasarg() is an unknown symbol only used separate |
|
2255 | # _aliasarg() is an unknown symbol only used separate | |
2259 | # alias argument placeholders from regular strings. |
|
2256 | # alias argument placeholders from regular strings. | |
2260 | value = value.replace(arg, '_aliasarg(%r)' % (arg,)) |
|
2257 | value = value.replace(arg, '_aliasarg(%r)' % (arg,)) | |
2261 | else: |
|
|||
2262 | self.name = name |
|
|||
2263 | self.tree = ('symbol', name) |
|
|||
2264 |
|
2258 | |||
2265 | try: |
|
2259 | try: | |
2266 | self.replacement, pos = parse(value) |
|
2260 | self.replacement, pos = parse(value) |
@@ -998,6 +998,12 b' far away.' | |||||
998 | $ try 'tip' |
|
998 | $ try 'tip' | |
999 | ('symbol', 'tip') |
|
999 | ('symbol', 'tip') | |
1000 | 9 |
|
1000 | 9 | |
|
1001 | ||||
|
1002 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" | |||
|
1003 | ('symbol', 'tip') | |||
|
1004 | warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token | |||
|
1005 | 9 | |||
|
1006 | ||||
1001 | $ try 'd(2:5)' |
|
1007 | $ try 'd(2:5)' | |
1002 | (func |
|
1008 | (func | |
1003 | ('symbol', 'd') |
|
1009 | ('symbol', 'd') |
General Comments 0
You need to be logged in to leave comments.
Login now