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