diff tests/test-alias.t @ 29087:ad1bdea43965

dispatch: defer environment variable resolution in alias commands (BC) Before this patch, if there are environment variables in an alias command, they will be expanded immediately when we first see the alias. This will cause issues with chg, because environment variable updates will not propagate to expanded arguments. This patch makes "args" of "cmdalias" a property that will be calculated every time when accessed.
author Jun Wu <quark@fb.com>
date Sat, 07 May 2016 00:16:58 +0100
parents 6822f9382b4c
children 7109d5ddeb0c
line wrap: on
line diff
--- a/tests/test-alias.t	Tue May 03 16:33:25 2016 -0400
+++ b/tests/test-alias.t	Sat May 07 00:16:58 2016 +0100
@@ -525,6 +525,24 @@
   (use "hg help" for the full list of commands or "hg -v" for details)
   [255]
 
+environment variable changes in alias commands
+
+  $ cat > $TESTTMP/setcount.py <<EOF
+  > import os
+  > def uisetup(ui):
+  >     os.environ['COUNT'] = '2'
+  > EOF
+
+  $ cat >> $HGRCPATH <<'EOF'
+  > [extensions]
+  > setcount = $TESTTMP/setcount.py
+  > [alias]
+  > showcount = log -T "$COUNT\n" -r .
+  > EOF
+
+  $ COUNT=1 hg showcount
+  2
+
 This should show id:
 
   $ hg --config alias.log='id' log