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