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