##// END OF EJS Templates
tests: optimize test-copytrace-heuristics.t...
Pulkit Goyal -
r34568:1b261be2 default
parent child Browse files
Show More
@@ -1,714 +1,657
1 1 Test for the heuristic copytracing algorithm
2 2 ============================================
3 3
4 4 $ cat >> $TESTTMP/copytrace.sh << '__EOF__'
5 5 > initclient() {
6 6 > cat >> $1/.hg/hgrc <<EOF
7 7 > [experimental]
8 8 > copytrace = heuristics
9 > copytrace.sourcecommitlimit = -1
9 10 > EOF
10 11 > }
11 12 > __EOF__
12 13 $ . "$TESTTMP/copytrace.sh"
13 14
14 15 $ cat >> $HGRCPATH << EOF
15 16 > [extensions]
16 17 > rebase=
17 18 > shelve=
18 19 > EOF
19 20
21 NOTE: calling initclient() set copytrace.sourcecommitlimit=-1 as we want to
22 prevent the full copytrace algorithm to run and test the heuristic algorithm
23 without complexing the test cases with public and draft commits.
24
20 25 Check filename heuristics (same dirname and same basename)
21 $ hg init server
22 $ cd server
26 ----------------------------------------------------------
27
28 $ hg init repo
29 $ initclient repo
30 $ cd repo
23 31 $ echo a > a
24 32 $ mkdir dir
25 33 $ echo a > dir/file.txt
26 34 $ hg addremove
27 35 adding a
28 36 adding dir/file.txt
29 37 $ hg ci -m initial
30 38 $ hg mv a b
31 39 $ hg mv -q dir dir2
32 40 $ hg ci -m 'mv a b, mv dir/ dir2/'
33 $ cd ..
34 $ hg clone -q server repo
35 $ initclient repo
36 $ cd repo
37 41 $ hg up -q 0
38 42 $ echo b > a
39 43 $ echo b > dir/file.txt
40 44 $ hg ci -qm 'mod a, mod dir/file.txt'
41 45
42 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
46 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
43 47 @ changeset: 557f403c0afd2a3cf15d7e2fb1f1001a8b85e081
44 | desc: mod a, mod dir/file.txt, phase: draft
48 | desc: mod a, mod dir/file.txt
45 49 | o changeset: 928d74bc9110681920854d845c06959f6dfc9547
46 |/ desc: mv a b, mv dir/ dir2/, phase: public
50 |/ desc: mv a b, mv dir/ dir2/
47 51 o changeset: 3c482b16e54596fed340d05ffaf155f156cda7ee
48 desc: initial, phase: public
52 desc: initial
49 53
50 54 $ hg rebase -s . -d 1
51 55 rebasing 2:557f403c0afd "mod a, mod dir/file.txt" (tip)
52 56 merging b and a to b
53 57 merging dir2/file.txt and dir/file.txt to dir2/file.txt
54 58 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/557f403c0afd-9926eeff-rebase.hg (glob)
55 59 $ cd ..
56 $ rm -rf server
57 60 $ rm -rf repo
58 61
59 62 Make sure filename heuristics do not when they are not related
60 $ hg init server
61 $ cd server
63 --------------------------------------------------------------
64
65 $ hg init repo
66 $ initclient repo
67 $ cd repo
62 68 $ echo 'somecontent' > a
63 69 $ hg add a
64 70 $ hg ci -m initial
65 71 $ hg rm a
66 72 $ echo 'completelydifferentcontext' > b
67 73 $ hg add b
68 74 $ hg ci -m 'rm a, add b'
69 $ cd ..
70 $ hg clone -q server repo
71 $ initclient repo
72 $ cd repo
73 75 $ hg up -q 0
74 76 $ printf 'somecontent\nmoarcontent' > a
75 77 $ hg ci -qm 'mode a'
76 78
77 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
79 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
78 80 @ changeset: d526312210b9e8f795d576a77dc643796384d86e
79 | desc: mode a, phase: draft
81 | desc: mode a
80 82 | o changeset: 46985f76c7e5e5123433527f5c8526806145650b
81 |/ desc: rm a, add b, phase: public
83 |/ desc: rm a, add b
82 84 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
83 desc: initial, phase: public
85 desc: initial
84 86
85 87 $ hg rebase -s . -d 1
86 88 rebasing 2:d526312210b9 "mode a" (tip)
87 89 other [source] changed a which local [dest] deleted
88 90 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
89 91 unresolved conflicts (see hg resolve, then hg rebase --continue)
90 92 [1]
91 93
92 94 $ cd ..
93 $ rm -rf server
94 95 $ rm -rf repo
95 96
96 97 Test when lca didn't modified the file that was moved
97 $ hg init server
98 $ cd server
99 $ echo 'somecontent' > a
100 $ hg add a
101 $ hg ci -m initial
102 $ echo c > c
103 $ hg add c
104 $ hg ci -m randomcommit
105 $ hg mv a b
106 $ hg ci -m 'mv a b'
107 $ cd ..
108 $ hg clone -q server repo
98 -----------------------------------------------------
99
100 $ hg init repo
109 101 $ initclient repo
110 102 $ cd repo
111 $ hg up -q 1
112 $ echo b > a
113 $ hg ci -qm 'mod a'
114
115 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
116 @ changeset: 9d5cf99c3d9f8e8b05ba55421f7f56530cfcf3bc
117 | desc: mod a, phase: draft
118 | o changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
119 |/ desc: mv a b, phase: public
120 o changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
121 | desc: randomcommit, phase: public
122 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
123 desc: initial, phase: public
124
125 $ hg rebase -s . -d 2
126 rebasing 3:9d5cf99c3d9f "mod a" (tip)
127 merging b and a to b
128 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg (glob)
129 $ cd ..
130 $ rm -rf server
131 $ rm -rf repo
132
133 Rebase "backwards"
134 $ hg init server
135 $ cd server
136 103 $ echo 'somecontent' > a
137 104 $ hg add a
138 105 $ hg ci -m initial
139 106 $ echo c > c
140 107 $ hg add c
141 108 $ hg ci -m randomcommit
142 109 $ hg mv a b
143 110 $ hg ci -m 'mv a b'
111 $ hg up -q 1
112 $ echo b > a
113 $ hg ci -qm 'mod a'
114
115 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
116 @ changeset: 9d5cf99c3d9f8e8b05ba55421f7f56530cfcf3bc
117 | desc: mod a, phase: draft
118 | o changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
119 |/ desc: mv a b, phase: draft
120 o changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
121 | desc: randomcommit, phase: draft
122 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
123 desc: initial, phase: draft
124
125 $ hg rebase -s . -d 2
126 rebasing 3:9d5cf99c3d9f "mod a" (tip)
127 merging b and a to b
128 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg (glob)
144 129 $ cd ..
145 $ hg clone -q server repo
130 $ rm -rf repo
131
132 Rebase "backwards"
133 ------------------
134
135 $ hg init repo
146 136 $ initclient repo
147 137 $ cd repo
138 $ echo 'somecontent' > a
139 $ hg add a
140 $ hg ci -m initial
141 $ echo c > c
142 $ hg add c
143 $ hg ci -m randomcommit
144 $ hg mv a b
145 $ hg ci -m 'mv a b'
148 146 $ hg up -q 2
149 147 $ echo b > b
150 148 $ hg ci -qm 'mod b'
151 149
152 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
150 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
153 151 @ changeset: fbe97126b3969056795c462a67d93faf13e4d298
154 | desc: mod b, phase: draft
152 | desc: mod b
155 153 o changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
156 | desc: mv a b, phase: public
154 | desc: mv a b
157 155 o changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
158 | desc: randomcommit, phase: public
156 | desc: randomcommit
159 157 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
160 desc: initial, phase: public
158 desc: initial
161 159
162 160 $ hg rebase -s . -d 0
163 161 rebasing 3:fbe97126b396 "mod b" (tip)
164 162 merging a and b to a
165 163 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fbe97126b396-cf5452a1-rebase.hg (glob)
166 164 $ cd ..
167 $ rm -rf server
168 165 $ rm -rf repo
169 166
170 Rebase draft commit on top of draft commit
167 Check a few potential move candidates
168 -------------------------------------
169
171 170 $ hg init repo
172 171 $ initclient repo
173 172 $ cd repo
174 $ echo 'somecontent' > a
175 $ hg add a
176 $ hg ci -m initial
177 $ hg mv a b
178 $ hg ci -m 'mv a b'
179 $ hg up -q ".^"
180 $ echo b > a
181 $ hg ci -qm 'mod a'
182
183 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
184 @ changeset: 5268f05aa1684cfb5741e9eb05eddcc1c5ee7508
185 | desc: mod a, phase: draft
186 | o changeset: 542cb58df733ee48fa74729bd2cdb94c9310d362
187 |/ desc: mv a b, phase: draft
188 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
189 desc: initial, phase: draft
190
191 $ hg rebase -s . -d 1
192 rebasing 2:5268f05aa168 "mod a" (tip)
193 merging b and a to b
194 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5268f05aa168-284f6515-rebase.hg (glob)
195 $ cd ..
196 $ rm -rf server
197 $ rm -rf repo
198
199 Check a few potential move candidates
200 $ hg init server
201 $ initclient server
202 $ cd server
203 173 $ mkdir dir
204 174 $ echo a > dir/a
205 175 $ hg add dir/a
206 176 $ hg ci -qm initial
207 177 $ hg mv dir/a dir/b
208 178 $ hg ci -qm 'mv dir/a dir/b'
209 179 $ mkdir dir2
210 180 $ echo b > dir2/a
211 181 $ hg add dir2/a
212 182 $ hg ci -qm 'create dir2/a'
213 $ cd ..
214 $ hg clone -q server repo
215 $ initclient repo
216 $ cd repo
217 183 $ hg up -q 0
218 184 $ echo b > dir/a
219 185 $ hg ci -qm 'mod dir/a'
220 186
221 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
187 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
222 188 @ changeset: 6b2f4cece40fd320f41229f23821256ffc08efea
223 | desc: mod dir/a, phase: draft
189 | desc: mod dir/a
224 190 | o changeset: 4494bf7efd2e0dfdd388e767fb913a8a3731e3fa
225 | | desc: create dir2/a, phase: public
191 | | desc: create dir2/a
226 192 | o changeset: b1784dfab6ea6bfafeb11c0ac50a2981b0fe6ade
227 |/ desc: mv dir/a dir/b, phase: public
193 |/ desc: mv dir/a dir/b
228 194 o changeset: 36859b8907c513a3a87ae34ba5b1e7eea8c20944
229 desc: initial, phase: public
195 desc: initial
230 196
231 197 $ hg rebase -s . -d 2
232 198 rebasing 3:6b2f4cece40f "mod dir/a" (tip)
233 199 merging dir/b and dir/a to dir/b
234 200 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/6b2f4cece40f-503efe60-rebase.hg (glob)
235 201 $ cd ..
236 $ rm -rf server
237 202 $ rm -rf repo
238 203
239 204 Move file in one branch and delete it in another
240 $ hg init server
241 $ initclient server
242 $ cd server
205 -----------------------------------------------
206
207 $ hg init repo
208 $ initclient repo
209 $ cd repo
243 210 $ echo a > a
244 211 $ hg add a
245 212 $ hg ci -m initial
246 $ cd ..
247 $ hg clone -q server repo
248 $ initclient repo
249 $ cd repo
250 213 $ hg mv a b
251 214 $ hg ci -m 'mv a b'
252 215 $ hg up -q ".^"
253 216 $ hg rm a
254 217 $ hg ci -m 'del a'
255 218 created new head
256 219
257 220 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
258 221 @ changeset: 7d61ee3b1e48577891a072024968428ba465c47b
259 222 | desc: del a, phase: draft
260 223 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
261 224 |/ desc: mv a b, phase: draft
262 225 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
263 desc: initial, phase: public
226 desc: initial, phase: draft
264 227
265 228 $ hg rebase -s 1 -d 2
266 229 rebasing 1:472e38d57782 "mv a b"
267 230 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-17d50e29-rebase.hg (glob)
268 231 $ hg up -q c492ed3c7e35dcd1dc938053b8adf56e2cfbd062
269 232 $ ls
270 233 b
271 234 $ cd ..
272 $ rm -rf server
273 235 $ rm -rf repo
274 236
275 237 Move a directory in draft branch
276 $ hg init server
277 $ initclient server
278 $ cd server
238 --------------------------------
239
240 $ hg init repo
241 $ initclient repo
242 $ cd repo
279 243 $ mkdir dir
280 244 $ echo a > dir/a
281 245 $ hg add dir/a
282 246 $ hg ci -qm initial
283 $ cd ..
284 $ hg clone -q server repo
285 $ initclient repo
286 $ cd repo
287 247 $ echo b > dir/a
288 248 $ hg ci -qm 'mod dir/a'
289 249 $ hg up -q ".^"
290 250 $ hg mv -q dir/ dir2
291 251 $ hg ci -qm 'mv dir/ dir2/'
292 252
293 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
253 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
294 254 @ changeset: a33d80b6e352591dfd82784e1ad6cdd86b25a239
295 | desc: mv dir/ dir2/, phase: draft
255 | desc: mv dir/ dir2/
296 256 | o changeset: 6b2f4cece40fd320f41229f23821256ffc08efea
297 |/ desc: mod dir/a, phase: draft
257 |/ desc: mod dir/a
298 258 o changeset: 36859b8907c513a3a87ae34ba5b1e7eea8c20944
299 desc: initial, phase: public
259 desc: initial
300 260
301 261 $ hg rebase -s . -d 1
302 262 rebasing 2:a33d80b6e352 "mv dir/ dir2/" (tip)
303 263 merging dir/a and dir2/a to dir2/a
304 264 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a33d80b6e352-fecb9ada-rebase.hg (glob)
305 265 $ cd ..
306 266 $ rm -rf server
307 267 $ rm -rf repo
308 268
309 269 Move file twice and rebase mod on top of moves
310 $ hg init server
311 $ initclient server
312 $ cd server
270 ----------------------------------------------
271
272 $ hg init repo
273 $ initclient repo
274 $ cd repo
313 275 $ echo a > a
314 276 $ hg add a
315 277 $ hg ci -m initial
316 278 $ hg mv a b
317 279 $ hg ci -m 'mv a b'
318 280 $ hg mv b c
319 281 $ hg ci -m 'mv b c'
320 $ cd ..
321 $ hg clone -q server repo
322 $ initclient repo
323 $ cd repo
324 $ hg up -q 0
325 $ echo c > a
326 $ hg ci -m 'mod a'
327 created new head
328 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
329 @ changeset: d413169422167a3fa5275fc5d71f7dea9f5775f3
330 | desc: mod a, phase: draft
331 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
332 | | desc: mv b c, phase: public
333 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
334 |/ desc: mv a b, phase: public
335 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
336 desc: initial, phase: public
337 $ hg rebase -s . -d 2
338 rebasing 3:d41316942216 "mod a" (tip)
339 merging c and a to c
340 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d41316942216-2b5949bc-rebase.hg (glob)
341
342 $ cd ..
343 $ rm -rf server
344 $ rm -rf repo
345
346 Move file twice and rebase moves on top of mods
347 $ hg init server
348 $ initclient server
349 $ cd server
350 $ echo a > a
351 $ hg add a
352 $ hg ci -m initial
353 $ cd ..
354 $ hg clone -q server repo
355 $ initclient repo
356 $ cd repo
357 $ hg mv a b
358 $ hg ci -m 'mv a b'
359 $ hg mv b c
360 $ hg ci -m 'mv b c'
361 282 $ hg up -q 0
362 283 $ echo c > a
363 284 $ hg ci -m 'mod a'
364 285 created new head
365 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
286
287 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
366 288 @ changeset: d413169422167a3fa5275fc5d71f7dea9f5775f3
367 | desc: mod a, phase: draft
289 | desc: mod a
368 290 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
369 | | desc: mv b c, phase: draft
291 | | desc: mv b c
370 292 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
371 |/ desc: mv a b, phase: draft
293 |/ desc: mv a b
372 294 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
373 desc: initial, phase: public
295 desc: initial
296 $ hg rebase -s . -d 2
297 rebasing 3:d41316942216 "mod a" (tip)
298 merging c and a to c
299 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d41316942216-2b5949bc-rebase.hg (glob)
300
301 $ cd ..
302 $ rm -rf repo
303
304 Move file twice and rebase moves on top of mods
305 -----------------------------------------------
306
307 $ hg init repo
308 $ initclient repo
309 $ cd repo
310 $ echo a > a
311 $ hg add a
312 $ hg ci -m initial
313 $ hg mv a b
314 $ hg ci -m 'mv a b'
315 $ hg mv b c
316 $ hg ci -m 'mv b c'
317 $ hg up -q 0
318 $ echo c > a
319 $ hg ci -m 'mod a'
320 created new head
321 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
322 @ changeset: d413169422167a3fa5275fc5d71f7dea9f5775f3
323 | desc: mod a
324 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
325 | | desc: mv b c
326 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
327 |/ desc: mv a b
328 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
329 desc: initial
374 330 $ hg rebase -s 1 -d .
375 331 rebasing 1:472e38d57782 "mv a b"
376 332 merging a and b to b
377 333 rebasing 2:d3efd280421d "mv b c"
378 334 merging b and c to c
379 335 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-ab8d3c58-rebase.hg (glob)
380 336
381 337 $ cd ..
382 $ rm -rf server
383 338 $ rm -rf repo
384 339
385 340 Move one file and add another file in the same folder in one branch, modify file in another branch
386 $ hg init server
387 $ initclient server
388 $ cd server
341 --------------------------------------------------------------------------------------------------
342
343 $ hg init repo
344 $ initclient repo
345 $ cd repo
389 346 $ echo a > a
390 347 $ hg add a
391 348 $ hg ci -m initial
392 349 $ hg mv a b
393 350 $ hg ci -m 'mv a b'
394 351 $ echo c > c
395 352 $ hg add c
396 353 $ hg ci -m 'add c'
397 $ cd ..
398 $ hg clone -q server repo
399 $ initclient repo
400 $ cd repo
401 354 $ hg up -q 0
402 355 $ echo b > a
403 356 $ hg ci -m 'mod a'
404 357 created new head
405 358
406 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
359 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
407 360 @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
408 | desc: mod a, phase: draft
361 | desc: mod a
409 362 | o changeset: b1a6187e79fbce851bb584eadcb0cc4a80290fd9
410 | | desc: add c, phase: public
363 | | desc: add c
411 364 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
412 |/ desc: mv a b, phase: public
365 |/ desc: mv a b
413 366 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
414 desc: initial, phase: public
367 desc: initial
415 368
416 369 $ hg rebase -s . -d 2
417 370 rebasing 3:ef716627c70b "mod a" (tip)
418 371 merging b and a to b
419 372 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob)
420 373 $ ls
421 374 b
422 375 c
423 376 $ cat b
424 377 b
378 $ rm -rf repo
425 379
426 380 Merge test
427 $ hg init server
428 $ cd server
381 ----------
382
383 $ hg init repo
384 $ initclient repo
385 $ cd repo
429 386 $ echo a > a
430 387 $ hg add a
431 388 $ hg ci -m initial
432 389 $ echo b > a
433 390 $ hg ci -m 'modify a'
434 391 $ hg up -q 0
435 392 $ hg mv a b
436 393 $ hg ci -m 'mv a b'
437 394 created new head
438 $ cd ..
439 $ hg clone -q server repo
440 $ initclient repo
441 $ cd repo
442 395 $ hg up -q 2
443 396
444 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
397 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
445 398 @ changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
446 | desc: mv a b, phase: public
399 | desc: mv a b
447 400 | o changeset: b0357b07f79129a3d08a68621271ca1352ae8a09
448 |/ desc: modify a, phase: public
401 |/ desc: modify a
449 402 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
450 desc: initial, phase: public
403 desc: initial
451 404
452 405 $ hg merge 1
453 406 merging b and a to b
454 407 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
455 408 (branch merge, don't forget to commit)
456 409 $ hg ci -m merge
457 410 $ ls
458 411 b
459 412 $ cd ..
460 $ rm -rf server
461 413 $ rm -rf repo
462 414
463 415 Copy and move file
464 $ hg init server
465 $ initclient server
466 $ cd server
416 ------------------
417
418 $ hg init repo
419 $ initclient repo
420 $ cd repo
467 421 $ echo a > a
468 422 $ hg add a
469 423 $ hg ci -m initial
470 424 $ hg cp a c
471 425 $ hg mv a b
472 426 $ hg ci -m 'cp a c, mv a b'
473 $ cd ..
474 $ hg clone -q server repo
475 $ initclient repo
476 $ cd repo
477 427 $ hg up -q 0
478 428 $ echo b > a
479 429 $ hg ci -m 'mod a'
480 430 created new head
481 431
482 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
432 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
483 433 @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
484 | desc: mod a, phase: draft
434 | desc: mod a
485 435 | o changeset: 4fc3fd13fbdb89ada6b75bfcef3911a689a0dde8
486 |/ desc: cp a c, mv a b, phase: public
436 |/ desc: cp a c, mv a b
487 437 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
488 desc: initial, phase: public
438 desc: initial
489 439
490 440 $ hg rebase -s . -d 1
491 441 rebasing 2:ef716627c70b "mod a" (tip)
492 442 merging b and a to b
493 443 merging c and a to c
494 444 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob)
495 445 $ ls
496 446 b
497 447 c
498 448 $ cat b
499 449 b
500 450 $ cat c
501 451 b
502 452 $ cd ..
503 $ rm -rf server
504 453 $ rm -rf repo
505 454
506 455 Do a merge commit with many consequent moves in one branch
507 $ hg init server
508 $ initclient server
509 $ cd server
456 ----------------------------------------------------------
457
458 $ hg init repo
459 $ initclient repo
460 $ cd repo
510 461 $ echo a > a
511 462 $ hg add a
512 463 $ hg ci -m initial
513 464 $ echo b > a
514 465 $ hg ci -qm 'mod a'
515 $ cd ..
516 $ hg clone -q server repo
517 $ initclient repo
518 $ cd repo
519 466 $ hg up -q ".^"
520 467 $ hg mv a b
521 468 $ hg ci -qm 'mv a b'
522 469 $ hg mv b c
523 470 $ hg ci -qm 'mv b c'
524 471 $ hg up -q 1
525 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
472 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
526 473 o changeset: d3efd280421d24f9f229997c19e654761c942a71
527 | desc: mv b c, phase: draft
474 | desc: mv b c
528 475 o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
529 | desc: mv a b, phase: draft
476 | desc: mv a b
530 477 | @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
531 |/ desc: mod a, phase: public
478 |/ desc: mod a
532 479 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
533 desc: initial, phase: public
480 desc: initial
534 481
535 482 $ hg merge 3
536 483 merging a and c to c
537 484 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
538 485 (branch merge, don't forget to commit)
539 486 $ hg ci -qm 'merge'
540 487 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
541 488 @ changeset: cd29b0d08c0f39bfed4cde1b40e30f419db0c825
542 489 |\ desc: merge, phase: draft
543 490 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
544 491 | | desc: mv b c, phase: draft
545 492 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
546 493 | | desc: mv a b, phase: draft
547 494 o | changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
548 |/ desc: mod a, phase: public
495 |/ desc: mod a, phase: draft
549 496 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
550 desc: initial, phase: public
497 desc: initial, phase: draft
551 498 $ ls
552 499 c
553 500 $ cd ..
554 $ rm -rf server
555 501 $ rm -rf repo
556 502
557 503 Test shelve/unshelve
558 $ hg init server
559 $ initclient server
560 $ cd server
504 -------------------
505
506 $ hg init repo
507 $ initclient repo
508 $ cd repo
561 509 $ echo a > a
562 510 $ hg add a
563 511 $ hg ci -m initial
564 $ cd ..
565 $ hg clone -q server repo
566 $ initclient repo
567 $ cd repo
568 512 $ echo b > a
569 513 $ hg shelve
570 514 shelved as default
571 515 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 516 $ hg mv a b
573 517 $ hg ci -m 'mv a b'
574 518
575 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
519 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
576 520 @ changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
577 | desc: mv a b, phase: draft
521 | desc: mv a b
578 522 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
579 desc: initial, phase: public
523 desc: initial
580 524 $ hg unshelve
581 525 unshelving change 'default'
582 526 rebasing shelved changes
583 527 rebasing 2:45f63161acea "changes to: initial" (tip)
584 528 merging b and a to b
585 529 $ ls
586 530 b
587 531 $ cat b
588 532 b
589 533 $ cd ..
590 $ rm -rf server
591 534 $ rm -rf repo
592 535
593 536 Test full copytrace ability on draft branch
594 537 -------------------------------------------
595 538
596 539 File directory and base name changed in same move
597 540 $ hg init repo
598 541 $ initclient repo
599 542 $ mkdir repo/dir1
600 543 $ cd repo/dir1
601 544 $ echo a > a
602 545 $ hg add a
603 546 $ hg ci -qm initial
604 547 $ cd ..
605 548 $ hg mv -q dir1 dir2
606 549 $ hg mv dir2/a dir2/b
607 550 $ hg ci -qm 'mv a b; mv dir1 dir2'
608 551 $ hg up -q '.^'
609 552 $ cd dir1
610 553 $ echo b >> a
611 554 $ cd ..
612 555 $ hg ci -qm 'mod a'
613 556
614 557 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
615 558 @ changeset 6207d2d318e710b882e3d5ada2a89770efc42c96
616 559 | desc mod a, phase: draft
617 560 | o changeset abffdd4e3dfc04bc375034b970299b2a309a1cce
618 561 |/ desc mv a b; mv dir1 dir2, phase: draft
619 562 o changeset 81973cd24b58db2fdf18ce3d64fb2cc3284e9ab3
620 563 desc initial, phase: draft
621 564
622 $ hg rebase -s . -d 1
565 $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
623 566 rebasing 2:6207d2d318e7 "mod a" (tip)
624 567 merging dir2/b and dir1/a to dir2/b
625 568 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg (glob)
626 569 $ cat dir2/b
627 570 a
628 571 b
629 572 $ cd ..
630 $ rm -rf server
631 573 $ rm -rf repo
632 574
633 575 Move directory in one merge parent, while adding file to original directory
634 576 in other merge parent. File moved on rebase.
577
635 578 $ hg init repo
636 579 $ initclient repo
637 580 $ mkdir repo/dir1
638 581 $ cd repo/dir1
639 582 $ echo dummy > dummy
640 583 $ hg add dummy
641 584 $ cd ..
642 585 $ hg ci -qm initial
643 586 $ cd dir1
644 587 $ echo a > a
645 588 $ hg add a
646 589 $ cd ..
647 590 $ hg ci -qm 'hg add dir1/a'
648 591 $ hg up -q '.^'
649 592 $ hg mv -q dir1 dir2
650 593 $ hg ci -qm 'mv dir1 dir2'
651 594
652 595 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
653 596 @ changeset e8919e7df8d036e07b906045eddcd4a42ff1915f
654 597 | desc mv dir1 dir2, phase: draft
655 598 | o changeset 7c7c6f339be00f849c3cb2df738ca91db78b32c8
656 599 |/ desc hg add dir1/a, phase: draft
657 600 o changeset a235dcce55dcf42034c4e374cb200662d0bb4a13
658 601 desc initial, phase: draft
659 602
660 $ hg rebase -s . -d 1
603 $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
661 604 rebasing 2:e8919e7df8d0 "mv dir1 dir2" (tip)
662 605 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg (glob)
663 606 $ ls dir2
664 607 a
665 608 dummy
666 $ rm -rf server
667 609 $ rm -rf repo
668 610
669 611 Testing the sourcecommitlimit config
612 -----------------------------------
670 613
671 614 $ hg init repo
672 615 $ initclient repo
673 616 $ cd repo
674 617 $ echo a > a
675 618 $ hg ci -Aqm "added a"
676 619 $ echo "more things" >> a
677 620 $ hg ci -qm "added more things to a"
678 621 $ hg up 0
679 622 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
680 623 $ echo b > b
681 624 $ hg ci -Aqm "added b"
682 625 $ mkdir foo
683 626 $ hg mv a foo/bar
684 627 $ hg ci -m "Moved a to foo/bar"
685 628 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
686 629 @ changeset b4b0f7880e500b5c364a5f07b4a2b167de7a6fb0
687 630 | desc Moved a to foo/bar, phase: draft
688 631 o changeset 5f6d8a4bf34ab274ccc9f631c2536964b8a3666d
689 632 | desc added b, phase: draft
690 633 | o changeset 8b6e13696c38e8445a759516474640c2f8dddef6
691 634 |/ desc added more things to a, phase: draft
692 635 o changeset 9092f1db7931481f93b37d5c9fbcfc341bcd7318
693 636 desc added a, phase: draft
694 637
695 638 When the sourcecommitlimit is small and we have more drafts, we use heuristics only
696 639
697 $ hg rebase -s 8b6e13696 -d . --config experimental.copytrace.sourcecommitlimit=0
640 $ hg rebase -s 8b6e13696 -d .
698 641 rebasing 1:8b6e13696c38 "added more things to a"
699 642 other [source] changed a which local [dest] deleted
700 643 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
701 644 unresolved conflicts (see hg resolve, then hg rebase --continue)
702 645 [1]
703 646
704 647 But when we have "sourcecommitlimit > (no. of drafts from base to c1)", we do
705 648 fullcopytracing
706 649
707 650 $ hg rebase --abort
708 651 rebase aborted
709 $ hg rebase -s 8b6e13696 -d .
652 $ hg rebase -s 8b6e13696 -d . --config experimental.copytrace.sourcecommitlimit=100
710 653 rebasing 1:8b6e13696c38 "added more things to a"
711 654 merging foo/bar and a to foo/bar
712 655 saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg (glob)
713 656 $ cd ..
714 657 $ rm -rf repo
General Comments 0
You need to be logged in to leave comments. Login now