[PATCH 1 of 5] revset: add test that should fail if '_aliasarg' tag is removed
Yuya Nishihara
yuya at tcha.org
Tue Mar 29 15:27:46 UTC 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1455454010 -32400
# Sun Feb 14 21:46:50 2016 +0900
# Node ID 52999dfc8c449e221709b537e35cdac144ace7d9
# Parent b106317fea11feb11986aefadfbedc0f98efdf25
revset: add test that should fail if '_aliasarg' tag is removed
I'm going to refactor the alias processing functions. We need '_aliasarg' tag
to limit the scope of the alias expansion, but it wasn't covered by the test.
This patch adds the test that should fail if '_aliasarg' were 'symbol'.
This is the first half of the second part of the "template alias" series. The
whole series will consist of the following parts:
1. make parsed template tree to be compatible with parser functions
(1d461ee26e1b and 73d01cba5810)
2. refactor alias processing to be less dependent on revset module
(1/2 in this series)
3. extract reusable component to parser module
4. clean up it
5. extend it to support template syntax
6. add debugging/testing functions of template aliases
7. add alias expansion routine to templater
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1799,6 +1799,27 @@ far away.
abort: unknown revision '$1'!
[255]
+test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)',
+but 'all()' should never be substituded to '0()'.
+
+ $ echo 'universe = all()' >> .hg/hgrc
+ $ echo 'shadowall(all) = all and universe' >> .hg/hgrc
+ $ try 'shadowall(0)'
+ (func
+ ('symbol', 'shadowall')
+ ('symbol', '0'))
+ * expanded:
+ (and
+ ('symbol', '0')
+ (func
+ ('symbol', 'all')
+ None))
+ * set:
+ <filteredset
+ <baseset [0]>,
+ <spanset+ 0:9>>
+ 0
+
$ echo 'injectparamasstring2 = max(_aliasarg("$1"))' >> .hg/hgrc
$ echo 'callinjection2($1) = descendants(injectparamasstring2)' >> .hg/hgrc
$ try 'callinjection2(2:5)'
More information about the Mercurial-devel
mailing list