Mercurial > hg
annotate tests/test-share.t @ 20661:7e627fe63e5e stable
templater: avoid recursive evaluation of string literals completely
Changeset 3d8bfe2ecf6d (released with 2.8.1) fixed "recursively
evaluate string literals as templates" problem (issue4103) by
introducing "_evalifliteral()".
But some parts in template expressions below are still processed by
the combination of "compiletemplate()" and "runtemplate()", and may
cause same problem unexpectedly.
- 'init' and 'hang' of 'fill(text, width, init, hang)'
- 'expr' of 'sub(pat, repl, expr)'
- 'label' of 'label(label, expr)'
This patch processes them by "_evalifliteral()" instead of the
combination of "compiletemplate()" and "runtemplate()" to avoid
recursive evaluation of string literals completely.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 10 Mar 2014 01:01:42 +0900 |
parents | bc7377160fa7 |
children | 7a9cbb315d84 |
rev | line source |
---|---|
17539
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
1 $ "$TESTDIR/hghave" killdaemons || exit 80 |
9990 | 2 |
12487 | 3 $ echo "[extensions]" >> $HGRCPATH |
4 $ echo "share = " >> $HGRCPATH | |
5 | |
6 prepare repo1 | |
9990 | 7 |
12487 | 8 $ hg init repo1 |
9 $ cd repo1 | |
10 $ echo a > a | |
11 $ hg commit -A -m'init' | |
12 adding a | |
13 | |
14 share it | |
9990 | 15 |
12487 | 16 $ cd .. |
17 $ hg share repo1 repo2 | |
18 updating working directory | |
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 | |
21 share shouldn't have a store dir | |
22 | |
23 $ cd repo2 | |
24 $ test -d .hg/store | |
25 [1] | |
9990 | 26 |
12487 | 27 Some sed versions appends newline, some don't, and some just fails |
28 | |
29 $ cat .hg/sharedpath; echo | |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
30 $TESTTMP/repo1/.hg (glob) |
12487 | 31 |
15101
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
32 trailing newline on .hg/sharedpath is ok |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
33 $ hg tip -q |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
34 0:d3873e73d99e |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
35 $ echo '' >> .hg/sharedpath |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
36 $ cat .hg/sharedpath |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
37 $TESTTMP/repo1/.hg (glob) |
15101
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
38 $ hg tip -q |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
39 0:d3873e73d99e |
a21ccf4412d5
share: allow trailing newline on .hg/sharedpath.
Greg Ward <greg@gerg.ca>
parents:
15080
diff
changeset
|
40 |
12487 | 41 commit in shared clone |
42 | |
43 $ echo a >> a | |
44 $ hg commit -m'change in shared clone' | |
45 | |
46 check original | |
9990 | 47 |
12487 | 48 $ cd ../repo1 |
49 $ hg log | |
50 changeset: 1:8af4dc49db9e | |
51 tag: tip | |
52 user: test | |
53 date: Thu Jan 01 00:00:00 1970 +0000 | |
54 summary: change in shared clone | |
55 | |
56 changeset: 0:d3873e73d99e | |
57 user: test | |
58 date: Thu Jan 01 00:00:00 1970 +0000 | |
59 summary: init | |
60 | |
61 $ hg update | |
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
63 $ cat a # should be two lines of "a" | |
64 a | |
65 a | |
9990 | 66 |
12487 | 67 commit in original |
68 | |
69 $ echo b > b | |
70 $ hg commit -A -m'another file' | |
71 adding b | |
72 | |
73 check in shared clone | |
9990 | 74 |
12487 | 75 $ cd ../repo2 |
76 $ hg log | |
77 changeset: 2:c2e0ac586386 | |
78 tag: tip | |
79 user: test | |
80 date: Thu Jan 01 00:00:00 1970 +0000 | |
81 summary: another file | |
82 | |
83 changeset: 1:8af4dc49db9e | |
84 user: test | |
85 date: Thu Jan 01 00:00:00 1970 +0000 | |
86 summary: change in shared clone | |
87 | |
88 changeset: 0:d3873e73d99e | |
89 user: test | |
90 date: Thu Jan 01 00:00:00 1970 +0000 | |
91 summary: init | |
92 | |
93 $ hg update | |
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
95 $ cat b # should exist with one "b" | |
96 b | |
9990 | 97 |
12487 | 98 hg serve shared clone |
9990 | 99 |
12487 | 100 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid |
101 $ cat hg.pid >> $DAEMON_PIDS | |
17017
953faba28e91
tests: prepare get-with-headers.py for MSYS
Mads Kiilerich <mads@kiilerich.com>
parents:
16913
diff
changeset
|
102 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'raw-file/' |
12487 | 103 200 Script output follows |
104 | |
105 | |
106 -rw-r--r-- 4 a | |
107 -rw-r--r-- 2 b | |
108 | |
109 | |
15080
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
110 |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
111 test unshare command |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
112 |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
113 $ hg unshare |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
114 $ test -d .hg/store |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
115 $ test -f .hg/sharedpath |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
116 [1] |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
117 $ hg unshare |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
118 abort: this is not a shared repo |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
119 [255] |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
120 |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
121 check that a change does not propagate |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
122 |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
123 $ echo b >> b |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
124 $ hg commit -m'change in unshared' |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
125 $ cd ../repo1 |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
126 $ hg id -r tip |
574dc5d74f9b
test: test unshare command
Simon Heimberg <simohe@besonet.ch>
parents:
12640
diff
changeset
|
127 c2e0ac586386 tip |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
128 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
129 $ cd .. |
17539
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
130 |
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
131 Explicitly kill daemons to let the test exit on Windows |
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
132 |
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
133 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
bc7377160fa7
tests: enable more server tests on Windows
Patrick Mezard <patrick@mezard.eu>
parents:
17017
diff
changeset
|
134 |