##// END OF EJS Templates
Fix bashism and remove useless use of cat.
Thomas Arendsen Hein -
r5027:17d71a79 default
parent child Browse files
Show More
@@ -1,430 +1,430 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 echo "[extensions]" >> $HGRCPATH
3 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
5
5
6 echo % help
6 echo % help
7 hg help mq
7 hg help mq
8
8
9 hg init a
9 hg init a
10 cd a
10 cd a
11 echo a > a
11 echo a > a
12 hg ci -Ama
12 hg ci -Ama
13
13
14 hg clone . ../k
14 hg clone . ../k
15
15
16 mkdir b
16 mkdir b
17 echo z > b/z
17 echo z > b/z
18 hg ci -Ama
18 hg ci -Ama
19
19
20 echo % qinit
20 echo % qinit
21
21
22 hg qinit
22 hg qinit
23
23
24 cd ..
24 cd ..
25 hg init b
25 hg init b
26
26
27 echo % -R qinit
27 echo % -R qinit
28
28
29 hg -R b qinit
29 hg -R b qinit
30
30
31 hg init c
31 hg init c
32
32
33 echo % qinit -c
33 echo % qinit -c
34
34
35 hg --cwd c qinit -c
35 hg --cwd c qinit -c
36 hg -R c/.hg/patches st
36 hg -R c/.hg/patches st
37
37
38 echo % qnew implies add
38 echo % qnew implies add
39
39
40 hg -R c qnew test.patch
40 hg -R c qnew test.patch
41 hg -R c/.hg/patches st
41 hg -R c/.hg/patches st
42
42
43 echo '% qinit; qinit -c'
43 echo '% qinit; qinit -c'
44 hg init d
44 hg init d
45 cd d
45 cd d
46 hg qinit
46 hg qinit
47 hg qinit -c
47 hg qinit -c
48 # qinit -c should create both files if they don't exist
48 # qinit -c should create both files if they don't exist
49 echo ' .hgignore:'
49 echo ' .hgignore:'
50 cat .hg/patches/.hgignore
50 cat .hg/patches/.hgignore
51 echo ' series:'
51 echo ' series:'
52 cat .hg/patches/series
52 cat .hg/patches/series
53 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
53 hg qinit -c 2>&1 | sed -e 's/repository.*already/repository already/'
54 cd ..
54 cd ..
55
55
56 echo '% qinit; <stuff>; qinit -c'
56 echo '% qinit; <stuff>; qinit -c'
57 hg init e
57 hg init e
58 cd e
58 cd e
59 hg qnew A
59 hg qnew A
60 echo foo > foo
60 echo foo > foo
61 hg add foo
61 hg add foo
62 hg qrefresh
62 hg qrefresh
63 hg qnew B
63 hg qnew B
64 echo >> foo
64 echo >> foo
65 hg qrefresh
65 hg qrefresh
66 echo status >> .hg/patches/.hgignore
66 echo status >> .hg/patches/.hgignore
67 echo bleh >> .hg/patches/.hgignore
67 echo bleh >> .hg/patches/.hgignore
68 hg qinit -c
68 hg qinit -c
69 hg -R .hg/patches status
69 hg -R .hg/patches status
70 # qinit -c shouldn't touch these files if they already exist
70 # qinit -c shouldn't touch these files if they already exist
71 echo ' .hgignore:'
71 echo ' .hgignore:'
72 cat .hg/patches/.hgignore
72 cat .hg/patches/.hgignore
73 echo ' series:'
73 echo ' series:'
74 cat .hg/patches/series
74 cat .hg/patches/series
75 cd ..
75 cd ..
76
76
77 cd a
77 cd a
78
78
79 echo % qnew -m
79 echo % qnew -m
80
80
81 hg qnew -m 'foo bar' test.patch
81 hg qnew -m 'foo bar' test.patch
82 cat .hg/patches/test.patch
82 cat .hg/patches/test.patch
83
83
84 echo % qrefresh
84 echo % qrefresh
85
85
86 echo a >> a
86 echo a >> a
87 hg qrefresh
87 hg qrefresh
88 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
88 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
89 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
89 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
90 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
90 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
91
91
92 echo % empty qrefresh
92 echo % empty qrefresh
93
93
94 hg qrefresh -X a
94 hg qrefresh -X a
95 echo 'revision:'
95 echo 'revision:'
96 hg diff -r -2 -r -1
96 hg diff -r -2 -r -1
97 echo 'patch:'
97 echo 'patch:'
98 cat .hg/patches/test.patch
98 cat .hg/patches/test.patch
99 echo 'working dir diff:'
99 echo 'working dir diff:'
100 hg diff --nodates -q
100 hg diff --nodates -q
101 # restore things
101 # restore things
102 hg qrefresh
102 hg qrefresh
103
103
104 echo % qpop
104 echo % qpop
105
105
106 hg qpop
106 hg qpop
107
107
108 echo % qpush
108 echo % qpush
109
109
110 hg qpush
110 hg qpush
111
111
112 cd ..
112 cd ..
113
113
114 echo % pop/push outside repo
114 echo % pop/push outside repo
115
115
116 hg -R a qpop
116 hg -R a qpop
117 hg -R a qpush
117 hg -R a qpush
118
118
119 cd a
119 cd a
120 hg qnew test2.patch
120 hg qnew test2.patch
121
121
122 echo % qrefresh in subdir
122 echo % qrefresh in subdir
123
123
124 cd b
124 cd b
125 echo a > a
125 echo a > a
126 hg add a
126 hg add a
127 hg qrefresh
127 hg qrefresh
128
128
129 echo % pop/push -a in subdir
129 echo % pop/push -a in subdir
130
130
131 hg qpop -a
131 hg qpop -a
132 hg --traceback qpush -a
132 hg --traceback qpush -a
133
133
134 echo % qseries
134 echo % qseries
135 hg qseries
135 hg qseries
136 hg qpop
136 hg qpop
137 hg qseries -vs
137 hg qseries -vs
138 hg qpush
138 hg qpush
139
139
140 echo % qapplied
140 echo % qapplied
141 hg qapplied
141 hg qapplied
142
142
143 echo % qtop
143 echo % qtop
144 hg qtop
144 hg qtop
145
145
146 echo % qprev
146 echo % qprev
147 hg qprev
147 hg qprev
148
148
149 echo % qnext
149 echo % qnext
150 hg qnext
150 hg qnext
151
151
152 echo % pop, qnext, qprev, qapplied
152 echo % pop, qnext, qprev, qapplied
153 hg qpop
153 hg qpop
154 hg qnext
154 hg qnext
155 hg qprev
155 hg qprev
156 hg qapplied
156 hg qapplied
157
157
158 echo % commit should fail
158 echo % commit should fail
159 hg commit
159 hg commit
160
160
161 echo % push should fail
161 echo % push should fail
162 hg push ../../k
162 hg push ../../k
163
163
164 echo % qunapplied
164 echo % qunapplied
165 hg qunapplied
165 hg qunapplied
166
166
167 echo % qpush/qpop with index
167 echo % qpush/qpop with index
168 hg qnew test1b.patch
168 hg qnew test1b.patch
169 echo 1b > 1b
169 echo 1b > 1b
170 hg add 1b
170 hg add 1b
171 hg qrefresh
171 hg qrefresh
172 hg qpush 2
172 hg qpush 2
173 hg qpop 0
173 hg qpop 0
174 hg qpush test.patch+1
174 hg qpush test.patch+1
175 hg qpush test.patch+2
175 hg qpush test.patch+2
176 hg qpop test2.patch-1
176 hg qpop test2.patch-1
177 hg qpop test2.patch-2
177 hg qpop test2.patch-2
178 hg qpush test1b.patch+1
178 hg qpush test1b.patch+1
179
179
180 echo % push should succeed
180 echo % push should succeed
181 hg qpop -a
181 hg qpop -a
182 hg push ../../k
182 hg push ../../k
183
183
184 echo % qpush/qpop error codes
184 echo % qpush/qpop error codes
185 errorcode()
185 errorcode()
186 {
186 {
187 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
187 hg "$@" && echo " $@ succeeds" || echo " $@ fails"
188 }
188 }
189
189
190 # we want to start with some patches applied
190 # we want to start with some patches applied
191 hg qpush -a
191 hg qpush -a
192 echo " % pops all patches and succeeds"
192 echo " % pops all patches and succeeds"
193 errorcode qpop -a
193 errorcode qpop -a
194 echo " % does nothing and succeeds"
194 echo " % does nothing and succeeds"
195 errorcode qpop -a
195 errorcode qpop -a
196 echo " % fails - nothing else to pop"
196 echo " % fails - nothing else to pop"
197 errorcode qpop
197 errorcode qpop
198 echo " % pushes a patch and succeeds"
198 echo " % pushes a patch and succeeds"
199 errorcode qpush
199 errorcode qpush
200 echo " % pops a patch and succeeds"
200 echo " % pops a patch and succeeds"
201 errorcode qpop
201 errorcode qpop
202 echo " % pushes up to test1b.patch and succeeds"
202 echo " % pushes up to test1b.patch and succeeds"
203 errorcode qpush test1b.patch
203 errorcode qpush test1b.patch
204 echo " % does nothing and succeeds"
204 echo " % does nothing and succeeds"
205 errorcode qpush test1b.patch
205 errorcode qpush test1b.patch
206 echo " % does nothing and succeeds"
206 echo " % does nothing and succeeds"
207 errorcode qpop test1b.patch
207 errorcode qpop test1b.patch
208 echo " % fails - can't push to this patch"
208 echo " % fails - can't push to this patch"
209 errorcode qpush test.patch
209 errorcode qpush test.patch
210 echo " % fails - can't pop to this patch"
210 echo " % fails - can't pop to this patch"
211 errorcode qpop test2.patch
211 errorcode qpop test2.patch
212 echo " % pops up to test.patch and succeeds"
212 echo " % pops up to test.patch and succeeds"
213 errorcode qpop test.patch
213 errorcode qpop test.patch
214 echo " % pushes all patches and succeeds"
214 echo " % pushes all patches and succeeds"
215 errorcode qpush -a
215 errorcode qpush -a
216 echo " % does nothing and succeeds"
216 echo " % does nothing and succeeds"
217 errorcode qpush -a
217 errorcode qpush -a
218 echo " % fails - nothing else to push"
218 echo " % fails - nothing else to push"
219 errorcode qpush
219 errorcode qpush
220 echo " % does nothing and succeeds"
220 echo " % does nothing and succeeds"
221 errorcode qpush test2.patch
221 errorcode qpush test2.patch
222
222
223
223
224 echo % strip
224 echo % strip
225 cd ../../b
225 cd ../../b
226 echo x>x
226 echo x>x
227 hg ci -Ama
227 hg ci -Ama
228 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
228 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
229 hg unbundle .hg/strip-backup/*
229 hg unbundle .hg/strip-backup/*
230
230
231 echo '% cd b; hg qrefresh'
231 echo '% cd b; hg qrefresh'
232 hg init refresh
232 hg init refresh
233 cd refresh
233 cd refresh
234 echo a > a
234 echo a > a
235 hg ci -Ama -d'0 0'
235 hg ci -Ama -d'0 0'
236 hg qnew -mfoo foo
236 hg qnew -mfoo foo
237 echo a >> a
237 echo a >> a
238 hg qrefresh
238 hg qrefresh
239 mkdir b
239 mkdir b
240 cd b
240 cd b
241 echo f > f
241 echo f > f
242 hg add f
242 hg add f
243 hg qrefresh
243 hg qrefresh
244 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
244 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
245 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
245 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
246 echo % hg qrefresh .
246 echo % hg qrefresh .
247 hg qrefresh .
247 hg qrefresh .
248 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
248 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
249 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
249 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" ../.hg/patches/foo
250 hg status
250 hg status
251
251
252 echo % qpush failure
252 echo % qpush failure
253 cd ..
253 cd ..
254 hg qrefresh
254 hg qrefresh
255 hg qnew -mbar bar
255 hg qnew -mbar bar
256 echo foo > foo
256 echo foo > foo
257 echo bar > bar
257 echo bar > bar
258 hg add foo bar
258 hg add foo bar
259 hg qrefresh
259 hg qrefresh
260 hg qpop -a
260 hg qpop -a
261 echo bar > foo
261 echo bar > foo
262 hg qpush -a
262 hg qpush -a
263 hg st
263 hg st
264
264
265 echo % mq tags
265 echo % mq tags
266 hg log --template '{rev} {tags}\n' -r qparent:qtip
266 hg log --template '{rev} {tags}\n' -r qparent:qtip
267
267
268 cat >>$HGRCPATH <<EOF
268 cat >>$HGRCPATH <<EOF
269 [diff]
269 [diff]
270 git = True
270 git = True
271 EOF
271 EOF
272 cd ..
272 cd ..
273 hg init git
273 hg init git
274 cd git
274 cd git
275 hg qinit
275 hg qinit
276
276
277 hg qnew -m'new file' new
277 hg qnew -m'new file' new
278 echo foo > new
278 echo foo > new
279 chmod +x new
279 chmod +x new
280 hg add new
280 hg add new
281 hg qrefresh
281 hg qrefresh
282 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
282 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
283 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
283 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/new
284
284
285 hg qnew -m'copy file' copy
285 hg qnew -m'copy file' copy
286 hg cp new copy
286 hg cp new copy
287 hg qrefresh
287 hg qrefresh
288 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
288 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
289 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
289 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/copy
290
290
291 hg qpop
291 hg qpop
292 hg qpush
292 hg qpush
293 hg qdiff
293 hg qdiff
294 cat >>$HGRCPATH <<EOF
294 cat >>$HGRCPATH <<EOF
295 [diff]
295 [diff]
296 git = False
296 git = False
297 EOF
297 EOF
298 hg qdiff --git
298 hg qdiff --git
299
299
300 cd ..
300 cd ..
301 hg init slow
301 hg init slow
302 cd slow
302 cd slow
303 hg qinit
303 hg qinit
304 echo foo > foo
304 echo foo > foo
305 hg add foo
305 hg add foo
306 hg ci -m 'add foo'
306 hg ci -m 'add foo'
307 hg qnew bar
307 hg qnew bar
308 echo bar > bar
308 echo bar > bar
309 hg add bar
309 hg add bar
310 hg mv foo baz
310 hg mv foo baz
311 hg qrefresh --git
311 hg qrefresh --git
312 hg up -C 0
312 hg up -C 0
313 echo >> foo
313 echo >> foo
314 hg ci -m 'change foo'
314 hg ci -m 'change foo'
315 hg up -C 1
315 hg up -C 1
316 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
316 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
317 cat .hg/patches/bar
317 cat .hg/patches/bar
318 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
318 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
319 hg qrefresh --git
319 hg qrefresh --git
320 cat .hg/patches/bar
320 cat .hg/patches/bar
321 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
321 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
322 hg qrefresh
322 hg qrefresh
323 grep 'diff --git' .hg/patches/bar
323 grep 'diff --git' .hg/patches/bar
324
324
325 echo
325 echo
326 hg up -C 1
326 hg up -C 1
327 echo >> foo
327 echo >> foo
328 hg ci -m 'change foo again'
328 hg ci -m 'change foo again'
329 hg up -C 2
329 hg up -C 2
330 hg mv bar quux
330 hg mv bar quux
331 hg mv baz bleh
331 hg mv baz bleh
332 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
332 hg qrefresh --git 2>&1 | grep -v 'saving bundle'
333 cat .hg/patches/bar
333 cat .hg/patches/bar
334 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
334 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
335 hg mv quux fred
335 hg mv quux fred
336 hg mv bleh barney
336 hg mv bleh barney
337 hg qrefresh --git
337 hg qrefresh --git
338 cat .hg/patches/bar
338 cat .hg/patches/bar
339 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
339 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
340
340
341 echo % create a git patch
341 echo % create a git patch
342 echo a > alexander
342 echo a > alexander
343 hg add alexander
343 hg add alexander
344 hg qnew -f --git addalexander
344 hg qnew -f --git addalexander
345 cat .hg/patches/addalexander | grep diff
345 grep diff .hg/patches/addalexander
346
346
347 echo % create a git binary patch
347 echo % create a git binary patch
348 cat > writebin.py <<EOF
348 cat > writebin.py <<EOF
349 import sys
349 import sys
350 path = sys.argv[1]
350 path = sys.argv[1]
351 open(path, 'wb').write('BIN\x00ARY')
351 open(path, 'wb').write('BIN\x00ARY')
352 EOF
352 EOF
353 python writebin.py bucephalus
353 python writebin.py bucephalus
354
354
355 python "$TESTDIR/md5sum.py" bucephalus
355 python "$TESTDIR/md5sum.py" bucephalus
356 hg add bucephalus
356 hg add bucephalus
357 hg qnew -f --git addbucephalus
357 hg qnew -f --git addbucephalus
358 cat .hg/patches/addbucephalus | grep diff
358 grep diff .hg/patches/addbucephalus
359
359
360 echo % check binary patches can be popped and pushed
360 echo % check binary patches can be popped and pushed
361 hg qpop
361 hg qpop
362 ! test -f bucephalus || echo % bucephalus should not be there
362 test -f bucephalus && echo % bucephalus should not be there
363 hg qpush
363 hg qpush
364 test -f bucephalus || echo % bucephalus should be there
364 test -f bucephalus || echo % bucephalus should be there
365 python "$TESTDIR/md5sum.py" bucephalus
365 python "$TESTDIR/md5sum.py" bucephalus
366
366
367
367
368 echo '% strip again'
368 echo '% strip again'
369 cd ..
369 cd ..
370 hg init strip
370 hg init strip
371 cd strip
371 cd strip
372 touch foo
372 touch foo
373 hg add foo
373 hg add foo
374 hg ci -m 'add foo' -d '0 0'
374 hg ci -m 'add foo' -d '0 0'
375 echo >> foo
375 echo >> foo
376 hg ci -m 'change foo 1' -d '0 0'
376 hg ci -m 'change foo 1' -d '0 0'
377 hg up -C 0
377 hg up -C 0
378 echo 1 >> foo
378 echo 1 >> foo
379 hg ci -m 'change foo 2' -d '0 0'
379 hg ci -m 'change foo 2' -d '0 0'
380 HGMERGE=true hg merge
380 HGMERGE=true hg merge
381 hg ci -m merge -d '0 0'
381 hg ci -m merge -d '0 0'
382 hg log
382 hg log
383 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
383 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
384 hg log
384 hg log
385 cd ..
385 cd ..
386
386
387 echo '% qclone'
387 echo '% qclone'
388 qlog()
388 qlog()
389 {
389 {
390 echo 'main repo:'
390 echo 'main repo:'
391 hg log --template ' rev {rev}: {desc}\n'
391 hg log --template ' rev {rev}: {desc}\n'
392 echo 'patch repo:'
392 echo 'patch repo:'
393 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
393 hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
394 }
394 }
395 hg init qclonesource
395 hg init qclonesource
396 cd qclonesource
396 cd qclonesource
397 echo foo > foo
397 echo foo > foo
398 hg add foo
398 hg add foo
399 hg ci -m 'add foo'
399 hg ci -m 'add foo'
400 hg qinit
400 hg qinit
401 hg qnew patch1
401 hg qnew patch1
402 echo bar >> foo
402 echo bar >> foo
403 hg qrefresh -m 'change foo'
403 hg qrefresh -m 'change foo'
404 cd ..
404 cd ..
405
405
406 # repo with unversioned patch dir
406 # repo with unversioned patch dir
407 hg qclone qclonesource failure
407 hg qclone qclonesource failure
408
408
409 cd qclonesource
409 cd qclonesource
410 hg qinit -c
410 hg qinit -c
411 hg qci -m checkpoint
411 hg qci -m checkpoint
412 qlog
412 qlog
413 cd ..
413 cd ..
414
414
415 # repo with patches applied
415 # repo with patches applied
416 hg qclone qclonesource qclonedest
416 hg qclone qclonesource qclonedest
417 cd qclonedest
417 cd qclonedest
418 qlog
418 qlog
419 cd ..
419 cd ..
420
420
421 # repo with patches unapplied
421 # repo with patches unapplied
422 cd qclonesource
422 cd qclonesource
423 hg qpop -a
423 hg qpop -a
424 qlog
424 qlog
425 cd ..
425 cd ..
426 hg qclone qclonesource qclonedest2
426 hg qclone qclonesource qclonedest2
427 cd qclonedest2
427 cd qclonedest2
428 qlog
428 qlog
429 cd ..
429 cd ..
430
430
General Comments 0
You need to be logged in to leave comments. Login now