##// END OF EJS Templates
tests: unify test-transplant
Nicolas Dumazet -
r11800:88c3ff05 default
parent child Browse files
Show More
@@ -1,168 +1,353 b''
1 #!/bin/sh
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > transplant=
4 > EOF
2 5
3 cat <<EOF >> $HGRCPATH
4 [extensions]
5 transplant=
6 EOF
6 $ hg init t
7 $ cd t
8 $ echo r1 > r1
9 $ hg ci -Amr1 -d'0 0'
10 adding r1
11 $ echo r2 > r2
12 $ hg ci -Amr2 -d'1 0'
13 adding r2
14 $ hg up 0
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7 16
8 hg init t
9 cd t
10 echo r1 > r1
11 hg ci -Amr1 -d'0 0'
12 echo r2 > r2
13 hg ci -Amr2 -d'1 0'
14 hg up 0
17 $ echo b1 > b1
18 $ hg ci -Amb1 -d '0 0'
19 adding b1
20 created new head
21 $ echo b2 > b2
22 $ hg ci -Amb2 -d '1 0'
23 adding b2
24 $ echo b3 > b3
25 $ hg ci -Amb3 -d '2 0'
26 adding b3
27
28 $ hg log --template '{rev} {parents} {desc}\n'
29 4 b3
30 3 b2
31 2 0:17ab29e464c6 b1
32 1 r2
33 0 r1
34
35 $ hg clone . ../rebase
36 updating to branch default
37 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 $ cd ../rebase
39
40 $ hg up -C 1
41 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
15 42
16 echo b1 > b1
17 hg ci -Amb1 -d '0 0'
18 echo b2 > b2
19 hg ci -Amb2 -d '1 0'
20 echo b3 > b3
21 hg ci -Amb3 -d '2 0'
43 rebase b onto r1
44
45 $ hg transplant -a -b tip
46 applying 37a1297eb21b
47 37a1297eb21b transplanted to e234d668f844
48 applying 722f4667af76
49 722f4667af76 transplanted to 539f377d78df
50 applying a53251cdf717
51 a53251cdf717 transplanted to ffd6818a3975
52 $ hg log --template '{rev} {parents} {desc}\n'
53 7 b3
54 6 b2
55 5 1:d11e3596cc1a b1
56 4 b3
57 3 b2
58 2 0:17ab29e464c6 b1
59 1 r2
60 0 r1
22 61
23 hg log --template '{rev} {parents} {desc}\n'
62 $ hg clone ../t ../prune
63 updating to branch default
64 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 $ cd ../prune
24 66
25 hg clone . ../rebase
26 cd ../rebase
67 $ hg up -C 1
68 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
69
70 rebase b onto r1, skipping b2
27 71
28 hg up -C 1
29 echo '% rebase b onto r1'
30 hg transplant -a -b tip
31 hg log --template '{rev} {parents} {desc}\n'
72 $ hg transplant -a -b tip -p 3
73 applying 37a1297eb21b
74 37a1297eb21b transplanted to e234d668f844
75 applying a53251cdf717
76 a53251cdf717 transplanted to 7275fda4d04f
77 $ hg log --template '{rev} {parents} {desc}\n'
78 6 b3
79 5 1:d11e3596cc1a b1
80 4 b3
81 3 b2
82 2 0:17ab29e464c6 b1
83 1 r2
84 0 r1
32 85
33 hg clone ../t ../prune
34 cd ../prune
86
87 remote transplant
35 88
36 hg up -C 1
37 echo '% rebase b onto r1, skipping b2'
38 hg transplant -a -b tip -p 3
39 hg log --template '{rev} {parents} {desc}\n'
89 $ hg clone -r 1 ../t ../remote
90 requesting all changes
91 adding changesets
92 adding manifests
93 adding file changes
94 added 2 changesets with 2 changes to 2 files
95 updating to branch default
96 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 $ cd ../remote
98 $ hg transplant --log -s ../t 2 4
99 searching for changes
100 applying 37a1297eb21b
101 37a1297eb21b transplanted to c19cf0ccb069
102 applying a53251cdf717
103 a53251cdf717 transplanted to f7fe5bf98525
104 $ hg log --template '{rev} {parents} {desc}\n'
105 3 b3
106 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
107 2 b1
108 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
109 1 r2
110 0 r1
40 111
41 echo '% remote transplant'
42 hg clone -r 1 ../t ../remote
43 cd ../remote
44 hg transplant --log -s ../t 2 4
45 hg log --template '{rev} {parents} {desc}\n'
112 skip previous transplants
113
114 $ hg transplant -s ../t -a -b 4
115 searching for changes
116 applying 722f4667af76
117 722f4667af76 transplanted to 47156cd86c0b
118 $ hg log --template '{rev} {parents} {desc}\n'
119 4 b2
120 3 b3
121 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
122 2 b1
123 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
124 1 r2
125 0 r1
126
127 skip local changes transplanted to the source
46 128
47 echo '% skip previous transplants'
48 hg transplant -s ../t -a -b 4
49 hg log --template '{rev} {parents} {desc}\n'
129 $ echo b4 > b4
130 $ hg ci -Amb4 -d '3 0'
131 adding b4
132 $ hg clone ../t ../pullback
133 updating to branch default
134 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 $ cd ../pullback
136 $ hg transplant -s ../remote -a -b tip
137 searching for changes
138 applying 4333daefcb15
139 4333daefcb15 transplanted to 5f42c04e07cc
140
141
142 remote transplant with pull
143
144 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
145 $ cat ../t.pid >> $DAEMON_PIDS
50 146
51 echo '% skip local changes transplanted to the source'
52 echo b4 > b4
53 hg ci -Amb4 -d '3 0'
54 hg clone ../t ../pullback
55 cd ../pullback
56 hg transplant -s ../remote -a -b tip
147 $ hg clone -r 0 ../t ../rp
148 requesting all changes
149 adding changesets
150 adding manifests
151 adding file changes
152 added 1 changesets with 1 changes to 1 files
153 updating to branch default
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ cd ../rp
156 $ hg transplant -s http://localhost:$HGPORT/ 2 4
157 searching for changes
158 searching for changes
159 adding changesets
160 adding manifests
161 adding file changes
162 added 1 changesets with 1 changes to 1 files
163 applying a53251cdf717
164 a53251cdf717 transplanted to 8d9279348abb
165 $ hg log --template '{rev} {parents} {desc}\n'
166 2 b3
167 1 b1
168 0 r1
57 169
58 echo '% remote transplant with pull'
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
60 cat ../t.pid >> $DAEMON_PIDS
61
62 hg clone -r 0 ../t ../rp
63 cd ../rp
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 hg log --template '{rev} {parents} {desc}\n'
170 transplant --continue
66 171
67 echo '% transplant --continue'
68 hg init ../tc
69 cd ../tc
70 cat <<EOF > foo
71 foo
72 bar
73 baz
74 EOF
75 echo toremove > toremove
76 hg ci -Amfoo
77 cat <<EOF > foo
78 foo2
79 bar2
80 baz2
81 EOF
82 rm toremove
83 echo added > added
84 hg ci -Amfoo2
85 echo bar > bar
86 hg ci -Ambar
87 echo bar2 >> bar
88 hg ci -mbar2
89 hg up 0
90 echo foobar > foo
91 hg ci -mfoobar
92 hg transplant 1:3
93 # transplant -c shouldn't use an old changeset
94 hg up -C
95 rm added
96 hg transplant 1
97 hg transplant --continue
98 hg transplant 1:3
99 hg locate
100 cd ..
172 $ hg init ../tc
173 $ cd ../tc
174 $ cat <<EOF > foo
175 > foo
176 > bar
177 > baz
178 > EOF
179 $ echo toremove > toremove
180 $ hg ci -Amfoo
181 adding foo
182 adding toremove
183 $ cat <<EOF > foo
184 > foo2
185 > bar2
186 > baz2
187 > EOF
188 $ rm toremove
189 $ echo added > added
190 $ hg ci -Amfoo2
191 adding added
192 removing toremove
193 $ echo bar > bar
194 $ hg ci -Ambar
195 adding bar
196 $ echo bar2 >> bar
197 $ hg ci -mbar2
198 $ hg up 0
199 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
200 $ echo foobar > foo
201 $ hg ci -mfoobar
202 created new head
203 $ hg transplant 1:3
204 applying a1e30dd1b8e7
205 patching file foo
206 Hunk #1 FAILED at 0
207 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
208 patch failed to apply
209 abort: Fix up the merge and run hg transplant --continue
210
211 transplant -c shouldn't use an old changeset
212
213 $ hg up -C
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 $ rm added
216 $ hg transplant 1
217 applying a1e30dd1b8e7
218 patching file foo
219 Hunk #1 FAILED at 0
220 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
221 patch failed to apply
222 abort: Fix up the merge and run hg transplant --continue
223 $ hg transplant --continue
224 a1e30dd1b8e7 transplanted as f1563cf27039
225 $ hg transplant 1:3
226 skipping already applied revision 1:a1e30dd1b8e7
227 applying 1739ac5f6139
228 1739ac5f6139 transplanted to d649c221319f
229 applying 0282d5fbbe02
230 0282d5fbbe02 transplanted to 77418277ccb3
231 $ hg locate
232 added
233 bar
234 foo
235 $ cd ..
236
237 Test transplant --merge (issue 1111)
238 test transplant merge
239
240 $ hg init t1111
241 $ cd t1111
242 $ echo a > a
243 $ hg ci -Am adda
244 adding a
245 $ echo b >> a
246 $ hg ci -m appendb
247 $ echo c >> a
248 $ hg ci -m appendc
249 $ hg up -C 0
250 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 $ echo d >> a
252 $ hg ci -m appendd
253 created new head
254
255 tranplant
256
257 $ hg transplant -m 1
258 applying 42dc4432fd35
259 1:42dc4432fd35 merged at a9f4acbac129
260 $ cd ..
101 261
102 # Test transplant --merge (issue 1111)
103 echo % test transplant merge
104 hg init t1111
105 cd t1111
106 echo a > a
107 hg ci -Am adda
108 echo b >> a
109 hg ci -m appendb
110 echo c >> a
111 hg ci -m appendc
112 hg up -C 0
113 echo d >> a
114 hg ci -m appendd
115 echo % tranplant
116 hg transplant -m 1
117 cd ..
262 test transplant into empty repository
263
264 $ hg init empty
265 $ cd empty
266 $ hg transplant -s ../t -b tip -a
267 requesting all changes
268 adding changesets
269 adding manifests
270 adding file changes
271 added 4 changesets with 4 changes to 4 files
272 $ cd ..
273
274
275 test filter
118 276
119 echo '% test transplant into empty repository'
120 hg init empty
121 cd empty
122 hg transplant -s ../t -b tip -a
123 cd ..
277 $ hg init filter
278 $ cd filter
279 $ cat <<'EOF' >test-filter
280 > #!/bin/sh
281 > sed 's/r1/r2/' $1 > $1.new
282 > mv $1.new $1
283 > EOF
284 $ chmod +x test-filter
285 $ hg transplant -s ../t -b tip -a --filter ./test-filter
286 filtering .*
287 applying 17ab29e464c6
288 17ab29e464c6 transplanted to e9ffc54ea104
289 filtering .*
290 applying 37a1297eb21b
291 37a1297eb21b transplanted to 348b36d0b6a5
292 filtering .*
293 applying 722f4667af76
294 722f4667af76 transplanted to 0aa6979afb95
295 filtering .*
296 applying a53251cdf717
297 a53251cdf717 transplanted to 14f8512272b5
298 $ hg log --template '{rev} {parents} {desc}\n'
299 3 b3
300 2 b2
301 1 b1
302 0 r2
303 $ cd ..
304
305
306 test filter with failed patch
124 307
125 echo '% test filter'
126 hg init filter
127 cd filter
128 cat <<'EOF' >test-filter
129 #!/bin/sh
130 sed 's/r1/r2/' $1 > $1.new
131 mv $1.new $1
132 EOF
133 chmod +x test-filter
134 hg transplant -s ../t -b tip -a --filter ./test-filter |\
135 sed 's/filtering.*/filtering/g'
136 hg log --template '{rev} {parents} {desc}\n'
137 cd ..
308 $ cd filter
309 $ hg up 0
310 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
311 $ echo foo > b1
312 $ hg ci -d '0 0' -Am foo
313 adding b1
314 adding test-filter
315 created new head
316 $ hg transplant 1 --filter ./test-filter
317 filtering .*
318 applying 348b36d0b6a5
319 file b1 already exists
320 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
321 patch failed to apply
322 abort: Fix up the merge and run hg transplant --continue
323 $ cd ..
324
325
326 test with a win32ext like setup (differing EOLs)
138 327
139 echo '% test filter with failed patch'
140 cd filter
141 hg up 0
142 echo foo > b1
143 hg ci -d '0 0' -Am foo
144 hg transplant 1 --filter ./test-filter |\
145 sed 's/filtering.*/filtering/g'
146 cd ..
328 $ hg init twin1
329 $ cd twin1
330 $ echo a > a
331 $ echo b > b
332 $ echo b >> b
333 $ hg ci -Am t
334 adding a
335 adding b
336 $ echo a > b
337 $ echo b >> b
338 $ hg ci -m changeb
339 $ cd ..
147 340
148 echo '% test with a win32ext like setup (differing EOLs)'
149 hg init twin1
150 cd twin1
151 echo a > a
152 echo b > b
153 echo b >> b
154 hg ci -Am t
155 echo a > b
156 echo b >> b
157 hg ci -m changeb
158 cd ..
159
160 hg init twin2
161 cd twin2
162 echo '[patch]' >> .hg/hgrc
163 echo 'eol = crlf' >> .hg/hgrc
164 python -c "file('b', 'wb').write('b\r\nb\r\n')"
165 hg ci -m addb
166 hg transplant -s ../twin1 tip
167 python -c "print repr(file('b', 'rb').read())"
168 cd ..
341 $ hg init twin2
342 $ cd twin2
343 $ echo '[patch]' >> .hg/hgrc
344 $ echo 'eol = crlf' >> .hg/hgrc
345 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
346 $ hg ci -m addb
347 nothing changed
348 $ hg transplant -s ../twin1 tip
349 applying 2e849d776c17
350 2e849d776c17 transplanted to 589cea8ba85b
351 $ python -c "print repr(file('b', 'rb').read())"
352 'a\r\nb\r\n'
353 $ cd ..
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now