Mercurial > hg-stable
diff tests/test-revset.t @ 23725:6a81f88758aa
revset: delay showing parse error for the revset alias until it is referred
Before this patch, a problematic revset alias aborts execution
immediately, even if it isn't referred in the specified revset.
If old "hg" may be used too (for example, bisecting Mercurial itself),
it is also difficult to write alias definitions using features newly
introduced by newer "hg" into configuration files, because such alias
definitions cause unexpected abortion at parsing revset aliases with
old "hg".
This patch delays showing parse error for the revset alias until it is
actually referred at runtime.
This patch detects referring problematic aliases in "_expandaliases"
by examination of "revsetalias.error", which is initialized with the
error message only when parsing fails.
For usability, this patch also warns about problematic aliases, even
if they aren't referred at runtime. This should help users to know
potential problems in their alias definitions earlier.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 05 Jan 2015 11:02:04 +0900 |
parents | ba89f7b542c9 |
children | 3a4d8a6ce432 |
line wrap: on
line diff
--- a/tests/test-revset.t Sat Jan 03 11:12:44 2015 +0000 +++ b/tests/test-revset.t Mon Jan 05 11:02:04 2015 +0900 @@ -956,11 +956,19 @@ (range ('symbol', '2') ('symbol', '5'))) - hg: parse error: not a function: _aliasarg + abort: failed to parse revset alias "injectparamasstring2": not a function: _aliasarg [255] + $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" + ('symbol', 'tip') + warning: failed to parse revset alias "anotherbadone": at 7: not a prefix: end + warning: failed to parse revset alias "injectparamasstring2": not a function: _aliasarg + 9 >>> data = file('.hg/hgrc', 'rb').read() >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', '')) + $ try 'tip' + ('symbol', 'tip') + 9 $ try 'd(2:5)' (func ('symbol', 'd')