##// END OF EJS Templates
keyword: cleanup test and make it portable...
Christian Ebert -
r11065:76d6c19a default
parent child Browse files
Show More
@@ -1,398 +1,396 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat <<EOF >> $HGRCPATH
3 cat <<EOF >> $HGRCPATH
4 [extensions]
4 [extensions]
5 keyword =
5 keyword =
6 mq =
6 mq =
7 notify =
7 notify =
8 record =
8 record =
9 transplant =
9 transplant =
10 [ui]
10 [ui]
11 interactive = true
11 interactive = true
12 EOF
12 EOF
13
13
14 # demo before [keyword] files are set up
14 # demo before [keyword] files are set up
15 # would succeed without uisetup otherwise
15 # would succeed without uisetup otherwise
16 echo % hg kwdemo
16 echo % hg kwdemo
17 hg --quiet kwdemo \
17 hg --quiet kwdemo \
18 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
18 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
19 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
19 -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
20 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
20 -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
21 -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!'
21 -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!'
22
22
23 hg --quiet kwdemo "Branch = {branches}"
23 hg --quiet kwdemo "Branch = {branches}"
24
24
25 cat <<EOF >> $HGRCPATH
25 cat <<EOF >> $HGRCPATH
26 [keyword]
26 [keyword]
27 ** =
27 ** =
28 b = ignore
28 b = ignore
29 [hooks]
29 [hooks]
30 commit=
30 commit=
31 commit.test=cp a hooktest
31 commit.test=cp a hooktest
32 EOF
32 EOF
33
33
34 hg init Test-bndl
34 hg init Test-bndl
35 cd Test-bndl
35 cd Test-bndl
36
36
37 echo % kwshrink should exit silently in empty/invalid repo
37 echo % kwshrink should exit silently in empty/invalid repo
38 hg kwshrink
38 hg kwshrink
39
39
40 # Symlinks cannot be created on Windows. The bundle was made with:
40 # Symlinks cannot be created on Windows. The bundle was made with:
41 #
41 #
42 # hg init t
42 # hg init t
43 # cd t
43 # cd t
44 # echo a > a
44 # echo a > a
45 # ln -s a sym
45 # ln -s a sym
46 # hg add sym
46 # hg add sym
47 # hg ci -m addsym -u mercurial
47 # hg ci -m addsym -u mercurial
48 # hg bundle --base null ../test-keyword.hg
48 # hg bundle --base null ../test-keyword.hg
49 #
49 #
50 hg pull -u "$TESTDIR/test-keyword.hg" \
50 hg pull -u "$TESTDIR/test-keyword.hg" \
51 | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
51 | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
52
52
53 echo 'expand $Id$' > a
53 echo 'expand $Id$' > a
54 echo 'do not process $Id:' >> a
54 echo 'do not process $Id:' >> a
55 echo 'xxx $' >> a
55 echo 'xxx $' >> a
56 echo 'ignore $Id$' > b
56 echo 'ignore $Id$' > b
57 echo % cat
57 echo % cat
58 cat a b
58 cat a b
59
59
60 echo % no kwfiles
60 echo % no kwfiles
61 hg kwfiles
61 hg kwfiles
62 echo % untracked candidates
62 echo % untracked candidates
63 hg -v kwfiles --unknown
63 hg -v kwfiles --unknown
64
64
65 echo % addremove
65 echo % addremove
66 hg addremove
66 hg addremove
67 echo % status
67 echo % status
68 hg status
68 hg status
69
69
70 echo % default keyword expansion including commit hook
70 echo % default keyword expansion including commit hook
71 echo % interrupted commit should not change state or run commit hook
71 echo % interrupted commit should not change state or run commit hook
72 hg --debug commit
72 hg --debug commit
73 echo % status
73 echo % status
74 hg status
74 hg status
75
75
76 echo % commit
76 echo % commit
77 hg --debug commit -mabsym -u 'User Name <user@example.com>'
77 hg --debug commit -mabsym -u 'User Name <user@example.com>'
78 echo % status
78 echo % status
79 hg status
79 hg status
80 echo % identify
80 echo % identify
81 hg debugrebuildstate
81 hg debugrebuildstate
82 hg --quiet identify
82 hg --quiet identify
83 echo % cat
83 echo % cat
84 cat a b
84 cat a b
85 echo % hg cat
85 echo % hg cat
86 hg cat sym a b
86 hg cat sym a b
87
87
88 echo
88 echo
89 echo % diff a hooktest
89 echo % diff a hooktest
90 diff a hooktest
90 diff a hooktest
91
91
92 echo % removing commit hook from config
92 echo % removing commit hook from config
93 sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
93 sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
94 mv "$HGRCPATH".nohook "$HGRCPATH"
94 mv "$HGRCPATH".nohook "$HGRCPATH"
95 rm hooktest
95 rm hooktest
96
96
97 echo % bundle
97 echo % bundle
98 hg bundle --base null ../kw.hg
98 hg bundle --base null ../kw.hg
99
99
100 cd ..
100 cd ..
101 hg init Test
101 hg init Test
102 cd Test
102 cd Test
103
103
104 echo % notify on pull to check whether keywords stay as is in email
104 echo % notify on pull to check whether keywords stay as is in email
105 echo % ie. if patch.diff wrapper acts as it should
105 echo % ie. if patch.diff wrapper acts as it should
106
106
107 cat <<EOF >> $HGRCPATH
107 cat <<EOF >> $HGRCPATH
108 [hooks]
108 [hooks]
109 incoming.notify = python:hgext.notify.hook
109 incoming.notify = python:hgext.notify.hook
110 [notify]
110 [notify]
111 sources = pull
111 sources = pull
112 diffstat = False
112 diffstat = False
113 [reposubs]
113 [reposubs]
114 * = Test
114 * = Test
115 EOF
115 EOF
116
116
117 echo % pull from bundle
117 echo % pull from bundle
118 hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
118 hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
119
119
120 echo % remove notify config
120 echo % remove notify config
121 sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
121 sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
122 mv "$HGRCPATH".nonotify "$HGRCPATH"
122 mv "$HGRCPATH".nonotify "$HGRCPATH"
123
123
124 echo % touch
124 echo % touch
125 touch a b
125 touch a b
126 echo % status
126 echo % status
127 hg status
127 hg status
128
128
129 rm sym a b
129 rm sym a b
130 echo % update
130 echo % update
131 hg update -C
131 hg update -C
132 echo % cat
132 echo % cat
133 cat a b
133 cat a b
134
134
135 echo % check whether expansion is filewise
135 echo % check whether expansion is filewise
136 echo '$Id$' > c
136 echo '$Id$' > c
137 echo 'tests for different changenodes' >> c
137 echo 'tests for different changenodes' >> c
138 echo % commit c
138 echo % commit c
139 hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
139 hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
140 echo % force expansion
140 echo % force expansion
141 hg -v kwexpand
141 hg -v kwexpand
142 echo % compare changenodes in a c
142 echo % compare changenodes in a c
143 cat a c
143 cat a c
144
144
145 echo % record
145 echo % record
146 cp "$HGRCPATH" $HGRCPATH.bak
146 python -c \
147 sed -e '1 a \foo' a > a.tmp
147 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
148 mv a.tmp a
149 echo bar >> a
150 hg record -d '1 10' -m rectest<<EOF
148 hg record -d '1 10' -m rectest<<EOF
151 y
149 y
152 y
150 y
153 n
151 n
154 EOF
152 EOF
155 echo
153 echo
156 hg identify
154 hg identify
157 hg status
155 hg status
158 echo % cat modified file
156 echo % cat modified file
159 cat a
157 cat a
160 hg diff | grep -v 'b/a'
158 hg diff | grep -v 'b/a'
161 hg rollback
159 hg rollback
162 hg update -C
160 hg update -C
163
161
164 echo % init --mq
162 echo % init --mq
165 hg init --mq
163 hg init --mq
166 echo % qimport
164 echo % qimport
167 hg qimport -r tip -n mqtest.diff
165 hg qimport -r tip -n mqtest.diff
168 echo % commit --mq
166 echo % commit --mq
169 hg commit --mq -m mqtest
167 hg commit --mq -m mqtest
170 echo % keywords should not be expanded in patch
168 echo % keywords should not be expanded in patch
171 cat .hg/patches/mqtest.diff
169 cat .hg/patches/mqtest.diff
172 echo % qpop
170 echo % qpop
173 hg qpop
171 hg qpop
174 echo % qgoto - should imply qpush
172 echo % qgoto - should imply qpush
175 hg qgoto mqtest.diff
173 hg qgoto mqtest.diff
176 echo % cat
174 echo % cat
177 cat c
175 cat c
178 echo % hg cat
176 echo % hg cat
179 hg cat c
177 hg cat c
180 echo % keyword should not be expanded in filelog
178 echo % keyword should not be expanded in filelog
181 hg --config 'extensions.keyword=!' cat c
179 hg --config 'extensions.keyword=!' cat c
182 echo % qpop and move on
180 echo % qpop and move on
183 hg qpop
181 hg qpop
184
182
185 echo % copy
183 echo % copy
186 hg cp a c
184 hg cp a c
187
185
188 echo % kwfiles added
186 echo % kwfiles added
189 hg kwfiles
187 hg kwfiles
190
188
191 echo % commit
189 echo % commit
192 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
190 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
193 echo % cat a c
191 echo % cat a c
194 cat a c
192 cat a c
195 echo % touch copied c
193 echo % touch copied c
196 touch c
194 touch c
197 echo % status
195 echo % status
198 hg status
196 hg status
199
197
200 echo % kwfiles
198 echo % kwfiles
201 hg kwfiles
199 hg kwfiles
202 echo % ignored files
200 echo % ignored files
203 hg -v kwfiles --ignore
201 hg -v kwfiles --ignore
204 echo % all files
202 echo % all files
205 hg kwfiles --all
203 hg kwfiles --all
206
204
207 echo % diff --rev
205 echo % diff --rev
208 hg diff --rev 1 | grep -v 'b/c'
206 hg diff --rev 1 | grep -v 'b/c'
209
207
210 echo % rollback
208 echo % rollback
211 hg rollback
209 hg rollback
212 echo % status
210 echo % status
213 hg status
211 hg status
214 echo % update -C
212 echo % update -C
215 hg update --clean
213 hg update --clean
216
214
217 echo % custom keyword expansion
215 echo % custom keyword expansion
218 echo % try with kwdemo
216 echo % try with kwdemo
219 hg --quiet kwdemo "Xinfo = {author}: {desc}"
217 hg --quiet kwdemo "Xinfo = {author}: {desc}"
220
218
221 cat <<EOF >>$HGRCPATH
219 cat <<EOF >>$HGRCPATH
222 [keywordmaps]
220 [keywordmaps]
223 Id = {file} {node|short} {date|rfc822date} {author|user}
221 Id = {file} {node|short} {date|rfc822date} {author|user}
224 Xinfo = {author}: {desc}
222 Xinfo = {author}: {desc}
225 EOF
223 EOF
226
224
227 echo % cat
225 echo % cat
228 cat a b
226 cat a b
229 echo % hg cat
227 echo % hg cat
230 hg cat sym a b
228 hg cat sym a b
231
229
232 echo
230 echo
233 echo '$Xinfo$' >> a
231 echo '$Xinfo$' >> a
234 cat <<EOF >> log
232 cat <<EOF >> log
235 firstline
233 firstline
236 secondline
234 secondline
237 EOF
235 EOF
238
236
239 echo % interrupted commit should not change state
237 echo % interrupted commit should not change state
240 hg commit
238 hg commit
241 echo % status
239 echo % status
242 hg status
240 hg status
243
241
244 echo % commit
242 echo % commit
245 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
243 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
246 rm log
244 rm log
247 echo % status
245 echo % status
248 hg status
246 hg status
249 echo % verify
247 echo % verify
250 hg verify
248 hg verify
251
249
252 echo % cat
250 echo % cat
253 cat a b
251 cat a b
254 echo % hg cat
252 echo % hg cat
255 hg cat sym a b
253 hg cat sym a b
256 echo
254 echo
257 echo % annotate
255 echo % annotate
258 hg annotate a
256 hg annotate a
259
257
260 echo % remove
258 echo % remove
261 hg debugrebuildstate
259 hg debugrebuildstate
262 hg remove a
260 hg remove a
263 hg --debug commit -m rma
261 hg --debug commit -m rma
264 echo % status
262 echo % status
265 hg status
263 hg status
266 echo % rollback
264 echo % rollback
267 hg rollback
265 hg rollback
268 echo % status
266 echo % status
269 hg status
267 hg status
270 echo % revert a
268 echo % revert a
271 hg revert --no-backup --rev tip a
269 hg revert --no-backup --rev tip a
272 echo % cat a
270 echo % cat a
273 cat a
271 cat a
274
272
275 echo % clone to test incoming
273 echo % clone to test incoming
276 cd ..
274 cd ..
277 hg clone -r1 Test Test-a
275 hg clone -r1 Test Test-a
278 cd Test-a
276 cd Test-a
279 cat <<EOF >> .hg/hgrc
277 cat <<EOF >> .hg/hgrc
280 [paths]
278 [paths]
281 default = ../Test
279 default = ../Test
282 EOF
280 EOF
283 echo % incoming
281 echo % incoming
284 # remove path to temp dir
282 # remove path to temp dir
285 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
283 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
286
284
287 sed -e 's/Id.*/& rejecttest/' a > a.new
285 sed -e 's/Id.*/& rejecttest/' a > a.new
288 mv a.new a
286 mv a.new a
289 echo % commit rejecttest
287 echo % commit rejecttest
290 hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
288 hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
291 echo % export
289 echo % export
292 hg export -o ../rejecttest.diff tip
290 hg export -o ../rejecttest.diff tip
293
291
294 cd ../Test
292 cd ../Test
295 echo % import
293 echo % import
296 hg import ../rejecttest.diff
294 hg import ../rejecttest.diff
297 echo % cat
295 echo % cat
298 cat a b
296 cat a b
299 echo
297 echo
300 echo % rollback
298 echo % rollback
301 hg rollback
299 hg rollback
302 echo % clean update
300 echo % clean update
303 hg update --clean
301 hg update --clean
304
302
305 echo % kwexpand/kwshrink on selected files
303 echo % kwexpand/kwshrink on selected files
306 mkdir x
304 mkdir x
307 echo % copy a x/a
305 echo % copy a x/a
308 hg copy a x/a
306 hg copy a x/a
309 echo % kwexpand a
307 echo % kwexpand a
310 hg --verbose kwexpand a
308 hg --verbose kwexpand a
311 echo % kwexpand x/a should abort
309 echo % kwexpand x/a should abort
312 hg --verbose kwexpand x/a
310 hg --verbose kwexpand x/a
313 cd x
311 cd x
314 hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
312 hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
315 echo % cat a
313 echo % cat a
316 cat a
314 cat a
317 echo % kwshrink a inside directory x
315 echo % kwshrink a inside directory x
318 hg --verbose kwshrink a
316 hg --verbose kwshrink a
319 echo % cat a
317 echo % cat a
320 cat a
318 cat a
321 cd ..
319 cd ..
322
320
323 echo % kwexpand nonexistent
321 echo % kwexpand nonexistent
324 hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
322 hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
325
323
326 echo % hg serve
324 echo % hg serve
327 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
325 hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
328 cat hg.pid >> $DAEMON_PIDS
326 cat hg.pid >> $DAEMON_PIDS
329 echo % expansion
327 echo % expansion
330 echo % hgweb file
328 echo % hgweb file
331 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
329 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
332 echo % no expansion
330 echo % no expansion
333 echo % hgweb annotate
331 echo % hgweb annotate
334 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
332 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
335 echo % hgweb changeset
333 echo % hgweb changeset
336 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
334 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
337 echo % hgweb filediff
335 echo % hgweb filediff
338 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
336 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
339 echo % errors encountered
337 echo % errors encountered
340 cat errors.log
338 cat errors.log
341
339
342 echo % merge/resolve
340 echo % merge/resolve
343 echo '$Id$' > m
341 echo '$Id$' > m
344 hg add m
342 hg add m
345 hg commit -m 4kw
343 hg commit -m 4kw
346 echo foo >> m
344 echo foo >> m
347 hg commit -m 5foo
345 hg commit -m 5foo
348 echo % simplemerge
346 echo % simplemerge
349 hg update 4
347 hg update 4
350 echo foo >> m
348 echo foo >> m
351 hg commit -m 6foo
349 hg commit -m 6foo
352 hg merge
350 hg merge
353 hg commit -m simplemerge
351 hg commit -m simplemerge
354 cat m
352 cat m
355 echo % conflict
353 echo % conflict
356 hg update 4
354 hg update 4
357 echo bar >> m
355 echo bar >> m
358 hg commit -m 8bar
356 hg commit -m 8bar
359 hg merge
357 hg merge
360 echo % keyword stays outside conflict zone
358 echo % keyword stays outside conflict zone
361 cat m
359 cat m
362 echo % resolve to local
360 echo % resolve to local
363 HGMERGE=internal:local hg resolve -a
361 HGMERGE=internal:local hg resolve -a
364 hg commit -m localresolve
362 hg commit -m localresolve
365 cat m
363 cat m
366
364
367 echo % test restricted mode with transplant -b
365 echo % test restricted mode with transplant -b
368 hg update 6
366 hg update 6
369 hg branch foo
367 hg branch foo
370 mv a a.bak
368 mv a a.bak
371 echo foobranch > a
369 echo foobranch > a
372 cat a.bak >> a
370 cat a.bak >> a
373 rm a.bak
371 rm a.bak
374 hg commit -m 9foobranch
372 hg commit -m 9foobranch
375 hg update default
373 hg update default
376 hg -y transplant -b foo tip
374 hg -y transplant -b foo tip
377 echo % no expansion in changeset
375 echo % no expansion in changeset
378 hg tip -p
376 hg tip -p
379 echo % expansion in file
377 echo % expansion in file
380 head -n 2 a
378 head -n 2 a
381 hg -q rollback
379 hg -q rollback
382 hg -q update -C
380 hg -q update -C
383
381
384 echo % switch off expansion
382 echo % switch off expansion
385 echo % kwshrink with unknown file u
383 echo % kwshrink with unknown file u
386 cp a u
384 cp a u
387 hg --verbose kwshrink
385 hg --verbose kwshrink
388 echo % cat
386 echo % cat
389 cat a b
387 cat a b
390 echo % hg cat
388 echo % hg cat
391 hg cat sym a b
389 hg cat sym a b
392 echo
390 echo
393 rm "$HGRCPATH"
391 rm "$HGRCPATH"
394 echo % cat
392 echo % cat
395 cat a b
393 cat a b
396 echo % hg cat
394 echo % hg cat
397 hg cat sym a b
395 hg cat sym a b
398 echo
396 echo
General Comments 0
You need to be logged in to leave comments. Login now