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