author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
Thu, 14 Feb 2008 18:08:16 -0200 | |
changeset 6108 | 5086576a2152 |
parent 6061 | de08788511d7 |
child 6116 | e27f39865d7e |
permissions | -rwxr-xr-x |
5816 | 1 |
#!/bin/sh |
2 |
||
3 |
cat <<EOF >> $HGRCPATH |
|
4 |
[extensions] |
|
5 |
hgext.keyword = |
|
5894
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
6 |
hgext.mq = |
5816 | 7 |
[keyword] |
8 |
* = |
|
9 |
b = ignore |
|
10 |
[hooks] |
|
11 |
commit= |
|
12 |
commit.test=cp a hooktest |
|
13 |
EOF |
|
14 |
||
15 |
echo % help |
|
16 |
hg help keyword |
|
17 |
||
18 |
echo % hg kwdemo |
|
19 |
hg --quiet kwdemo --default \ |
|
20 |
| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \ |
|
21 |
-e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \ |
|
22 |
-e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \ |
|
23 |
-e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!' |
|
24 |
||
25 |
hg --quiet kwdemo "Branch = {branches}" |
|
26 |
||
6051
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
27 |
hg init Test-bndl |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
28 |
cd Test-bndl |
5816 | 29 |
|
30 |
echo % kwshrink should exit silently in empty/invalid repo |
|
31 |
hg kwshrink |
|
32 |
||
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
33 |
# Symlinks cannot be created on Windows. The bundle was made with: |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
34 |
# |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
35 |
# hg init t |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
36 |
# cd t |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
37 |
# echo a > a |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
38 |
# ln -s a sym |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
39 |
# hg add sym |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
40 |
# hg ci -m addsym -u mercurial |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
41 |
# hg bundle --base null ../test-keyword.hg |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
42 |
# |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
43 |
hg pull -u "$TESTDIR/test-keyword.hg" \ |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
44 |
| sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/' |
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
45 |
|
5816 | 46 |
echo 'expand $Id$' > a |
47 |
echo 'do not process $Id:' >> a |
|
48 |
echo 'xxx $' >> a |
|
49 |
echo 'ignore $Id$' > b |
|
50 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
51 |
cat a b |
5816 | 52 |
|
53 |
echo % addremove |
|
54 |
hg addremove |
|
55 |
echo % status |
|
56 |
hg status |
|
57 |
||
58 |
echo % default keyword expansion including commit hook |
|
59 |
echo % interrupted commit should not change state or run commit hook |
|
5855
a6ccb957fd07
Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5839
diff
changeset
|
60 |
hg --debug commit |
5816 | 61 |
echo % status |
62 |
hg status |
|
63 |
||
64 |
echo % commit |
|
65 |
hg --debug commit -mabsym -d '0 0' -u 'User Name <user@example.com>' |
|
66 |
echo % status |
|
67 |
hg status |
|
68 |
echo % identify |
|
69 |
hg --quiet identify |
|
70 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
71 |
cat a b |
5816 | 72 |
echo % hg cat |
73 |
hg cat sym a b |
|
74 |
||
75 |
echo |
|
76 |
echo % diff a hooktest |
|
77 |
diff a hooktest |
|
78 |
||
79 |
echo % removing commit hook from config |
|
80 |
sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook |
|
81 |
mv $HGRCPATH.nohook $HGRCPATH |
|
82 |
rm hooktest |
|
83 |
||
6051
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
84 |
echo % bundle |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
85 |
hg bundle --base null ../kw.hg |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
86 |
|
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
87 |
cd .. |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
88 |
hg init Test |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
89 |
cd Test |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
90 |
|
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
91 |
echo % pull from bundle |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
92 |
hg pull -u ../kw.hg |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
93 |
|
5816 | 94 |
echo % touch |
95 |
touch a b |
|
96 |
echo % status |
|
97 |
hg status |
|
98 |
||
99 |
rm sym a b |
|
100 |
echo % update |
|
101 |
hg update |
|
102 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
103 |
cat a b |
5816 | 104 |
|
5856
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
105 |
echo % check whether expansion is filewise |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
106 |
echo '$Id$' > c |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
107 |
echo 'tests for different changenodes' >> c |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
108 |
echo % commit c |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
109 |
hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>' |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
110 |
echo % force expansion |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
111 |
hg -v kwexpand |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
112 |
echo % compare changenodes in a c |
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
113 |
cat a c |
5894
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
114 |
|
6051
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
115 |
echo % qinit -c |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
116 |
hg qinit -c |
5894
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
117 |
echo % qimport |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
118 |
hg qimport -r tip -n mqtest.diff |
6051
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
119 |
echo % qcommit |
1038b1458d7a
keyword: safeguards against erroneous behaviour or aborts
Christian Ebert <blacktrash@gmx.net>
parents:
5894
diff
changeset
|
120 |
hg qcommit -mqtest |
5894
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
121 |
echo % keywords should not be expanded in patch |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
122 |
cat .hg/patches/mqtest.diff |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
123 |
echo % qpop |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
124 |
hg qpop |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
125 |
echo % qgoto - should imply qpush |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
126 |
hg qgoto mqtest.diff |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
127 |
echo % cat |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
128 |
cat c |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
129 |
echo % qpop and move on |
e181665c1c79
keyword: add very simple mq test
Christian Ebert <blacktrash@gmx.net>
parents:
5856
diff
changeset
|
130 |
hg qpop |
5856
85888efbdfff
keyword: test that expansion is done filewise
Christian Ebert <blacktrash@gmx.net>
parents:
5855
diff
changeset
|
131 |
|
5816 | 132 |
echo % copy |
133 |
hg cp a c |
|
134 |
||
135 |
echo % kwfiles added |
|
136 |
hg kwfiles |
|
137 |
||
138 |
echo % commit |
|
139 |
hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>' |
|
140 |
echo % cat a c |
|
141 |
cat a c |
|
142 |
echo % touch copied c after 1 second |
|
143 |
sleep 1 |
|
144 |
touch c |
|
145 |
echo % status |
|
146 |
hg status |
|
147 |
||
148 |
echo % kwfiles |
|
149 |
hg kwfiles |
|
150 |
||
151 |
echo % diff --rev |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
152 |
hg diff --rev 1 | grep -v 'b/c' |
5816 | 153 |
|
154 |
echo % rollback |
|
155 |
hg rollback |
|
156 |
echo % status |
|
157 |
hg status |
|
158 |
echo % update -C |
|
159 |
hg update --clean |
|
160 |
||
161 |
echo % custom keyword expansion |
|
162 |
echo % try with kwdemo |
|
163 |
hg --quiet kwdemo "Xinfo = {author}: {desc}" |
|
164 |
||
165 |
cat <<EOF >>$HGRCPATH |
|
166 |
[keywordmaps] |
|
167 |
Id = {file} {node|short} {date|rfc822date} {author|user} |
|
168 |
Xinfo = {author}: {desc} |
|
169 |
EOF |
|
170 |
||
171 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
172 |
cat a b |
5816 | 173 |
echo % hg cat |
174 |
hg cat sym a b |
|
175 |
||
176 |
echo |
|
177 |
echo '$Xinfo$' >> a |
|
178 |
cat <<EOF >> log |
|
179 |
firstline |
|
180 |
secondline |
|
181 |
EOF |
|
182 |
||
183 |
echo % interrupted commit should not change state |
|
5855
a6ccb957fd07
Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5839
diff
changeset
|
184 |
hg commit |
5816 | 185 |
echo % status |
186 |
hg status |
|
187 |
||
188 |
echo % commit |
|
189 |
hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>' |
|
190 |
rm log |
|
191 |
echo % status |
|
192 |
hg status |
|
193 |
||
194 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
195 |
cat a b |
5816 | 196 |
echo % hg cat |
197 |
hg cat sym a b |
|
198 |
echo |
|
199 |
||
200 |
echo % remove |
|
201 |
hg remove a |
|
202 |
hg --debug commit -m rma |
|
203 |
echo % status |
|
204 |
hg status |
|
205 |
echo % rollback |
|
206 |
hg rollback |
|
207 |
echo % status |
|
208 |
hg status |
|
209 |
echo % revert a |
|
210 |
hg revert --no-backup --rev tip a |
|
211 |
echo % cat a |
|
212 |
cat a |
|
213 |
||
214 |
echo % clone to test incoming |
|
215 |
cd .. |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
216 |
hg clone -r1 Test Test-a |
5816 | 217 |
cd Test-a |
218 |
cat <<EOF >> .hg/hgrc |
|
219 |
[paths] |
|
220 |
default = ../Test |
|
221 |
EOF |
|
222 |
echo % incoming |
|
223 |
# remove path to temp dir |
|
224 |
hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/' |
|
225 |
||
5839
59fba5caa94b
Don't use the -i option with sed
Will Maier <willmaier@ml1.net>
parents:
5816
diff
changeset
|
226 |
sed -e 's/Id.*/& rejecttest/' a > a.new |
59fba5caa94b
Don't use the -i option with sed
Will Maier <willmaier@ml1.net>
parents:
5816
diff
changeset
|
227 |
mv a.new a |
5816 | 228 |
echo % commit rejecttest |
229 |
hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>' |
|
230 |
echo % export |
|
231 |
hg export -o ../rejecttest.diff tip |
|
232 |
||
233 |
cd ../Test |
|
234 |
echo % import |
|
235 |
hg import ../rejecttest.diff |
|
236 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
237 |
cat a b |
5816 | 238 |
echo |
239 |
echo % rollback |
|
240 |
hg rollback |
|
241 |
echo % clean update |
|
242 |
hg update --clean |
|
243 |
||
244 |
echo % kwexpand/kwshrink on selected files |
|
245 |
mkdir x |
|
246 |
echo % copy a x/a |
|
247 |
hg copy a x/a |
|
248 |
echo % kwexpand a |
|
249 |
hg --verbose kwexpand a |
|
250 |
echo % kwexpand x/a should abort |
|
251 |
hg --verbose kwexpand x/a |
|
252 |
cd x |
|
253 |
hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>' |
|
254 |
echo % cat a |
|
255 |
cat a |
|
256 |
echo % kwshrink a inside directory x |
|
257 |
hg --verbose kwshrink a |
|
258 |
echo % cat a |
|
259 |
cat a |
|
5855
a6ccb957fd07
Solaris compatibility fixes for test-keyword:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5839
diff
changeset
|
260 |
cd .. |
5816 | 261 |
|
262 |
echo % kwexpand nonexistent |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
263 |
hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/' |
5816 | 264 |
|
265 |
echo % switch off expansion |
|
266 |
echo % kwshrink with unknown file u |
|
267 |
cp a u |
|
268 |
hg --verbose kwshrink |
|
269 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
270 |
cat a b |
5816 | 271 |
echo % hg cat |
272 |
hg cat sym a b |
|
273 |
echo |
|
274 |
rm $HGRCPATH |
|
275 |
echo % cat |
|
6061
de08788511d7
test-keyword: make it run under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6051
diff
changeset
|
276 |
cat a b |
5816 | 277 |
echo % hg cat |
278 |
hg cat sym a b |
|
279 |
echo |