##// END OF EJS Templates
merge: consider the file merged when using :merge-{local,other}...
Martin von Zweigbergk -
r49415:50de0890 default
parent child Browse files
Show More
@@ -1,515 +1,514 b''
1 1 # Copyright (C) 2004, 2005 Canonical Ltd
2 2 #
3 3 # This program is free software; you can redistribute it and/or modify
4 4 # it under the terms of the GNU General Public License as published by
5 5 # the Free Software Foundation; either version 2 of the License, or
6 6 # (at your option) any later version.
7 7 #
8 8 # This program is distributed in the hope that it will be useful,
9 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 11 # GNU General Public License for more details.
12 12 #
13 13 # You should have received a copy of the GNU General Public License
14 14 # along with this program; if not, see <http://www.gnu.org/licenses/>.
15 15
16 16 # mbp: "you know that thing where cvs gives you conflict markers?"
17 17 # s: "i hate that."
18 18
19 19 from __future__ import absolute_import
20 20
21 21 from .i18n import _
22 22 from . import (
23 23 error,
24 24 mdiff,
25 25 pycompat,
26 26 )
27 27 from .utils import stringutil
28 28
29 29
30 30 def intersect(ra, rb):
31 31 """Given two ranges return the range where they intersect or None.
32 32
33 33 >>> intersect((0, 10), (0, 6))
34 34 (0, 6)
35 35 >>> intersect((0, 10), (5, 15))
36 36 (5, 10)
37 37 >>> intersect((0, 10), (10, 15))
38 38 >>> intersect((0, 9), (10, 15))
39 39 >>> intersect((0, 9), (7, 15))
40 40 (7, 9)
41 41 """
42 42 assert ra[0] <= ra[1]
43 43 assert rb[0] <= rb[1]
44 44
45 45 sa = max(ra[0], rb[0])
46 46 sb = min(ra[1], rb[1])
47 47 if sa < sb:
48 48 return sa, sb
49 49 else:
50 50 return None
51 51
52 52
53 53 def compare_range(a, astart, aend, b, bstart, bend):
54 54 """Compare a[astart:aend] == b[bstart:bend], without slicing."""
55 55 if (aend - astart) != (bend - bstart):
56 56 return False
57 57 for ia, ib in zip(
58 58 pycompat.xrange(astart, aend), pycompat.xrange(bstart, bend)
59 59 ):
60 60 if a[ia] != b[ib]:
61 61 return False
62 62 else:
63 63 return True
64 64
65 65
66 66 class Merge3Text(object):
67 67 """3-way merge of texts.
68 68
69 69 Given strings BASE, OTHER, THIS, tries to produce a combined text
70 70 incorporating the changes from both BASE->OTHER and BASE->THIS."""
71 71
72 72 def __init__(self, basetext, atext, btext, base=None, a=None, b=None):
73 73 self.basetext = basetext
74 74 self.atext = atext
75 75 self.btext = btext
76 76 if base is None:
77 77 base = mdiff.splitnewlines(basetext)
78 78 if a is None:
79 79 a = mdiff.splitnewlines(atext)
80 80 if b is None:
81 81 b = mdiff.splitnewlines(btext)
82 82 self.base = base
83 83 self.a = a
84 84 self.b = b
85 85
86 86 def merge_groups(self):
87 87 """Yield sequence of line groups. Each one is a tuple:
88 88
89 89 'unchanged', lines
90 90 Lines unchanged from base
91 91
92 92 'a', lines
93 93 Lines taken from a
94 94
95 95 'same', lines
96 96 Lines taken from a (and equal to b)
97 97
98 98 'b', lines
99 99 Lines taken from b
100 100
101 101 'conflict', (base_lines, a_lines, b_lines)
102 102 Lines from base were changed to either a or b and conflict.
103 103 """
104 104 for t in self.merge_regions():
105 105 what = t[0]
106 106 if what == b'unchanged':
107 107 yield what, self.base[t[1] : t[2]]
108 108 elif what == b'a' or what == b'same':
109 109 yield what, self.a[t[1] : t[2]]
110 110 elif what == b'b':
111 111 yield what, self.b[t[1] : t[2]]
112 112 elif what == b'conflict':
113 113 yield (
114 114 what,
115 115 (
116 116 self.base[t[1] : t[2]],
117 117 self.a[t[3] : t[4]],
118 118 self.b[t[5] : t[6]],
119 119 ),
120 120 )
121 121 else:
122 122 raise ValueError(what)
123 123
124 124 def merge_regions(self):
125 125 """Return sequences of matching and conflicting regions.
126 126
127 127 This returns tuples, where the first value says what kind we
128 128 have:
129 129
130 130 'unchanged', start, end
131 131 Take a region of base[start:end]
132 132
133 133 'same', astart, aend
134 134 b and a are different from base but give the same result
135 135
136 136 'a', start, end
137 137 Non-clashing insertion from a[start:end]
138 138
139 139 'conflict', zstart, zend, astart, aend, bstart, bend
140 140 Conflict between a and b, with z as common ancestor
141 141
142 142 Method is as follows:
143 143
144 144 The two sequences align only on regions which match the base
145 145 and both descendants. These are found by doing a two-way diff
146 146 of each one against the base, and then finding the
147 147 intersections between those regions. These "sync regions"
148 148 are by definition unchanged in both and easily dealt with.
149 149
150 150 The regions in between can be in any of three cases:
151 151 conflicted, or changed on only one side.
152 152 """
153 153
154 154 # section a[0:ia] has been disposed of, etc
155 155 iz = ia = ib = 0
156 156
157 157 for region in self.find_sync_regions():
158 158 zmatch, zend, amatch, aend, bmatch, bend = region
159 159 # print 'match base [%d:%d]' % (zmatch, zend)
160 160
161 161 matchlen = zend - zmatch
162 162 assert matchlen >= 0
163 163 assert matchlen == (aend - amatch)
164 164 assert matchlen == (bend - bmatch)
165 165
166 166 len_a = amatch - ia
167 167 len_b = bmatch - ib
168 168 len_base = zmatch - iz
169 169 assert len_a >= 0
170 170 assert len_b >= 0
171 171 assert len_base >= 0
172 172
173 173 # print 'unmatched a=%d, b=%d' % (len_a, len_b)
174 174
175 175 if len_a or len_b:
176 176 # try to avoid actually slicing the lists
177 177 equal_a = compare_range(
178 178 self.a, ia, amatch, self.base, iz, zmatch
179 179 )
180 180 equal_b = compare_range(
181 181 self.b, ib, bmatch, self.base, iz, zmatch
182 182 )
183 183 same = compare_range(self.a, ia, amatch, self.b, ib, bmatch)
184 184
185 185 if same:
186 186 yield b'same', ia, amatch
187 187 elif equal_a and not equal_b:
188 188 yield b'b', ib, bmatch
189 189 elif equal_b and not equal_a:
190 190 yield b'a', ia, amatch
191 191 elif not equal_a and not equal_b:
192 192 yield b'conflict', iz, zmatch, ia, amatch, ib, bmatch
193 193 else:
194 194 raise AssertionError(b"can't handle a=b=base but unmatched")
195 195
196 196 ia = amatch
197 197 ib = bmatch
198 198 iz = zmatch
199 199
200 200 # if the same part of the base was deleted on both sides
201 201 # that's OK, we can just skip it.
202 202
203 203 if matchlen > 0:
204 204 assert ia == amatch
205 205 assert ib == bmatch
206 206 assert iz == zmatch
207 207
208 208 yield b'unchanged', zmatch, zend
209 209 iz = zend
210 210 ia = aend
211 211 ib = bend
212 212
213 213 def find_sync_regions(self):
214 214 """Return a list of sync regions, where both descendants match the base.
215 215
216 216 Generates a list of (base1, base2, a1, a2, b1, b2). There is
217 217 always a zero-length sync region at the end of all the files.
218 218 """
219 219
220 220 ia = ib = 0
221 221 amatches = mdiff.get_matching_blocks(self.basetext, self.atext)
222 222 bmatches = mdiff.get_matching_blocks(self.basetext, self.btext)
223 223 len_a = len(amatches)
224 224 len_b = len(bmatches)
225 225
226 226 sl = []
227 227
228 228 while ia < len_a and ib < len_b:
229 229 abase, amatch, alen = amatches[ia]
230 230 bbase, bmatch, blen = bmatches[ib]
231 231
232 232 # there is an unconflicted block at i; how long does it
233 233 # extend? until whichever one ends earlier.
234 234 i = intersect((abase, abase + alen), (bbase, bbase + blen))
235 235 if i:
236 236 intbase = i[0]
237 237 intend = i[1]
238 238 intlen = intend - intbase
239 239
240 240 # found a match of base[i[0], i[1]]; this may be less than
241 241 # the region that matches in either one
242 242 assert intlen <= alen
243 243 assert intlen <= blen
244 244 assert abase <= intbase
245 245 assert bbase <= intbase
246 246
247 247 asub = amatch + (intbase - abase)
248 248 bsub = bmatch + (intbase - bbase)
249 249 aend = asub + intlen
250 250 bend = bsub + intlen
251 251
252 252 assert self.base[intbase:intend] == self.a[asub:aend], (
253 253 self.base[intbase:intend],
254 254 self.a[asub:aend],
255 255 )
256 256
257 257 assert self.base[intbase:intend] == self.b[bsub:bend]
258 258
259 259 sl.append((intbase, intend, asub, aend, bsub, bend))
260 260
261 261 # advance whichever one ends first in the base text
262 262 if (abase + alen) < (bbase + blen):
263 263 ia += 1
264 264 else:
265 265 ib += 1
266 266
267 267 intbase = len(self.base)
268 268 abase = len(self.a)
269 269 bbase = len(self.b)
270 270 sl.append((intbase, intbase, abase, abase, bbase, bbase))
271 271
272 272 return sl
273 273
274 274
275 275 def _verifytext(text, path, ui, opts):
276 276 """verifies that text is non-binary (unless opts[text] is passed,
277 277 then we just warn)"""
278 278 if stringutil.binary(text):
279 279 msg = _(b"%s looks like a binary file.") % path
280 280 if not opts.get('quiet'):
281 281 ui.warn(_(b'warning: %s\n') % msg)
282 282 if not opts.get('text'):
283 283 raise error.Abort(msg)
284 284 return text
285 285
286 286
287 287 def _picklabels(overrides):
288 288 if len(overrides) > 3:
289 289 raise error.Abort(_(b"can only specify three labels."))
290 290 result = [None, None, None]
291 291 for i, override in enumerate(overrides):
292 292 result[i] = override
293 293 return result
294 294
295 295
296 296 def _detect_newline(m3):
297 297 if len(m3.a) > 0:
298 298 if m3.a[0].endswith(b'\r\n'):
299 299 return b'\r\n'
300 300 elif m3.a[0].endswith(b'\r'):
301 301 return b'\r'
302 302 return b'\n'
303 303
304 304
305 305 def _minimize(a_lines, b_lines):
306 306 """Trim conflict regions of lines where A and B sides match.
307 307
308 308 Lines where both A and B have made the same changes at the beginning
309 309 or the end of each merge region are eliminated from the conflict
310 310 region and are instead considered the same.
311 311 """
312 312 alen = len(a_lines)
313 313 blen = len(b_lines)
314 314
315 315 # find matches at the front
316 316 ii = 0
317 317 while ii < alen and ii < blen and a_lines[ii] == b_lines[ii]:
318 318 ii += 1
319 319 startmatches = ii
320 320
321 321 # find matches at the end
322 322 ii = 0
323 323 while ii < alen and ii < blen and a_lines[-ii - 1] == b_lines[-ii - 1]:
324 324 ii += 1
325 325 endmatches = ii
326 326
327 327 lines_before = a_lines[:startmatches]
328 328 new_a_lines = a_lines[startmatches : alen - endmatches]
329 329 new_b_lines = b_lines[startmatches : blen - endmatches]
330 330 lines_after = a_lines[alen - endmatches :]
331 331 return lines_before, new_a_lines, new_b_lines, lines_after
332 332
333 333
334 334 def render_minimized(
335 335 m3,
336 336 name_a=None,
337 337 name_b=None,
338 338 start_marker=b'<<<<<<<',
339 339 mid_marker=b'=======',
340 340 end_marker=b'>>>>>>>',
341 341 ):
342 342 """Return merge in cvs-like form."""
343 343 newline = _detect_newline(m3)
344 344 conflicts = False
345 345 if name_a:
346 346 start_marker = start_marker + b' ' + name_a
347 347 if name_b:
348 348 end_marker = end_marker + b' ' + name_b
349 349 merge_groups = m3.merge_groups()
350 350 lines = []
351 351 for what, group_lines in merge_groups:
352 352 if what == b'conflict':
353 353 conflicts = True
354 354 base_lines, a_lines, b_lines = group_lines
355 355 minimized = _minimize(a_lines, b_lines)
356 356 lines_before, a_lines, b_lines, lines_after = minimized
357 357 lines.extend(lines_before)
358 358 lines.append(start_marker + newline)
359 359 lines.extend(a_lines)
360 360 lines.append(mid_marker + newline)
361 361 lines.extend(b_lines)
362 362 lines.append(end_marker + newline)
363 363 lines.extend(lines_after)
364 364 else:
365 365 lines.extend(group_lines)
366 366 return lines, conflicts
367 367
368 368
369 369 def render_merge3(m3, name_a, name_b, name_base):
370 370 """Render conflicts as 3-way conflict markers."""
371 371 newline = _detect_newline(m3)
372 372 conflicts = False
373 373 lines = []
374 374 for what, group_lines in m3.merge_groups():
375 375 if what == b'conflict':
376 376 base_lines, a_lines, b_lines = group_lines
377 377 conflicts = True
378 378 lines.append(b'<<<<<<< ' + name_a + newline)
379 379 lines.extend(a_lines)
380 380 lines.append(b'||||||| ' + name_base + newline)
381 381 lines.extend(base_lines)
382 382 lines.append(b'=======' + newline)
383 383 lines.extend(b_lines)
384 384 lines.append(b'>>>>>>> ' + name_b + newline)
385 385 else:
386 386 lines.extend(group_lines)
387 387 return lines, conflicts
388 388
389 389
390 390 def render_mergediff(m3, name_a, name_b, name_base):
391 391 """Render conflicts as conflict markers with one snapshot and one diff."""
392 392 newline = _detect_newline(m3)
393 393 lines = []
394 394 conflicts = False
395 395 for what, group_lines in m3.merge_groups():
396 396 if what == b'conflict':
397 397 base_lines, a_lines, b_lines = group_lines
398 398 base_text = b''.join(base_lines)
399 399 b_blocks = list(
400 400 mdiff.allblocks(
401 401 base_text,
402 402 b''.join(b_lines),
403 403 lines1=base_lines,
404 404 lines2=b_lines,
405 405 )
406 406 )
407 407 a_blocks = list(
408 408 mdiff.allblocks(
409 409 base_text,
410 410 b''.join(a_lines),
411 411 lines1=base_lines,
412 412 lines2=b_lines,
413 413 )
414 414 )
415 415
416 416 def matching_lines(blocks):
417 417 return sum(
418 418 block[1] - block[0]
419 419 for block, kind in blocks
420 420 if kind == b'='
421 421 )
422 422
423 423 def diff_lines(blocks, lines1, lines2):
424 424 for block, kind in blocks:
425 425 if kind == b'=':
426 426 for line in lines1[block[0] : block[1]]:
427 427 yield b' ' + line
428 428 else:
429 429 for line in lines1[block[0] : block[1]]:
430 430 yield b'-' + line
431 431 for line in lines2[block[2] : block[3]]:
432 432 yield b'+' + line
433 433
434 434 lines.append(b"<<<<<<<" + newline)
435 435 if matching_lines(a_blocks) < matching_lines(b_blocks):
436 436 lines.append(b"======= " + name_a + newline)
437 437 lines.extend(a_lines)
438 438 lines.append(b"------- " + name_base + newline)
439 439 lines.append(b"+++++++ " + name_b + newline)
440 440 lines.extend(diff_lines(b_blocks, base_lines, b_lines))
441 441 else:
442 442 lines.append(b"------- " + name_base + newline)
443 443 lines.append(b"+++++++ " + name_a + newline)
444 444 lines.extend(diff_lines(a_blocks, base_lines, a_lines))
445 445 lines.append(b"======= " + name_b + newline)
446 446 lines.extend(b_lines)
447 447 lines.append(b">>>>>>>" + newline)
448 448 conflicts = True
449 449 else:
450 450 lines.extend(group_lines)
451 451 return lines, conflicts
452 452
453 453
454 454 def _resolve(m3, sides):
455 455 lines = []
456 456 for what, group_lines in m3.merge_groups():
457 457 if what == b'conflict':
458 458 for side in sides:
459 459 lines.extend(group_lines[side])
460 460 else:
461 461 lines.extend(group_lines)
462 462 return lines
463 463
464 464
465 465 def simplemerge(ui, localctx, basectx, otherctx, **opts):
466 466 """Performs the simplemerge algorithm.
467 467
468 468 The merged result is written into `localctx`.
469 469 """
470 470
471 471 def readctx(ctx):
472 472 # Merges were always run in the working copy before, which means
473 473 # they used decoded data, if the user defined any repository
474 474 # filters.
475 475 #
476 476 # Maintain that behavior today for BC, though perhaps in the future
477 477 # it'd be worth considering whether merging encoded data (what the
478 478 # repository usually sees) might be more useful.
479 479 return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
480 480
481 481 try:
482 482 localtext = readctx(localctx)
483 483 basetext = readctx(basectx)
484 484 othertext = readctx(otherctx)
485 485 except error.Abort:
486 return 1
486 return True
487 487
488 488 m3 = Merge3Text(basetext, localtext, othertext)
489 489 conflicts = False
490 490 mode = opts.get('mode', b'merge')
491 491 if mode == b'union':
492 492 lines = _resolve(m3, (1, 2))
493 493 elif mode == b'local':
494 494 lines = _resolve(m3, (1,))
495 495 elif mode == b'other':
496 496 lines = _resolve(m3, (2,))
497 497 else:
498 498 name_a, name_b, name_base = _picklabels(opts.get('label', []))
499 499 if mode == b'mergediff':
500 500 lines, conflicts = render_mergediff(m3, name_a, name_b, name_base)
501 501 elif mode == b'merge3':
502 502 lines, conflicts = render_merge3(m3, name_a, name_b, name_base)
503 503 else:
504 504 lines, conflicts = render_minimized(m3, name_a, name_b)
505 505
506 506 mergedtext = b''.join(lines)
507 507 if opts.get('print'):
508 508 ui.fout.write(mergedtext)
509 509 else:
510 510 # localctx.flags() already has the merged flags (done in
511 511 # mergestate.resolve())
512 512 localctx.write(mergedtext, localctx.flags())
513 513
514 if conflicts:
515 return 1
514 return conflicts
@@ -1,1202 +1,1202 b''
1 1 $ cat >> "$HGRCPATH" << EOF
2 2 > [ui]
3 3 > merge = :merge3
4 4 > EOF
5 5
6 6 init
7 7
8 8 $ hg init repo
9 9 $ cd repo
10 10
11 11 commit
12 12
13 13 $ echo 'a' > a
14 14 $ hg ci -A -m test -u nobody -d '1 0'
15 15 adding a
16 16
17 17 annotate -c
18 18
19 19 $ hg annotate -c a
20 20 8435f90966e4: a
21 21
22 22 annotate -cl
23 23
24 24 $ hg annotate -cl a
25 25 8435f90966e4:1: a
26 26
27 27 annotate -d
28 28
29 29 $ hg annotate -d a
30 30 Thu Jan 01 00:00:01 1970 +0000: a
31 31
32 32 annotate -n
33 33
34 34 $ hg annotate -n a
35 35 0: a
36 36
37 37 annotate -nl
38 38
39 39 $ hg annotate -nl a
40 40 0:1: a
41 41
42 42 annotate -u
43 43
44 44 $ hg annotate -u a
45 45 nobody: a
46 46
47 47 annotate -cdnu
48 48
49 49 $ hg annotate -cdnu a
50 50 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
51 51
52 52 annotate -cdnul
53 53
54 54 $ hg annotate -cdnul a
55 55 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
56 56
57 57 annotate (JSON)
58 58
59 59 $ hg annotate -Tjson a
60 60 [
61 61 {
62 62 "lines": [{"line": "a\n", "rev": 0}],
63 63 "path": "a"
64 64 }
65 65 ]
66 66
67 67 $ hg annotate -Tjson -cdfnul a
68 68 [
69 69 {
70 70 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
71 71 "path": "a"
72 72 }
73 73 ]
74 74
75 75 log-like templating
76 76
77 77 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
78 78 0 8435: a
79 79
80 80 '{lineno}' field should be populated as necessary
81 81
82 82 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
83 83 0:1: a
84 84 $ hg annotate -Ta a \
85 85 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
86 86 0:1: a
87 87
88 88 $ cat <<EOF >>a
89 89 > a
90 90 > a
91 91 > EOF
92 92 $ hg ci -ma1 -d '1 0'
93 93 $ hg cp a b
94 94 $ hg ci -mb -d '1 0'
95 95 $ cat <<EOF >> b
96 96 > b4
97 97 > b5
98 98 > b6
99 99 > EOF
100 100 $ hg ci -mb2 -d '2 0'
101 101
102 102 default output of '{lines}' should be readable
103 103
104 104 $ hg annotate -T'{lines}' a
105 105 0: a
106 106 1: a
107 107 1: a
108 108 $ hg annotate -T'{join(lines, "\n")}' a
109 109 0: a
110 110
111 111 1: a
112 112
113 113 1: a
114 114
115 115 several filters can be applied to '{lines}'
116 116
117 117 $ hg annotate -T'{lines|json}\n' a
118 118 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
119 119 $ hg annotate -T'{lines|stringify}' a
120 120 0: a
121 121 1: a
122 122 1: a
123 123 $ hg annotate -T'{lines|count}\n' a
124 124 3
125 125
126 126 annotate multiple files (JSON)
127 127
128 128 $ hg annotate -Tjson a b
129 129 [
130 130 {
131 131 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
132 132 "path": "a"
133 133 },
134 134 {
135 135 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
136 136 "path": "b"
137 137 }
138 138 ]
139 139
140 140 annotate multiple files (template)
141 141
142 142 $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b
143 143 == a ==
144 144 0: a
145 145 1: a
146 146 1: a
147 147 == b ==
148 148 0: a
149 149 1: a
150 150 1: a
151 151 3: b4
152 152 3: b5
153 153 3: b6
154 154
155 155 annotate -n b
156 156
157 157 $ hg annotate -n b
158 158 0: a
159 159 1: a
160 160 1: a
161 161 3: b4
162 162 3: b5
163 163 3: b6
164 164
165 165 annotate --no-follow b
166 166
167 167 $ hg annotate --no-follow b
168 168 2: a
169 169 2: a
170 170 2: a
171 171 3: b4
172 172 3: b5
173 173 3: b6
174 174
175 175 annotate -nl b
176 176
177 177 $ hg annotate -nl b
178 178 0:1: a
179 179 1:2: a
180 180 1:3: a
181 181 3:4: b4
182 182 3:5: b5
183 183 3:6: b6
184 184
185 185 annotate -nf b
186 186
187 187 $ hg annotate -nf b
188 188 0 a: a
189 189 1 a: a
190 190 1 a: a
191 191 3 b: b4
192 192 3 b: b5
193 193 3 b: b6
194 194
195 195 annotate -nlf b
196 196
197 197 $ hg annotate -nlf b
198 198 0 a:1: a
199 199 1 a:2: a
200 200 1 a:3: a
201 201 3 b:4: b4
202 202 3 b:5: b5
203 203 3 b:6: b6
204 204
205 205 $ hg up -C 2
206 206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 207 $ cat <<EOF >> b
208 208 > b4
209 209 > c
210 210 > b5
211 211 > EOF
212 212 $ hg ci -mb2.1 -d '2 0'
213 213 created new head
214 214 $ hg merge
215 215 merging b
216 216 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
217 217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
218 218 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
219 219 [1]
220 220 $ cat b
221 221 a
222 222 a
223 223 a
224 224 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
225 225 b4
226 226 c
227 227 b5
228 228 ||||||| base
229 229 =======
230 230 b4
231 231 b5
232 232 b6
233 233 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
234 234 $ cat <<EOF > b
235 235 > a
236 236 > a
237 237 > a
238 238 > b4
239 239 > c
240 240 > b5
241 241 > EOF
242 242 $ hg resolve --mark -q
243 243 $ rm b.orig
244 244 $ hg ci -mmergeb -d '3 0'
245 245
246 246 annotate after merge
247 247
248 248 $ hg annotate -nf b
249 249 0 a: a
250 250 1 a: a
251 251 1 a: a
252 252 3 b: b4
253 253 4 b: c
254 254 3 b: b5
255 255
256 256 annotate after merge with -l
257 257
258 258 $ hg annotate -nlf b
259 259 0 a:1: a
260 260 1 a:2: a
261 261 1 a:3: a
262 262 3 b:4: b4
263 263 4 b:5: c
264 264 3 b:5: b5
265 265
266 266 $ hg up -C 1
267 267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
268 268 $ hg cp a b
269 269 $ cat <<EOF > b
270 270 > a
271 271 > z
272 272 > a
273 273 > EOF
274 274 $ hg ci -mc -d '3 0'
275 275 created new head
276 276 Work around the pure version not resolving the conflict like native code
277 277 #if pure
278 278 $ hg merge
279 279 merging b
280 280 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
281 281 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
282 282 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
283 283 [1]
284 284 $ cat <<EOF > b
285 285 > a
286 286 > z
287 287 > a
288 288 > b4
289 289 > c
290 290 > b5
291 291 > EOF
292 292 $ hg resolve -m b
293 293 (no more unresolved files)
294 294 $ rm b.orig
295 295 #else
296 296 $ hg merge
297 297 merging b
298 298 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
299 299 (branch merge, don't forget to commit)
300 300 #endif
301 301 $ echo d >> b
302 302 $ hg ci -mmerge2 -d '4 0'
303 303
304 304 annotate after rename merge
305 305
306 306 $ hg annotate -nf b
307 307 0 a: a
308 308 6 b: z
309 309 1 a: a
310 310 3 b: b4
311 311 4 b: c
312 312 3 b: b5
313 313 7 b: d
314 314
315 315 annotate after rename merge with -l
316 316
317 317 $ hg annotate -nlf b
318 318 0 a:1: a
319 319 6 b:2: z
320 320 1 a:3: a
321 321 3 b:4: b4
322 322 4 b:5: c
323 323 3 b:5: b5
324 324 7 b:7: d
325 325
326 326 --skip nothing (should be the same as no --skip at all)
327 327
328 328 $ hg annotate -nlf b --skip '1::0'
329 329 0 a:1: a
330 330 6 b:2: z
331 331 1 a:3: a
332 332 3 b:4: b4
333 333 4 b:5: c
334 334 3 b:5: b5
335 335 7 b:7: d
336 336
337 337 --skip a modified line. Note a slight behavior difference in pure - this is
338 338 because the pure code comes up with slightly different deltas internally.
339 339
340 340 $ hg annotate -nlf b --skip 6
341 341 0 a:1: a
342 342 1 a:2* z (no-pure !)
343 343 0 a:1* z (pure !)
344 344 1 a:3: a
345 345 3 b:4: b4
346 346 4 b:5: c
347 347 3 b:5: b5
348 348 7 b:7: d
349 349
350 350 --skip added lines (and test multiple skip)
351 351
352 352 $ hg annotate -nlf b --skip 3
353 353 0 a:1: a
354 354 6 b:2: z
355 355 1 a:3: a
356 356 1 a:3* b4
357 357 4 b:5: c
358 358 1 a:3* b5
359 359 7 b:7: d
360 360
361 361 $ hg annotate -nlf b --skip 4
362 362 0 a:1: a
363 363 6 b:2: z
364 364 1 a:3: a
365 365 3 b:4: b4
366 366 1 a:3* c
367 367 3 b:5: b5
368 368 7 b:7: d
369 369
370 370 $ hg annotate -nlf b --skip 3 --skip 4
371 371 0 a:1: a
372 372 6 b:2: z
373 373 1 a:3: a
374 374 1 a:3* b4
375 375 1 a:3* c
376 376 1 a:3* b5
377 377 7 b:7: d
378 378
379 379 $ hg annotate -nlf b --skip 'merge()'
380 380 0 a:1: a
381 381 6 b:2: z
382 382 1 a:3: a
383 383 3 b:4: b4
384 384 4 b:5: c
385 385 3 b:5: b5
386 386 3 b:5* d
387 387
388 388 --skip everything -- use the revision the file was introduced in
389 389
390 390 $ hg annotate -nlf b --skip 'all()'
391 391 0 a:1: a
392 392 0 a:1* z
393 393 0 a:1* a
394 394 0 a:1* b4
395 395 0 a:1* c
396 396 0 a:1* b5
397 397 0 a:1* d
398 398
399 399 Issue2807: alignment of line numbers with -l
400 400
401 401 $ echo more >> b
402 402 $ hg ci -mmore -d '5 0'
403 403 $ echo more >> b
404 404 $ hg ci -mmore -d '6 0'
405 405 $ echo more >> b
406 406 $ hg ci -mmore -d '7 0'
407 407 $ hg annotate -nlf b
408 408 0 a: 1: a
409 409 6 b: 2: z
410 410 1 a: 3: a
411 411 3 b: 4: b4
412 412 4 b: 5: c
413 413 3 b: 5: b5
414 414 7 b: 7: d
415 415 8 b: 8: more
416 416 9 b: 9: more
417 417 10 b:10: more
418 418
419 419 linkrev vs rev
420 420
421 421 $ hg annotate -r tip -n a
422 422 0: a
423 423 1: a
424 424 1: a
425 425
426 426 linkrev vs rev with -l
427 427
428 428 $ hg annotate -r tip -nl a
429 429 0:1: a
430 430 1:2: a
431 431 1:3: a
432 432
433 433 Issue589: "undelete" sequence leads to crash
434 434
435 435 annotate was crashing when trying to --follow something
436 436
437 437 like A -> B -> A
438 438
439 439 generate ABA rename configuration
440 440
441 441 $ echo foo > foo
442 442 $ hg add foo
443 443 $ hg ci -m addfoo
444 444 $ hg rename foo bar
445 445 $ hg ci -m renamefoo
446 446 $ hg rename bar foo
447 447 $ hg ci -m renamebar
448 448
449 449 annotate after ABA with follow
450 450
451 451 $ hg annotate --follow foo
452 452 foo: foo
453 453
454 454 missing file
455 455
456 456 $ hg ann nosuchfile
457 457 abort: nosuchfile: no such file in rev e9e6b4fa872f
458 458 [10]
459 459
460 460 annotate file without '\n' on last line
461 461
462 462 $ printf "" > c
463 463 $ hg ci -A -m test -u nobody -d '1 0'
464 464 adding c
465 465 $ hg annotate c
466 466 $ printf "a\nb" > c
467 467 $ hg ci -m test
468 468 $ hg annotate c
469 469 [0-9]+: a (re)
470 470 [0-9]+: b (re)
471 471
472 472 Issue3841: check annotation of the file of which filelog includes
473 473 merging between the revision and its ancestor
474 474
475 475 to reproduce the situation with recent Mercurial, this script uses (1)
476 476 "hg debugsetparents" to merge without ancestor check by "hg merge",
477 477 and (2) the extension to allow filelog merging between the revision
478 478 and its ancestor by overriding "repo._filecommit".
479 479
480 480 $ cat > ../legacyrepo.py <<EOF
481 481 > from __future__ import absolute_import
482 482 > from mercurial import commit, error, extensions
483 483 > def _filecommit(orig, repo, fctx, manifest1, manifest2,
484 484 > linkrev, tr, includecopymeta, ms):
485 485 > fname = fctx.path()
486 486 > text = fctx.data()
487 487 > flog = repo.file(fname)
488 488 > fparent1 = manifest1.get(fname, repo.nullid)
489 489 > fparent2 = manifest2.get(fname, repo.nullid)
490 490 > meta = {}
491 491 > copy = fctx.copysource()
492 492 > if copy and copy != fname:
493 493 > raise error.Abort('copying is not supported')
494 494 > if fparent2 != repo.nullid:
495 495 > return flog.add(text, meta, tr, linkrev,
496 496 > fparent1, fparent2), 'modified'
497 497 > raise error.Abort('only merging is supported')
498 498 > def uisetup(ui):
499 499 > extensions.wrapfunction(commit, '_filecommit', _filecommit)
500 500 > EOF
501 501
502 502 $ cat > baz <<EOF
503 503 > 1
504 504 > 2
505 505 > 3
506 506 > 4
507 507 > 5
508 508 > EOF
509 509 $ hg add baz
510 510 $ hg commit -m "baz:0"
511 511
512 512 $ cat > baz <<EOF
513 513 > 1 baz:1
514 514 > 2
515 515 > 3
516 516 > 4
517 517 > 5
518 518 > EOF
519 519 $ hg commit -m "baz:1"
520 520
521 521 $ cat > baz <<EOF
522 522 > 1 baz:1
523 523 > 2 baz:2
524 524 > 3
525 525 > 4
526 526 > 5
527 527 > EOF
528 528 $ hg debugsetparents 17 17
529 529 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
530 530 $ hg debugindexdot baz
531 531 digraph G {
532 532 -1 -> 0
533 533 0 -> 1
534 534 1 -> 2
535 535 1 -> 2
536 536 }
537 537 $ hg annotate baz
538 538 17: 1 baz:1
539 539 18: 2 baz:2
540 540 16: 3
541 541 16: 4
542 542 16: 5
543 543
544 544 $ cat > baz <<EOF
545 545 > 1 baz:1
546 546 > 2 baz:2
547 547 > 3 baz:3
548 548 > 4
549 549 > 5
550 550 > EOF
551 551 $ hg commit -m "baz:3"
552 552
553 553 $ cat > baz <<EOF
554 554 > 1 baz:1
555 555 > 2 baz:2
556 556 > 3 baz:3
557 557 > 4 baz:4
558 558 > 5
559 559 > EOF
560 560 $ hg debugsetparents 19 18
561 561 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
562 562 $ hg debugindexdot baz
563 563 digraph G {
564 564 -1 -> 0
565 565 0 -> 1
566 566 1 -> 2
567 567 1 -> 2
568 568 2 -> 3
569 569 3 -> 4
570 570 2 -> 4
571 571 }
572 572 $ hg annotate baz
573 573 17: 1 baz:1
574 574 18: 2 baz:2
575 575 19: 3 baz:3
576 576 20: 4 baz:4
577 577 16: 5
578 578
579 579 annotate clean file
580 580
581 581 $ hg annotate -ncr "wdir()" foo
582 582 11 472b18db256d : foo
583 583
584 584 annotate modified file
585 585
586 586 $ echo foofoo >> foo
587 587 $ hg annotate -r "wdir()" foo
588 588 11 : foo
589 589 20+: foofoo
590 590
591 591 $ hg annotate -cr "wdir()" foo
592 592 472b18db256d : foo
593 593 b6bedd5477e7+: foofoo
594 594
595 595 $ hg annotate -ncr "wdir()" foo
596 596 11 472b18db256d : foo
597 597 20 b6bedd5477e7+: foofoo
598 598
599 599 $ hg annotate --debug -ncr "wdir()" foo
600 600 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
601 601 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
602 602
603 603 $ hg annotate -udr "wdir()" foo
604 604 test Thu Jan 01 00:00:00 1970 +0000: foo
605 605 test [A-Za-z0-9:+ ]+: foofoo (re)
606 606
607 607 $ hg annotate -ncr "wdir()" -Tjson foo
608 608 [
609 609 {
610 610 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
611 611 "path": "foo"
612 612 }
613 613 ]
614 614
615 615 annotate added file
616 616
617 617 $ echo bar > bar
618 618 $ hg add bar
619 619 $ hg annotate -ncr "wdir()" bar
620 620 20 b6bedd5477e7+: bar
621 621
622 622 annotate renamed file
623 623
624 624 $ hg rename foo renamefoo2
625 625 $ hg annotate -ncr "wdir()" renamefoo2
626 626 11 472b18db256d : foo
627 627 20 b6bedd5477e7+: foofoo
628 628
629 629 annotate missing file
630 630
631 631 $ rm baz
632 632
633 633 $ hg annotate -ncr "wdir()" baz
634 634 abort: $TESTTMP\repo/baz: $ENOENT$ (windows !)
635 635 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
636 636 [255]
637 637
638 638 annotate removed file
639 639
640 640 $ hg rm baz
641 641
642 642 $ hg annotate -ncr "wdir()" baz
643 643 abort: $TESTTMP\repo/baz: $ENOENT$ (windows !)
644 644 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
645 645 [255]
646 646
647 647 $ hg revert --all --no-backup --quiet
648 648 $ hg id -n
649 649 20
650 650
651 651 Test followlines() revset; we usually check both followlines(pat, range) and
652 652 followlines(pat, range, descend=True) to make sure both give the same result
653 653 when they should.
654 654
655 655 $ echo a >> foo
656 656 $ hg ci -m 'foo: add a'
657 657 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
658 658 16: baz:0
659 659 19: baz:3
660 660 20: baz:4
661 661 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
662 662 16: baz:0
663 663 19: baz:3
664 664 20: baz:4
665 665 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
666 666 16: baz:0
667 667 19: baz:3
668 668 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
669 669 19: baz:3
670 670 20: baz:4
671 671 $ printf "0\n0\n" | cat - baz > baz1
672 672 $ mv baz1 baz
673 673 $ hg ci -m 'added two lines with 0'
674 674 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
675 675 16: baz:0
676 676 19: baz:3
677 677 20: baz:4
678 678 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
679 679 19: baz:3
680 680 20: baz:4
681 681 $ echo 6 >> baz
682 682 $ hg ci -m 'added line 8'
683 683 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
684 684 16: baz:0
685 685 19: baz:3
686 686 20: baz:4
687 687 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
688 688 19: baz:3
689 689 20: baz:4
690 690 $ sed 's/3/3+/' baz > baz.new
691 691 $ mv baz.new baz
692 692 $ hg ci -m 'baz:3->3+'
693 693 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
694 694 16: baz:0
695 695 19: baz:3
696 696 20: baz:4
697 697 24: baz:3->3+
698 698 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
699 699 19: baz:3
700 700 20: baz:4
701 701 24: baz:3->3+
702 702 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
703 703 22: added two lines with 0
704 704
705 705 file patterns are okay
706 706 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
707 707 22: added two lines with 0
708 708
709 709 renames are followed
710 710 $ hg mv baz qux
711 711 $ sed 's/4/4+/' qux > qux.new
712 712 $ mv qux.new qux
713 713 $ hg ci -m 'qux:4->4+'
714 714 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
715 715 16: baz:0
716 716 19: baz:3
717 717 20: baz:4
718 718 24: baz:3->3+
719 719 25: qux:4->4+
720 720
721 721 but are missed when following children
722 722 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
723 723 24: baz:3->3+
724 724
725 725 merge
726 726 $ hg up 24 --quiet
727 727 $ echo 7 >> baz
728 728 $ hg ci -m 'one more line, out of line range'
729 729 created new head
730 730 $ sed 's/3+/3-/' baz > baz.new
731 731 $ mv baz.new baz
732 732 $ hg ci -m 'baz:3+->3-'
733 733 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
734 734 16: baz:0
735 735 19: baz:3
736 736 20: baz:4
737 737 24: baz:3->3+
738 738 27: baz:3+->3-
739 739 $ hg merge 25
740 740 merging baz and qux to qux
741 741 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
742 742 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
743 743 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
744 744 [1]
745 745 $ cat qux
746 746 0
747 747 0
748 748 1 baz:1
749 749 2 baz:2
750 750 <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
751 751 3- baz:3
752 752 4 baz:4
753 753 ||||||| base
754 754 3+ baz:3
755 755 4 baz:4
756 756 =======
757 757 3+ baz:3
758 758 4+ baz:4
759 759 >>>>>>> merge rev: cb8df70ae185 - test: qux:4->4+
760 760 5
761 761 6
762 762 7
763 763 $ cat > qux <<EOF
764 764 > 0
765 765 > 0
766 766 > 1 baz:1
767 767 > 2 baz:2
768 768 > 3- baz:3
769 769 > 4 baz:4
770 770 > 5
771 771 > 6
772 772 > 7
773 773 > EOF
774 774 $ hg resolve --mark -q
775 775 $ rm qux.orig
776 776 $ hg ci -m merge
777 777 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
778 778 16: baz:0
779 779 19: baz:3
780 780 20: baz:4
781 781 24: baz:3->3+
782 782 25: qux:4->4+
783 783 27: baz:3+->3-
784 784 28: merge
785 785 $ hg up 25 --quiet
786 786 $ hg merge 27
787 787 merging qux and baz to qux
788 788 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
789 789 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
790 790 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
791 791 [1]
792 792 $ cat qux
793 793 0
794 794 0
795 795 1 baz:1
796 796 2 baz:2
797 797 <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
798 798 3+ baz:3
799 799 4+ baz:4
800 800 ||||||| base
801 801 3+ baz:3
802 802 4 baz:4
803 803 =======
804 804 3- baz:3
805 805 4 baz:4
806 806 >>>>>>> merge rev: 863de62655ef - test: baz:3+->3-
807 807 5
808 808 6
809 809 7
810 810 $ cat > qux <<EOF
811 811 > 0
812 812 > 0
813 813 > 1 baz:1
814 814 > 2 baz:2
815 815 > 3+ baz:3
816 816 > 4+ baz:4
817 817 > 5
818 818 > 6
819 819 > EOF
820 820 $ hg resolve --mark -q
821 821 $ rm qux.orig
822 822 $ hg ci -m 'merge from other side'
823 823 created new head
824 824 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
825 825 16: baz:0
826 826 19: baz:3
827 827 20: baz:4
828 828 24: baz:3->3+
829 829 25: qux:4->4+
830 830 27: baz:3+->3-
831 831 29: merge from other side
832 832 $ hg up 24 --quiet
833 833
834 834 we are missing the branch with rename when following children
835 835 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
836 836 27: baz:3+->3-
837 837
838 838 we follow all branches in descending direction
839 839 $ hg up 23 --quiet
840 840 $ sed 's/3/+3/' baz > baz.new
841 841 $ mv baz.new baz
842 842 $ hg ci -m 'baz:3->+3'
843 843 created new head
844 844 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
845 845 @ 30: baz:3->+3
846 846 :
847 847 : o 27: baz:3+->3-
848 848 : :
849 849 : o 24: baz:3->3+
850 850 :/
851 851 o 20: baz:4
852 852 |\
853 853 | o 19: baz:3
854 854 |/
855 855 o 18: baz:2
856 856 :
857 857 o 16: baz:0
858 858 |
859 859 ~
860 860
861 861 Issue5595: on a merge changeset with different line ranges depending on
862 862 parent, be conservative and use the surrounding interval to avoid loosing
863 863 track of possible further descendants in specified range.
864 864
865 865 $ hg up 23 --quiet
866 866 $ hg cat baz -r 24
867 867 0
868 868 0
869 869 1 baz:1
870 870 2 baz:2
871 871 3+ baz:3
872 872 4 baz:4
873 873 5
874 874 6
875 875 $ cat > baz << EOF
876 876 > 0
877 877 > 0
878 878 > a
879 879 > b
880 880 > 3+ baz:3
881 881 > 4 baz:4
882 882 > y
883 883 > z
884 884 > EOF
885 885 $ hg ci -m 'baz: mostly rewrite with some content from 24'
886 886 created new head
887 887 $ hg merge --tool :merge-other 24
888 888 merging baz
889 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
889 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
890 890 (branch merge, don't forget to commit)
891 891 $ hg ci -m 'merge forgetting about baz rewrite'
892 892 $ cat > baz << EOF
893 893 > 0
894 894 > 0
895 895 > 1 baz:1
896 896 > 2+ baz:2
897 897 > 3+ baz:3
898 898 > 4 baz:4
899 899 > 5
900 900 > 6
901 901 > EOF
902 902 $ hg ci -m 'baz: narrow change (2->2+)'
903 903 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
904 904 @ 33: baz: narrow change (2->2+)
905 905 |
906 906 o 32: merge forgetting about baz rewrite
907 907 |\
908 908 | o 31: baz: mostly rewrite with some content from 24
909 909 | :
910 910 | : o 30: baz:3->+3
911 911 | :/
912 912 +---o 27: baz:3+->3-
913 913 | :
914 914 o : 24: baz:3->3+
915 915 :/
916 916 o 20: baz:4
917 917 |\
918 918 ~ ~
919 919
920 920 An integer as a line range, which is parsed as '1:1'
921 921
922 922 $ hg log -r 'followlines(baz, 1)'
923 923 changeset: 22:2174d0bf352a
924 924 user: test
925 925 date: Thu Jan 01 00:00:00 1970 +0000
926 926 summary: added two lines with 0
927 927
928 928
929 929 check error cases
930 930 $ hg up 24 --quiet
931 931 $ hg log -r 'followlines()'
932 932 hg: parse error: followlines takes at least 1 positional arguments
933 933 [10]
934 934 $ hg log -r 'followlines(baz)'
935 935 hg: parse error: followlines requires a line range
936 936 [10]
937 937 $ hg log -r 'followlines(baz, x)'
938 938 hg: parse error: followlines expects a line number or a range
939 939 [10]
940 940 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
941 941 hg: parse error: followlines expects exactly one revision
942 942 [10]
943 943 $ hg log -r 'followlines("glob:*", 1:2)'
944 944 hg: parse error: followlines expects exactly one file
945 945 [10]
946 946 $ hg log -r 'followlines(baz, 1:)'
947 947 hg: parse error: line range bounds must be integers
948 948 [10]
949 949 $ hg log -r 'followlines(baz, :1)'
950 950 hg: parse error: line range bounds must be integers
951 951 [10]
952 952 $ hg log -r 'followlines(baz, x:4)'
953 953 hg: parse error: line range bounds must be integers
954 954 [10]
955 955 $ hg log -r 'followlines(baz, 5:4)'
956 956 hg: parse error: line range must be positive
957 957 [10]
958 958 $ hg log -r 'followlines(baz, 0:4)'
959 959 hg: parse error: fromline must be strictly positive
960 960 [10]
961 961 $ hg log -r 'followlines(baz, 2:40)'
962 962 abort: line range exceeds file size
963 963 [10]
964 964 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
965 965 hg: parse error at 43: not a prefix: [
966 966 (followlines(baz, 2:4, startrev=20, descend=[1])
967 967 ^ here)
968 968 [10]
969 969 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
970 970 hg: parse error: descend argument must be a boolean
971 971 [10]
972 972
973 973 Test empty annotate output
974 974
975 975 $ printf '\0' > binary
976 976 $ touch empty
977 977 $ hg ci -qAm 'add binary and empty files'
978 978
979 979 $ hg annotate binary empty
980 980 binary: binary file
981 981
982 982 $ hg annotate -Tjson binary empty
983 983 [
984 984 {
985 985 "path": "binary"
986 986 },
987 987 {
988 988 "lines": [],
989 989 "path": "empty"
990 990 }
991 991 ]
992 992
993 993 Test annotate with whitespace options
994 994
995 995 $ cd ..
996 996 $ hg init repo-ws
997 997 $ cd repo-ws
998 998 $ cat > a <<EOF
999 999 > aa
1000 1000 >
1001 1001 > b b
1002 1002 > EOF
1003 1003 $ hg ci -Am "adda"
1004 1004 adding a
1005 1005 $ sed 's/EOL$//g' > a <<EOF
1006 1006 > a a
1007 1007 >
1008 1008 > EOL
1009 1009 > b b
1010 1010 > EOF
1011 1011 $ hg ci -m "changea"
1012 1012
1013 1013 Annotate with no option
1014 1014
1015 1015 $ hg annotate a
1016 1016 1: a a
1017 1017 0:
1018 1018 1:
1019 1019 1: b b
1020 1020
1021 1021 Annotate with --ignore-space-change
1022 1022
1023 1023 $ hg annotate --ignore-space-change a
1024 1024 1: a a
1025 1025 1:
1026 1026 0:
1027 1027 0: b b
1028 1028
1029 1029 Annotate with --ignore-all-space
1030 1030
1031 1031 $ hg annotate --ignore-all-space a
1032 1032 0: a a
1033 1033 0:
1034 1034 1:
1035 1035 0: b b
1036 1036
1037 1037 Annotate with --ignore-blank-lines (similar to no options case)
1038 1038
1039 1039 $ hg annotate --ignore-blank-lines a
1040 1040 1: a a
1041 1041 0:
1042 1042 1:
1043 1043 1: b b
1044 1044
1045 1045 $ cd ..
1046 1046
1047 1047 Annotate with orphaned CR (issue5798)
1048 1048 -------------------------------------
1049 1049
1050 1050 $ hg init repo-cr
1051 1051 $ cd repo-cr
1052 1052
1053 1053 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
1054 1054 > import sys
1055 1055 > from mercurial.utils import procutil
1056 1056 > procutil.setbinary(sys.stdin)
1057 1057 > procutil.setbinary(sys.stdout)
1058 1058 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
1059 1059 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
1060 1060 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
1061 1061 > EOF
1062 1062
1063 1063 >>> with open('a', 'wb') as f:
1064 1064 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
1065 1065 $ hg ci -qAm0
1066 1066 >>> with open('a', 'wb') as f:
1067 1067 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
1068 1068 $ hg ci -m1
1069 1069
1070 1070 $ hg annotate -r0 a | "$PYTHON" "$TESTTMP/substcr.py"
1071 1071 0: 0a[CR]0b[CR]
1072 1072 0: 0c[CR]0d[CR]
1073 1073 0: 0e
1074 1074 0: 0f
1075 1075 0: 0g
1076 1076 $ hg annotate -r1 a | "$PYTHON" "$TESTTMP/substcr.py"
1077 1077 0: 0a[CR]0b[CR]
1078 1078 1: 1c[CR]1d[CR]
1079 1079 0: 0e
1080 1080 1: 1f
1081 1081 0: 0g
1082 1082
1083 1083 $ cd ..
1084 1084
1085 1085 Annotate with linkrev pointing to another branch
1086 1086 ------------------------------------------------
1087 1087
1088 1088 create history with a filerev whose linkrev points to another branch
1089 1089
1090 1090 $ hg init branchedlinkrev
1091 1091 $ cd branchedlinkrev
1092 1092 $ echo A > a
1093 1093 $ hg commit -Am 'contentA'
1094 1094 adding a
1095 1095 $ echo B >> a
1096 1096 $ hg commit -m 'contentB'
1097 1097 $ hg up --rev 'desc(contentA)'
1098 1098 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1099 1099 $ echo unrelated > unrelated
1100 1100 $ hg commit -Am 'unrelated'
1101 1101 adding unrelated
1102 1102 created new head
1103 1103 $ hg graft -r 'desc(contentB)'
1104 1104 grafting 1:fd27c222e3e6 "contentB"
1105 1105 $ echo C >> a
1106 1106 $ hg commit -m 'contentC'
1107 1107 $ echo W >> a
1108 1108 $ hg log -G
1109 1109 @ changeset: 4:072f1e8df249
1110 1110 | tag: tip
1111 1111 | user: test
1112 1112 | date: Thu Jan 01 00:00:00 1970 +0000
1113 1113 | summary: contentC
1114 1114 |
1115 1115 o changeset: 3:ff38df03cc4b
1116 1116 | user: test
1117 1117 | date: Thu Jan 01 00:00:00 1970 +0000
1118 1118 | summary: contentB
1119 1119 |
1120 1120 o changeset: 2:62aaf3f6fc06
1121 1121 | parent: 0:f0932f74827e
1122 1122 | user: test
1123 1123 | date: Thu Jan 01 00:00:00 1970 +0000
1124 1124 | summary: unrelated
1125 1125 |
1126 1126 | o changeset: 1:fd27c222e3e6
1127 1127 |/ user: test
1128 1128 | date: Thu Jan 01 00:00:00 1970 +0000
1129 1129 | summary: contentB
1130 1130 |
1131 1131 o changeset: 0:f0932f74827e
1132 1132 user: test
1133 1133 date: Thu Jan 01 00:00:00 1970 +0000
1134 1134 summary: contentA
1135 1135
1136 1136
1137 1137 Annotate should list ancestor of starting revision only
1138 1138
1139 1139 $ hg annotate a
1140 1140 0: A
1141 1141 3: B
1142 1142 4: C
1143 1143
1144 1144 $ hg annotate a -r 'wdir()'
1145 1145 0 : A
1146 1146 3 : B
1147 1147 4 : C
1148 1148 4+: W
1149 1149
1150 1150 Even when the starting revision is the linkrev-shadowed one:
1151 1151
1152 1152 $ hg annotate a -r 3
1153 1153 0: A
1154 1154 3: B
1155 1155
1156 1156 $ cd ..
1157 1157
1158 1158 Issue5360: Deleted chunk in p1 of a merge changeset
1159 1159
1160 1160 $ hg init repo-5360
1161 1161 $ cd repo-5360
1162 1162 $ echo 1 > a
1163 1163 $ hg commit -A a -m 1
1164 1164 $ echo 2 >> a
1165 1165 $ hg commit -m 2
1166 1166 $ echo a > a
1167 1167 $ hg commit -m a
1168 1168 $ hg update '.^' -q
1169 1169 $ echo 3 >> a
1170 1170 $ hg commit -m 3 -q
1171 1171 $ hg merge 2 -q
1172 1172 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1173 1173 [1]
1174 1174 $ cat a
1175 1175 <<<<<<< working copy: 0a068f0261cf - test: 3
1176 1176 1
1177 1177 2
1178 1178 3
1179 1179 ||||||| base
1180 1180 1
1181 1181 2
1182 1182 =======
1183 1183 a
1184 1184 >>>>>>> merge rev: 9409851bc20a - test: a
1185 1185 $ cat > a << EOF
1186 1186 > b
1187 1187 > 1
1188 1188 > 2
1189 1189 > 3
1190 1190 > a
1191 1191 > EOF
1192 1192 $ hg resolve --mark -q
1193 1193 $ rm a.orig
1194 1194 $ hg commit -m m
1195 1195 $ hg annotate a
1196 1196 4: b
1197 1197 0: 1
1198 1198 1: 2
1199 1199 3: 3
1200 1200 2: a
1201 1201
1202 1202 $ cd ..
@@ -1,422 +1,422 b''
1 1 $ hg init
2 2 $ cat << EOF > a
3 3 > Small Mathematical Series.
4 4 > One
5 5 > Two
6 6 > Three
7 7 > Four
8 8 > Five
9 9 > Hop we are done.
10 10 > EOF
11 11 $ hg add a
12 12 $ hg commit -m ancestor
13 13 $ cat << EOF > a
14 14 > Small Mathematical Series.
15 15 > 1
16 16 > 2
17 17 > 3
18 18 > 4
19 19 > 5
20 20 > Hop we are done.
21 21 > EOF
22 22 $ hg commit -m branch1
23 23 $ hg co 0
24 24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 25 $ cat << EOF > a
26 26 > Small Mathematical Series.
27 27 > 1
28 28 > 2
29 29 > 3
30 30 > 6
31 31 > 8
32 32 > Hop we are done.
33 33 > EOF
34 34 $ hg commit -m branch2
35 35 created new head
36 36
37 37 $ hg merge 1
38 38 merging a
39 39 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 40 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 41 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 42 [1]
43 43
44 44 $ hg id
45 45 618808747361+c0c68e4fe667+ tip
46 46
47 47 $ echo "[commands]" >> $HGRCPATH
48 48 $ echo "status.verbose=true" >> $HGRCPATH
49 49 $ hg status
50 50 M a
51 51 ? a.orig
52 52 # The repository is in an unfinished *merge* state.
53 53
54 54 # Unresolved merge conflicts:
55 55 #
56 56 # a
57 57 #
58 58 # To mark files as resolved: hg resolve --mark FILE
59 59
60 60 # To continue: hg commit
61 61 # To abort: hg merge --abort
62 62
63 63 $ hg status -Tjson
64 64 [
65 65 {
66 66 "itemtype": "file",
67 67 "path": "a",
68 68 "status": "M",
69 69 "unresolved": true
70 70 },
71 71 {
72 72 "itemtype": "file",
73 73 "path": "a.orig",
74 74 "status": "?"
75 75 },
76 76 {
77 77 "itemtype": "morestatus",
78 78 "unfinished": "merge",
79 79 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
80 80 }
81 81 ]
82 82
83 83 $ hg status -0
84 84 M a\x00? a.orig\x00 (no-eol) (esc)
85 85 $ cat a
86 86 Small Mathematical Series.
87 87 1
88 88 2
89 89 3
90 90 <<<<<<< working copy: 618808747361 - test: branch2
91 91 6
92 92 8
93 93 =======
94 94 4
95 95 5
96 96 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
97 97 Hop we are done.
98 98
99 99 $ hg status --config commands.status.verbose=0
100 100 M a
101 101 ? a.orig
102 102
103 103 Verify custom conflict markers
104 104
105 105 $ hg up -q --clean .
106 106 $ cat <<EOF >> .hg/hgrc
107 107 > [command-templates]
108 108 > mergemarker = '{author} {rev}'
109 109 > EOF
110 110
111 111 $ hg merge 1
112 112 merging a
113 113 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
114 114 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 115 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
116 116 [1]
117 117
118 118 $ cat a
119 119 Small Mathematical Series.
120 120 1
121 121 2
122 122 3
123 123 <<<<<<< working copy: test 2
124 124 6
125 125 8
126 126 =======
127 127 4
128 128 5
129 129 >>>>>>> merge rev: test 1
130 130 Hop we are done.
131 131
132 132 Verify custom conflict markers with legacy config name
133 133
134 134 $ hg up -q --clean .
135 135 $ cat <<EOF >> .hg/hgrc
136 136 > [ui]
137 137 > mergemarkertemplate = '{author} {rev}'
138 138 > EOF
139 139
140 140 $ hg merge 1
141 141 merging a
142 142 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
143 143 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
144 144 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
145 145 [1]
146 146
147 147 $ cat a
148 148 Small Mathematical Series.
149 149 1
150 150 2
151 151 3
152 152 <<<<<<< working copy: test 2
153 153 6
154 154 8
155 155 =======
156 156 4
157 157 5
158 158 >>>>>>> merge rev: test 1
159 159 Hop we are done.
160 160
161 161 Verify line splitting of custom conflict marker which causes multiple lines
162 162
163 163 $ hg up -q --clean .
164 164 $ cat >> .hg/hgrc <<EOF
165 165 > [command-templates]
166 166 > mergemarker={author} {rev}\nfoo\nbar\nbaz
167 167 > EOF
168 168
169 169 $ hg -q merge 1
170 170 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
171 171 [1]
172 172
173 173 $ cat a
174 174 Small Mathematical Series.
175 175 1
176 176 2
177 177 3
178 178 <<<<<<< working copy: test 2
179 179 6
180 180 8
181 181 =======
182 182 4
183 183 5
184 184 >>>>>>> merge rev: test 1
185 185 Hop we are done.
186 186
187 187 Verify line trimming of custom conflict marker using multi-byte characters
188 188
189 189 $ hg up -q --clean .
190 190 $ "$PYTHON" <<EOF
191 191 > fp = open('logfile', 'wb')
192 192 > fp.write(b'12345678901234567890123456789012345678901234567890' +
193 193 > b'1234567890') # there are 5 more columns for 80 columns
194 194 >
195 195 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
196 196 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
197 197 >
198 198 > fp.close()
199 199 > EOF
200 200 $ hg add logfile
201 201 $ hg --encoding utf-8 commit --logfile logfile
202 202
203 203 $ cat >> .hg/hgrc <<EOF
204 204 > [command-templates]
205 205 > mergemarker={desc|firstline}
206 206 > EOF
207 207
208 208 $ hg -q --encoding utf-8 merge 1
209 209 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
210 210 [1]
211 211
212 212 $ cat a
213 213 Small Mathematical Series.
214 214 1
215 215 2
216 216 3
217 217 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
218 218 6
219 219 8
220 220 =======
221 221 4
222 222 5
223 223 >>>>>>> merge rev: branch1
224 224 Hop we are done.
225 225
226 226 Verify basic conflict markers
227 227
228 228 $ hg up -q --clean 2
229 229 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
230 230
231 231 $ hg merge 1
232 232 merging a
233 233 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
234 234 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
235 235 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
236 236 [1]
237 237
238 238 $ cat a
239 239 Small Mathematical Series.
240 240 1
241 241 2
242 242 3
243 243 <<<<<<< working copy
244 244 6
245 245 8
246 246 =======
247 247 4
248 248 5
249 249 >>>>>>> merge rev
250 250 Hop we are done.
251 251
252 252 internal:merge3
253 253
254 254 $ hg up -q --clean .
255 255
256 256 $ hg merge 1 --tool internal:merge3
257 257 merging a
258 258 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 259 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 260 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
261 261 [1]
262 262 $ cat a
263 263 Small Mathematical Series.
264 264 <<<<<<< working copy
265 265 1
266 266 2
267 267 3
268 268 6
269 269 8
270 270 ||||||| base
271 271 One
272 272 Two
273 273 Three
274 274 Four
275 275 Five
276 276 =======
277 277 1
278 278 2
279 279 3
280 280 4
281 281 5
282 282 >>>>>>> merge rev
283 283 Hop we are done.
284 284
285 285 internal:mergediff
286 286
287 287 $ hg co -C 1
288 288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 289 $ cat << EOF > a
290 290 > Small Mathematical Series.
291 291 > 1
292 292 > 2
293 293 > 3
294 294 > 4
295 295 > 4.5
296 296 > 5
297 297 > Hop we are done.
298 298 > EOF
299 299 $ hg co -m 2 -t internal:mergediff
300 300 merging a
301 301 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
302 302 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
303 303 use 'hg resolve' to retry unresolved file merges
304 304 [1]
305 305 $ cat a
306 306 Small Mathematical Series.
307 307 1
308 308 2
309 309 3
310 310 <<<<<<<
311 311 ------- base
312 312 +++++++ working copy
313 313 4
314 314 +4.5
315 315 5
316 316 ======= destination
317 317 6
318 318 8
319 319 >>>>>>>
320 320 Hop we are done.
321 321 Test the same thing as above but modify a bit more so we instead get the working
322 322 copy in full and the diff from base to destination.
323 323 $ hg co -C 1
324 324 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 325 $ cat << EOF > a
326 326 > Small Mathematical Series.
327 327 > 1
328 328 > 2
329 329 > 3.5
330 330 > 4.5
331 331 > 5.5
332 332 > Hop we are done.
333 333 > EOF
334 334 $ hg co -m 2 -t internal:mergediff
335 335 merging a
336 336 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
337 337 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
338 338 use 'hg resolve' to retry unresolved file merges
339 339 [1]
340 340 $ cat a
341 341 Small Mathematical Series.
342 342 1
343 343 2
344 344 <<<<<<<
345 345 ======= working copy
346 346 3.5
347 347 4.5
348 348 5.5
349 349 ------- base
350 350 +++++++ destination
351 351 3
352 352 -4
353 353 -5
354 354 +6
355 355 +8
356 356 >>>>>>>
357 357 Hop we are done.
358 358
359 359 Add some unconflicting changes on each head, to make sure we really
360 360 are merging, unlike :local and :other
361 361
362 362 $ hg up -C
363 363 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 364 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
365 365 1 other heads for branch "default"
366 366 $ printf "\n\nEnd of file\n" >> a
367 367 $ hg ci -m "Add some stuff at the end"
368 368 $ hg up -r 1
369 369 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
370 370 $ printf "Start of file\n\n\n" > tmp
371 371 $ cat a >> tmp
372 372 $ mv tmp a
373 373 $ hg ci -m "Add some stuff at the beginning"
374 374
375 375 Now test :merge-other and :merge-local
376 376
377 377 $ hg merge
378 378 merging a
379 379 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
380 380 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
381 381 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
382 382 [1]
383 383 $ hg resolve --tool :merge-other a
384 384 merging a
385 385 (no more unresolved files)
386 386 $ cat a
387 387 Start of file
388 388
389 389
390 390 Small Mathematical Series.
391 391 1
392 392 2
393 393 3
394 394 6
395 395 8
396 396 Hop we are done.
397 397
398 398
399 399 End of file
400 400
401 401 $ hg up -C
402 402 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
403 403 updated to "18b51d585961: Add some stuff at the beginning"
404 404 1 other heads for branch "default"
405 405 $ hg merge --tool :merge-local
406 406 merging a
407 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
408 408 (branch merge, don't forget to commit)
409 409 $ cat a
410 410 Start of file
411 411
412 412
413 413 Small Mathematical Series.
414 414 1
415 415 2
416 416 3
417 417 4
418 418 5
419 419 Hop we are done.
420 420
421 421
422 422 End of file
@@ -1,3850 +1,3850 b''
1 1 #testcases filelog compatibility changeset sidedata upgraded upgraded-parallel pull push pull-upgrade push-upgrade
2 2
3 3 =====================================================
4 4 Test Copy tracing for chain of copies involving merge
5 5 =====================================================
6 6
7 7 This test files covers copies/rename case for a chains of commit where merges
8 8 are involved. It cheks we do not have unwanted update of behavior and that the
9 9 different options to retrieve copies behave correctly.
10 10
11 11
12 12 Setup
13 13 =====
14 14
15 15 use git diff to see rename
16 16
17 17 $ cat << EOF >> ./no-linkrev
18 18 > #!$PYTHON
19 19 > # filter out linkrev part of the debugindex command
20 20 > import sys
21 21 > for line in sys.stdin:
22 22 > if " linkrev " in line:
23 23 > print(line.rstrip())
24 24 > else:
25 25 > l = "%s *%s" % (line[:6], line[14:].rstrip())
26 26 > print(l)
27 27 > EOF
28 28
29 29 $ cat << EOF >> $HGRCPATH
30 30 > [diff]
31 31 > git=yes
32 32 > [command-templates]
33 33 > log={desc}\n
34 34 > EOF
35 35
36 36 #if compatibility
37 37 $ cat >> $HGRCPATH << EOF
38 38 > [experimental]
39 39 > copies.read-from = compatibility
40 40 > EOF
41 41 #endif
42 42
43 43 #if changeset
44 44 $ cat >> $HGRCPATH << EOF
45 45 > [experimental]
46 46 > copies.read-from = changeset-only
47 47 > copies.write-to = changeset-only
48 48 > EOF
49 49 #endif
50 50
51 51 #if sidedata
52 52 $ cat >> $HGRCPATH << EOF
53 53 > [format]
54 54 > exp-use-copies-side-data-changeset = yes
55 55 > EOF
56 56 #endif
57 57
58 58 #if pull
59 59 $ cat >> $HGRCPATH << EOF
60 60 > [format]
61 61 > exp-use-copies-side-data-changeset = yes
62 62 > EOF
63 63 #endif
64 64
65 65 #if push
66 66 $ cat >> $HGRCPATH << EOF
67 67 > [format]
68 68 > exp-use-copies-side-data-changeset = yes
69 69 > EOF
70 70 #endif
71 71
72 72 #if pull-upgrade
73 73 $ cat >> $HGRCPATH << EOF
74 74 > [format]
75 75 > exp-use-copies-side-data-changeset = no
76 76 > [experimental]
77 77 > changegroup4 = yes
78 78 > EOF
79 79 #endif
80 80
81 81 #if push-upgrade
82 82 $ cat >> $HGRCPATH << EOF
83 83 > [format]
84 84 > exp-use-copies-side-data-changeset = no
85 85 > [experimental]
86 86 > changegroup4 = yes
87 87 > EOF
88 88 #endif
89 89
90 90 $ cat > same-content.txt << EOF
91 91 > Here is some content that will be the same accros multiple file.
92 92 >
93 93 > This is done on purpose so that we end up in some merge situation, were the
94 94 > resulting content is the same as in the parent(s), but a new filenodes still
95 95 > need to be created to record some file history information (especially
96 96 > about copies).
97 97 > EOF
98 98
99 99 $ hg init repo-chain
100 100 $ cd repo-chain
101 101
102 102 Add some linear rename initialy
103 103
104 104 $ cp ../same-content.txt a
105 105 $ cp ../same-content.txt b
106 106 $ cp ../same-content.txt h
107 107 $ echo "original content for P" > p
108 108 $ echo "original content for Q" > q
109 109 $ echo "original content for R" > r
110 110 $ hg ci -Am 'i-0 initial commit: a b h p q r'
111 111 adding a
112 112 adding b
113 113 adding h
114 114 adding p
115 115 adding q
116 116 adding r
117 117 $ hg mv a c
118 118 $ hg mv p s
119 119 $ hg ci -Am 'i-1: a -move-> c, p -move-> s'
120 120 $ hg mv c d
121 121 $ hg mv s t
122 122 $ hg ci -Am 'i-2: c -move-> d, s -move-> t'
123 123 $ hg log -G
124 124 @ i-2: c -move-> d, s -move-> t
125 125 |
126 126 o i-1: a -move-> c, p -move-> s
127 127 |
128 128 o i-0 initial commit: a b h p q r
129 129
130 130
131 131 And having another branch with renames on the other side
132 132
133 133 $ hg mv d e
134 134 $ hg ci -Am 'a-1: d -move-> e'
135 135 $ hg mv e f
136 136 $ hg ci -Am 'a-2: e -move-> f'
137 137 $ hg log -G --rev '::.'
138 138 @ a-2: e -move-> f
139 139 |
140 140 o a-1: d -move-> e
141 141 |
142 142 o i-2: c -move-> d, s -move-> t
143 143 |
144 144 o i-1: a -move-> c, p -move-> s
145 145 |
146 146 o i-0 initial commit: a b h p q r
147 147
148 148
149 149 Have a branching with nothing on one side
150 150
151 151 $ hg up 'desc("i-2")'
152 152 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
153 153 $ echo foo > b
154 154 $ hg ci -m 'b-1: b update'
155 155 created new head
156 156 $ hg log -G --rev '::.'
157 157 @ b-1: b update
158 158 |
159 159 o i-2: c -move-> d, s -move-> t
160 160 |
161 161 o i-1: a -move-> c, p -move-> s
162 162 |
163 163 o i-0 initial commit: a b h p q r
164 164
165 165
166 166 Create a branch that delete a file previous renamed
167 167
168 168 $ hg up 'desc("i-2")'
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170 $ hg rm d
171 171 $ hg ci -m 'c-1 delete d'
172 172 created new head
173 173 $ hg log -G --rev '::.'
174 174 @ c-1 delete d
175 175 |
176 176 o i-2: c -move-> d, s -move-> t
177 177 |
178 178 o i-1: a -move-> c, p -move-> s
179 179 |
180 180 o i-0 initial commit: a b h p q r
181 181
182 182
183 183 Create a branch that delete a file previous renamed and recreate it
184 184
185 185 $ hg up 'desc("i-2")'
186 186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
187 187 $ hg rm d
188 188 $ hg ci -m 'd-1 delete d'
189 189 created new head
190 190 $ echo bar > d
191 191 $ hg add d
192 192 $ hg ci -m 'd-2 re-add d'
193 193 $ hg log -G --rev '::.'
194 194 @ d-2 re-add d
195 195 |
196 196 o d-1 delete d
197 197 |
198 198 o i-2: c -move-> d, s -move-> t
199 199 |
200 200 o i-1: a -move-> c, p -move-> s
201 201 |
202 202 o i-0 initial commit: a b h p q r
203 203
204 204
205 205 Having another branch renaming a different file to the same filename as another
206 206
207 207 $ hg up 'desc("i-2")'
208 208 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
209 209 $ hg mv b g
210 210 $ hg ci -m 'e-1 b -move-> g'
211 211 created new head
212 212 $ hg mv g f
213 213 $ hg ci -m 'e-2 g -move-> f'
214 214 $ hg log -G --rev '::.'
215 215 @ e-2 g -move-> f
216 216 |
217 217 o e-1 b -move-> g
218 218 |
219 219 o i-2: c -move-> d, s -move-> t
220 220 |
221 221 o i-1: a -move-> c, p -move-> s
222 222 |
223 223 o i-0 initial commit: a b h p q r
224 224
225 225 $ hg up -q null
226 226
227 227 Having a branch similar to the 'a' one, but moving the 'p' file around.
228 228
229 229 $ hg up 'desc("i-2")'
230 230 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 231 $ hg mv t u
232 232 $ hg ci -Am 'p-1: t -move-> u'
233 233 created new head
234 234 $ hg mv u v
235 235 $ hg ci -Am 'p-2: u -move-> v'
236 236 $ hg log -G --rev '::.'
237 237 @ p-2: u -move-> v
238 238 |
239 239 o p-1: t -move-> u
240 240 |
241 241 o i-2: c -move-> d, s -move-> t
242 242 |
243 243 o i-1: a -move-> c, p -move-> s
244 244 |
245 245 o i-0 initial commit: a b h p q r
246 246
247 247 $ hg up -q null
248 248
249 249 Having another branch renaming a different file to the same filename as another
250 250
251 251 $ hg up 'desc("i-2")'
252 252 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 253 $ hg mv r w
254 254 $ hg ci -m 'q-1 r -move-> w'
255 255 created new head
256 256 $ hg mv w v
257 257 $ hg ci -m 'q-2 w -move-> v'
258 258 $ hg log -G --rev '::.'
259 259 @ q-2 w -move-> v
260 260 |
261 261 o q-1 r -move-> w
262 262 |
263 263 o i-2: c -move-> d, s -move-> t
264 264 |
265 265 o i-1: a -move-> c, p -move-> s
266 266 |
267 267 o i-0 initial commit: a b h p q r
268 268
269 269 $ hg up -q null
270 270
271 271 Setup all merge
272 272 ===============
273 273
274 274 This is done beforehand to validate that the upgrade process creates valid copy
275 275 information.
276 276
277 277 merging with unrelated change does not interfere with the renames
278 278 ---------------------------------------------------------------
279 279
280 280 - rename on one side
281 281 - unrelated change on the other side
282 282
283 283 $ case_desc="simple merge - A side: multiple renames, B side: unrelated update"
284 284
285 285 $ hg up 'desc("b-1")'
286 286 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 287 $ hg merge 'desc("a-2")'
288 288 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
289 289 (branch merge, don't forget to commit)
290 290 $ hg ci -m "mBAm-0 $case_desc - one way"
291 291 $ hg up 'desc("a-2")'
292 292 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 293 $ hg merge 'desc("b-1")'
294 294 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
295 295 (branch merge, don't forget to commit)
296 296 $ hg ci -m "mABm-0 $case_desc - the other way"
297 297 created new head
298 298 $ hg log -G --rev '::(desc("mABm")+desc("mBAm"))'
299 299 @ mABm-0 simple merge - A side: multiple renames, B side: unrelated update - the other way
300 300 |\
301 301 +---o mBAm-0 simple merge - A side: multiple renames, B side: unrelated update - one way
302 302 | |/
303 303 | o b-1: b update
304 304 | |
305 305 o | a-2: e -move-> f
306 306 | |
307 307 o | a-1: d -move-> e
308 308 |/
309 309 o i-2: c -move-> d, s -move-> t
310 310 |
311 311 o i-1: a -move-> c, p -move-> s
312 312 |
313 313 o i-0 initial commit: a b h p q r
314 314
315 315
316 316
317 317 merging with the side having a delete
318 318 -------------------------------------
319 319
320 320 case summary:
321 321 - one with change to an unrelated file
322 322 - one deleting the change
323 323 and recreate an unrelated file after the merge
324 324
325 325 $ case_desc="simple merge - C side: delete a file with copies history , B side: unrelated update"
326 326
327 327 $ hg up 'desc("b-1")'
328 328 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
329 329 $ hg merge 'desc("c-1")'
330 330 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
331 331 (branch merge, don't forget to commit)
332 332 $ hg ci -m "mBCm-0 $case_desc - one way"
333 333 $ echo bar > d
334 334 $ hg add d
335 335 $ hg ci -m 'mBCm-1 re-add d'
336 336 $ hg up 'desc("c-1")'
337 337 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
338 338 $ hg merge 'desc("b-1")'
339 339 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
340 340 (branch merge, don't forget to commit)
341 341 $ hg ci -m "mCBm-0 $case_desc - the other way"
342 342 created new head
343 343 $ echo bar > d
344 344 $ hg add d
345 345 $ hg ci -m 'mCBm-1 re-add d'
346 346 $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
347 347 @ mCBm-1 re-add d
348 348 |
349 349 o mCBm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - the other way
350 350 |\
351 351 | | o mBCm-1 re-add d
352 352 | | |
353 353 +---o mBCm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - one way
354 354 | |/
355 355 | o c-1 delete d
356 356 | |
357 357 o | b-1: b update
358 358 |/
359 359 o i-2: c -move-> d, s -move-> t
360 360 |
361 361 o i-1: a -move-> c, p -move-> s
362 362 |
363 363 o i-0 initial commit: a b h p q r
364 364
365 365
366 366 Comparing with a merge re-adding the file afterward
367 367 ---------------------------------------------------
368 368
369 369 Merge:
370 370 - one with change to an unrelated file
371 371 - one deleting and recreating the change
372 372
373 373 $ case_desc="simple merge - B side: unrelated update, D side: delete and recreate a file (with different content)"
374 374
375 375 $ hg up 'desc("b-1")'
376 376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 377 $ hg merge 'desc("d-2")'
378 378 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
379 379 (branch merge, don't forget to commit)
380 380 $ hg ci -m "mBDm-0 $case_desc - one way"
381 381 $ hg up 'desc("d-2")'
382 382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 383 $ hg merge 'desc("b-1")'
384 384 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 385 (branch merge, don't forget to commit)
386 386 $ hg ci -m "mDBm-0 $case_desc - the other way"
387 387 created new head
388 388 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
389 389 @ mDBm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - the other way
390 390 |\
391 391 +---o mBDm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - one way
392 392 | |/
393 393 | o d-2 re-add d
394 394 | |
395 395 | o d-1 delete d
396 396 | |
397 397 o | b-1: b update
398 398 |/
399 399 o i-2: c -move-> d, s -move-> t
400 400 |
401 401 o i-1: a -move-> c, p -move-> s
402 402 |
403 403 o i-0 initial commit: a b h p q r
404 404
405 405
406 406
407 407 Comparing with a merge with colliding rename
408 408 --------------------------------------------
409 409
410 410 Subcase: new copy information on both side
411 411 ``````````````````````````````````````````
412 412
413 413 - the "e-" branch renaming b to f (through 'g')
414 414 - the "a-" branch renaming d to f (through e)
415 415
416 416 $ case_desc="merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f)"
417 417
418 418 $ hg up 'desc("a-2")'
419 419 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
420 420 $ hg merge 'desc("e-2")'
421 421 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
422 422 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
423 423 (branch merge, don't forget to commit)
424 424 $ hg ci -m "mAEm-0 $case_desc - one way"
425 425 $ hg up 'desc("e-2")'
426 426 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
427 427 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
428 428 $ hg merge 'desc("a-2")'
429 429 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
430 430 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
431 431 (branch merge, don't forget to commit)
432 432 $ hg ci -m "mEAm-0 $case_desc - the other way"
433 433 created new head
434 434 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
435 435 @ mEAm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - the other way
436 436 |\
437 437 +---o mAEm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - one way
438 438 | |/
439 439 | o e-2 g -move-> f
440 440 | |
441 441 | o e-1 b -move-> g
442 442 | |
443 443 o | a-2: e -move-> f
444 444 | |
445 445 o | a-1: d -move-> e
446 446 |/
447 447 o i-2: c -move-> d, s -move-> t
448 448 |
449 449 o i-1: a -move-> c, p -move-> s
450 450 |
451 451 o i-0 initial commit: a b h p q r
452 452
453 453
454 454 Subcase: new copy information on both side with an actual merge happening
455 455 `````````````````````````````````````````````````````````````````````````
456 456
457 457 - the "p-" branch renaming 't' to 'v' (through 'u')
458 458 - the "q-" branch renaming 'r' to 'v' (through 'w')
459 459
460 460 $ case_desc="merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content)"
461 461
462 462 $ hg up 'desc("p-2")'
463 463 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
464 464 $ hg merge 'desc("q-2")' --tool ':union'
465 465 merging v
466 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
466 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
467 467 (branch merge, don't forget to commit)
468 468 $ hg ci -m "mPQm-0 $case_desc - one way"
469 469 $ hg up 'desc("q-2")'
470 470 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
471 471 $ hg merge 'desc("p-2")' --tool ':union'
472 472 merging v
473 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
473 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
474 474 (branch merge, don't forget to commit)
475 475 $ hg ci -m "mQPm-0 $case_desc - the other way"
476 476 created new head
477 477 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
478 478 o mEAm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - the other way
479 479 |\
480 480 +---o mAEm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - one way
481 481 | |/
482 482 | o e-2 g -move-> f
483 483 | |
484 484 | o e-1 b -move-> g
485 485 | |
486 486 o | a-2: e -move-> f
487 487 | |
488 488 o | a-1: d -move-> e
489 489 |/
490 490 o i-2: c -move-> d, s -move-> t
491 491 |
492 492 o i-1: a -move-> c, p -move-> s
493 493 |
494 494 o i-0 initial commit: a b h p q r
495 495
496 496
497 497 Subcase: existing copy information overwritten on one branch
498 498 ````````````````````````````````````````````````````````````
499 499
500 500 Merge:
501 501 - one with change to an unrelated file (b)
502 502 - one overwriting a file (d) with a rename (from h to i to d)
503 503
504 504 $ case_desc="simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d)"
505 505
506 506 $ hg up 'desc("i-2")'
507 507 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
508 508 $ hg mv h i
509 509 $ hg commit -m "f-1: rename h -> i"
510 510 created new head
511 511 $ hg mv --force i d
512 512 $ hg commit -m "f-2: rename i -> d"
513 513 $ hg debugindex d | "$PYTHON" ../no-linkrev
514 514 rev linkrev nodeid p1 p2
515 515 0 * d8252ab2e760 000000000000 000000000000 (no-changeset !)
516 516 0 * ae258f702dfe 000000000000 000000000000 (changeset !)
517 517 1 * b004912a8510 000000000000 000000000000
518 518 2 * 7b79e2fe0c89 000000000000 000000000000 (no-changeset !)
519 519 $ hg up 'desc("b-1")'
520 520 3 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
521 521 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
522 522 $ hg merge 'desc("f-2")'
523 523 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
524 524 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
525 525 (branch merge, don't forget to commit)
526 526 $ hg ci -m "mBFm-0 $case_desc - one way"
527 527 $ hg up 'desc("f-2")'
528 528 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
529 529 $ hg merge 'desc("b-1")'
530 530 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 531 (branch merge, don't forget to commit)
532 532 $ hg ci -m "mFBm-0 $case_desc - the other way"
533 533 created new head
534 534 $ hg up null --quiet
535 535 $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
536 536 o mFBm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
537 537 |\
538 538 +---o mBFm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
539 539 | |/
540 540 | o f-2: rename i -> d
541 541 | |
542 542 | o f-1: rename h -> i
543 543 | |
544 544 o | b-1: b update
545 545 |/
546 546 o i-2: c -move-> d, s -move-> t
547 547 |
548 548 o i-1: a -move-> c, p -move-> s
549 549 |
550 550 o i-0 initial commit: a b h p q r
551 551
552 552
553 553 Subcase: existing copy information overwritten on one branch, with different content)
554 554 `````````````````````````````````````````````````````````````````````````````````````
555 555
556 556 Merge:
557 557 - one with change to an unrelated file (b)
558 558 - one overwriting a file (t) with a rename (from r to x to t), v content is not the same as on the other branch
559 559
560 560 $ case_desc="simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content"
561 561
562 562 $ hg up 'desc("i-2")'
563 563 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
564 564 $ hg mv r x
565 565 $ hg commit -m "r-1: rename r -> x"
566 566 created new head
567 567 $ hg mv --force x t
568 568 $ hg commit -m "r-2: rename t -> x"
569 569 $ hg debugindex t | "$PYTHON" ../no-linkrev
570 570 rev linkrev nodeid p1 p2
571 571 0 * d74efbf65309 000000000000 000000000000 (no-changeset !)
572 572 1 * 02a930b9d7ad 000000000000 000000000000 (no-changeset !)
573 573 0 * 5aed6a8dbff0 000000000000 000000000000 (changeset !)
574 574 1 * a38b2fa17021 000000000000 000000000000 (changeset !)
575 575 $ hg up 'desc("b-1")'
576 576 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
577 577 $ hg merge 'desc("r-2")'
578 578 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
579 579 (branch merge, don't forget to commit)
580 580 $ hg ci -m "mBRm-0 $case_desc - one way"
581 581 $ hg up 'desc("r-2")'
582 582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 583 $ hg merge 'desc("b-1")'
584 584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 585 (branch merge, don't forget to commit)
586 586 $ hg ci -m "mRBm-0 $case_desc - the other way"
587 587 created new head
588 588 $ hg up null --quiet
589 589 $ hg log -G --rev '::(desc("mBRm")+desc("mRBm"))'
590 590 o mRBm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - the other way
591 591 |\
592 592 +---o mBRm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - one way
593 593 | |/
594 594 | o r-2: rename t -> x
595 595 | |
596 596 | o r-1: rename r -> x
597 597 | |
598 598 o | b-1: b update
599 599 |/
600 600 o i-2: c -move-> d, s -move-> t
601 601 |
602 602 o i-1: a -move-> c, p -move-> s
603 603 |
604 604 o i-0 initial commit: a b h p q r
605 605
606 606
607 607
608 608 Subcase: reset of the copy history on one side
609 609 ``````````````````````````````````````````````
610 610
611 611 Merge:
612 612 - one with change to a file
613 613 - one deleting and recreating the file
614 614
615 615 Unlike in the 'BD/DB' cases, an actual merge happened here. So we should
616 616 consider history and rename on both branch of the merge.
617 617
618 618 $ case_desc="actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content"
619 619
620 620 $ hg up 'desc("i-2")'
621 621 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
622 622 $ echo "some update" >> d
623 623 $ hg commit -m "g-1: update d"
624 624 created new head
625 625 $ hg up 'desc("d-2")'
626 626 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 627 $ hg merge 'desc("g-1")' --tool :union
628 628 merging d
629 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
629 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
630 630 (branch merge, don't forget to commit)
631 631 $ hg ci -m "mDGm-0 $case_desc - one way"
632 632 $ hg up 'desc("g-1")'
633 633 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
634 634 $ hg merge 'desc("d-2")' --tool :union
635 635 merging d
636 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
636 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
637 637 (branch merge, don't forget to commit)
638 638 $ hg ci -m "mGDm-0 $case_desc - the other way"
639 639 created new head
640 640 $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
641 641 @ mGDm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - the other way
642 642 |\
643 643 +---o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
644 644 | |/
645 645 | o g-1: update d
646 646 | |
647 647 o | d-2 re-add d
648 648 | |
649 649 o | d-1 delete d
650 650 |/
651 651 o i-2: c -move-> d, s -move-> t
652 652 |
653 653 o i-1: a -move-> c, p -move-> s
654 654 |
655 655 o i-0 initial commit: a b h p q r
656 656
657 657
658 658 Subcase: merging a change to a file with a "copy overwrite" to that file from another branch
659 659 ````````````````````````````````````````````````````````````````````````````````````````````
660 660
661 661 Merge:
662 662 - one with change to a file (d)
663 663 - one overwriting that file with a rename (from h to i, to d)
664 664
665 665 This case is similar to BF/FB, but an actual merge happens, so both side of the
666 666 history are relevant.
667 667
668 668 Note:
669 669 | In this case, the merge get conflicting information since on one side we have
670 670 | "a -> c -> d". and one the other one we have "h -> i -> d".
671 671 |
672 672 | The current code arbitrarily pick one side
673 673
674 674 $ case_desc="merge - G side: content change, F side: copy overwrite, no content change"
675 675
676 676 $ hg up 'desc("f-2")'
677 677 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
678 678 $ hg merge 'desc("g-1")' --tool :union
679 679 merging d (no-changeset !)
680 680 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (no-changeset !)
681 681 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
682 682 (branch merge, don't forget to commit)
683 683 $ hg ci -m "mFGm-0 $case_desc - one way"
684 684 created new head
685 685 $ hg up 'desc("g-1")'
686 686 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
687 687 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
688 688 $ hg merge 'desc("f-2")' --tool :union
689 689 merging d (no-changeset !)
690 690 0 files updated, 1 files merged, 1 files removed, 0 files unresolved (no-changeset !)
691 691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
692 692 (branch merge, don't forget to commit)
693 693 $ hg ci -m "mGFm-0 $case_desc - the other way"
694 694 created new head
695 695 $ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
696 696 @ mGFm-0 merge - G side: content change, F side: copy overwrite, no content change - the other way
697 697 |\
698 698 +---o mFGm-0 merge - G side: content change, F side: copy overwrite, no content change - one way
699 699 | |/
700 700 | o g-1: update d
701 701 | |
702 702 o | f-2: rename i -> d
703 703 | |
704 704 o | f-1: rename h -> i
705 705 |/
706 706 o i-2: c -move-> d, s -move-> t
707 707 |
708 708 o i-1: a -move-> c, p -move-> s
709 709 |
710 710 o i-0 initial commit: a b h p q r
711 711
712 712
713 713
714 714 Comparing with merging with a deletion (and keeping the file)
715 715 -------------------------------------------------------------
716 716
717 717 Merge:
718 718 - one removing a file (d)
719 719 - one updating that file
720 720 - the merge keep the modified version of the file (canceling the delete)
721 721
722 722 In this case, the file keep on living after the merge. So we should not drop its
723 723 copy tracing chain.
724 724
725 725 $ case_desc="merge updated/deleted - revive the file (updated content)"
726 726
727 727 $ hg up 'desc("c-1")'
728 728 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
729 729 $ hg merge 'desc("g-1")'
730 730 file 'd' was deleted in local [working copy] but was modified in other [merge rev].
731 731 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
732 732 What do you want to do? u
733 733 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
734 734 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
735 735 [1]
736 736 $ hg resolve -t :other d
737 737 (no more unresolved files)
738 738 $ hg ci -m "mCGm-0 $case_desc - one way"
739 739 created new head
740 740
741 741 $ hg up 'desc("g-1")'
742 742 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
743 743 $ hg merge 'desc("c-1")'
744 744 file 'd' was deleted in other [merge rev] but was modified in local [working copy].
745 745 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
746 746 What do you want to do? u
747 747 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
748 748 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
749 749 [1]
750 750 $ hg resolve -t :local d
751 751 (no more unresolved files)
752 752 $ hg ci -m "mGCm-0 $case_desc - the other way"
753 753 created new head
754 754
755 755 $ hg log -G --rev '::(desc("mCGm")+desc("mGCm"))'
756 756 @ mGCm-0 merge updated/deleted - revive the file (updated content) - the other way
757 757 |\
758 758 +---o mCGm-0 merge updated/deleted - revive the file (updated content) - one way
759 759 | |/
760 760 | o g-1: update d
761 761 | |
762 762 o | c-1 delete d
763 763 |/
764 764 o i-2: c -move-> d, s -move-> t
765 765 |
766 766 o i-1: a -move-> c, p -move-> s
767 767 |
768 768 o i-0 initial commit: a b h p q r
769 769
770 770
771 771
772 772
773 773 Comparing with merge restoring an untouched deleted file
774 774 --------------------------------------------------------
775 775
776 776 Merge:
777 777 - one removing a file (d)
778 778 - one leaving the file untouched
779 779 - the merge actively restore the file to the same content.
780 780
781 781 In this case, the file keep on living after the merge. So we should not drop its
782 782 copy tracing chain.
783 783
784 784 $ case_desc="merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge)"
785 785
786 786 $ hg up 'desc("c-1")'
787 787 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
788 788 $ hg merge 'desc("b-1")'
789 789 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
790 790 (branch merge, don't forget to commit)
791 791 $ hg revert --rev 'desc("b-1")' d
792 792 $ hg ci -m "mCB-revert-m-0 $case_desc - one way"
793 793 created new head
794 794
795 795 $ hg up 'desc("b-1")'
796 796 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
797 797 $ hg merge 'desc("c-1")'
798 798 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 799 (branch merge, don't forget to commit)
800 800 $ hg revert --rev 'desc("b-1")' d
801 801 $ hg ci -m "mBC-revert-m-0 $case_desc - the other way"
802 802 created new head
803 803
804 804 $ hg log -G --rev '::(desc("mCB-revert-m")+desc("mBC-revert-m"))'
805 805 @ mBC-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
806 806 |\
807 807 +---o mCB-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
808 808 | |/
809 809 | o c-1 delete d
810 810 | |
811 811 o | b-1: b update
812 812 |/
813 813 o i-2: c -move-> d, s -move-> t
814 814 |
815 815 o i-1: a -move-> c, p -move-> s
816 816 |
817 817 o i-0 initial commit: a b h p q r
818 818
819 819
820 820
821 821 $ hg up null --quiet
822 822
823 823 Merging a branch where a rename was deleted with a branch where the same file was renamed
824 824 ------------------------------------------------------------------------------------------
825 825
826 826 Create a "conflicting" merge where `d` get removed on one branch before its
827 827 rename information actually conflict with the other branch.
828 828
829 829 (the copy information from the branch that was not deleted should win).
830 830
831 831 $ case_desc="simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch)"
832 832
833 833 $ hg up 'desc("i-0")'
834 834 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
835 835 $ hg mv b d
836 836 $ hg ci -m "h-1: b -(move)-> d"
837 837 created new head
838 838
839 839 $ hg up 'desc("c-1")'
840 840 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
841 841 $ hg merge 'desc("h-1")'
842 842 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
843 843 (branch merge, don't forget to commit)
844 844 $ hg ci -m "mCH-delete-before-conflict-m-0 $case_desc - one way"
845 845
846 846 $ hg up 'desc("h-1")'
847 847 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
848 848 $ hg merge 'desc("c-1")'
849 849 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
850 850 (branch merge, don't forget to commit)
851 851 $ hg ci -m "mHC-delete-before-conflict-m-0 $case_desc - the other way"
852 852 created new head
853 853 $ hg log -G --rev '::(desc("mCH-delete-before-conflict-m")+desc("mHC-delete-before-conflict-m"))'
854 854 @ mHC-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - the other way
855 855 |\
856 856 +---o mCH-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - one way
857 857 | |/
858 858 | o h-1: b -(move)-> d
859 859 | |
860 860 o | c-1 delete d
861 861 | |
862 862 o | i-2: c -move-> d, s -move-> t
863 863 | |
864 864 o | i-1: a -move-> c, p -move-> s
865 865 |/
866 866 o i-0 initial commit: a b h p q r
867 867
868 868
869 869 Variant of previous with extra changes introduced by the merge
870 870 --------------------------------------------------------------
871 871
872 872 Multiple cases above explicitely test cases where content are the same on both side during merge. In this section we will introduce variants for theses cases where new change are introduced to these file content during the merges.
873 873
874 874
875 875 Subcase: merge has same initial content on both side, but merge introduced a change
876 876 ```````````````````````````````````````````````````````````````````````````````````
877 877
878 878 Same as `mAEm` and `mEAm` but with extra change to the file before commiting
879 879
880 880 - the "e-" branch renaming b to f (through 'g')
881 881 - the "a-" branch renaming d to f (through e)
882 882
883 883 $ case_desc="merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent)"
884 884
885 885 $ hg up 'desc("a-2")'
886 886 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
887 887 $ hg merge 'desc("e-2")'
888 888 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
889 889 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
890 890 (branch merge, don't forget to commit)
891 891 $ echo "content change for mAE-change-m" > f
892 892 $ hg ci -m "mAE-change-m-0 $case_desc - one way"
893 893 created new head
894 894 $ hg up 'desc("e-2")'
895 895 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
896 896 $ hg merge 'desc("a-2")'
897 897 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
898 898 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
899 899 (branch merge, don't forget to commit)
900 900 $ echo "content change for mEA-change-m" > f
901 901 $ hg ci -m "mEA-change-m-0 $case_desc - the other way"
902 902 created new head
903 903 $ hg log -G --rev '::(desc("mAE-change-m")+desc("mEA-change-m"))'
904 904 @ mEA-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - the other way
905 905 |\
906 906 +---o mAE-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - one way
907 907 | |/
908 908 | o e-2 g -move-> f
909 909 | |
910 910 | o e-1 b -move-> g
911 911 | |
912 912 o | a-2: e -move-> f
913 913 | |
914 914 o | a-1: d -move-> e
915 915 |/
916 916 o i-2: c -move-> d, s -move-> t
917 917 |
918 918 o i-1: a -move-> c, p -move-> s
919 919 |
920 920 o i-0 initial commit: a b h p q r
921 921
922 922
923 923 Subcase: merge overwrite common copy information, but with extra change during the merge
924 924 ````````````````````````````````````````````````````````````````````````````````````````
925 925
926 926 Merge:
927 927 - one with change to an unrelated file (b)
928 928 - one overwriting a file (d) with a rename (from h to i to d)
929 929 - the merge update f content
930 930
931 931 $ case_desc="merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d)"
932 932
933 933 $ hg up 'desc("f-2")'
934 934 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
935 935 #if no-changeset
936 936 $ hg debugindex d | "$PYTHON" ../no-linkrev
937 937 rev linkrev nodeid p1 p2
938 938 0 * d8252ab2e760 000000000000 000000000000
939 939 1 * b004912a8510 000000000000 000000000000
940 940 2 * 7b79e2fe0c89 000000000000 000000000000
941 941 3 * 17ec97e60577 d8252ab2e760 000000000000
942 942 4 * 06dabf50734c b004912a8510 17ec97e60577
943 943 5 * 19c0e3924691 17ec97e60577 b004912a8510
944 944 6 * 89c873a01d97 7b79e2fe0c89 17ec97e60577
945 945 7 * d55cb4e9ef57 000000000000 000000000000
946 946 #else
947 947 $ hg debugindex d | "$PYTHON" ../no-linkrev
948 948 rev linkrev nodeid p1 p2
949 949 0 * ae258f702dfe 000000000000 000000000000
950 950 1 * b004912a8510 000000000000 000000000000
951 951 2 * 5cce88bf349f ae258f702dfe 000000000000
952 952 3 * cc269dd788c8 b004912a8510 5cce88bf349f
953 953 4 * 51c91a115080 5cce88bf349f b004912a8510
954 954 #endif
955 955 $ hg up 'desc("b-1")'
956 956 3 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
957 957 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
958 958 $ hg merge 'desc("f-2")'
959 959 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
960 960 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
961 961 (branch merge, don't forget to commit)
962 962 $ echo "extra-change to (formelly h) during the merge" > d
963 963 $ hg ci -m "mBF-change-m-0 $case_desc - one way"
964 964 created new head
965 965 $ hg manifest --rev . --debug | grep " d"
966 966 1c334238bd42ec85c6a0d83fd1b2a898a6a3215d 644 d (no-changeset !)
967 967 cea2d99c0fde64672ef61953786fdff34f16e230 644 d (changeset !)
968 968
969 969 $ hg up 'desc("f-2")'
970 970 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
971 971 $ hg merge 'desc("b-1")'
972 972 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
973 973 (branch merge, don't forget to commit)
974 974 $ echo "extra-change to (formelly h) during the merge" > d
975 975 $ hg ci -m "mFB-change-m-0 $case_desc - the other way"
976 976 created new head
977 977 $ hg manifest --rev . --debug | grep " d"
978 978 1c334238bd42ec85c6a0d83fd1b2a898a6a3215d 644 d (no-changeset !)
979 979 cea2d99c0fde64672ef61953786fdff34f16e230 644 d (changeset !)
980 980 #if no-changeset
981 981 $ hg debugindex d | "$PYTHON" ../no-linkrev
982 982 rev linkrev nodeid p1 p2
983 983 0 * d8252ab2e760 000000000000 000000000000
984 984 1 * b004912a8510 000000000000 000000000000
985 985 2 * 7b79e2fe0c89 000000000000 000000000000
986 986 3 * 17ec97e60577 d8252ab2e760 000000000000
987 987 4 * 06dabf50734c b004912a8510 17ec97e60577
988 988 5 * 19c0e3924691 17ec97e60577 b004912a8510
989 989 6 * 89c873a01d97 7b79e2fe0c89 17ec97e60577
990 990 7 * d55cb4e9ef57 000000000000 000000000000
991 991 8 * 1c334238bd42 7b79e2fe0c89 000000000000
992 992 #else
993 993 $ hg debugindex d | "$PYTHON" ../no-linkrev
994 994 rev linkrev nodeid p1 p2
995 995 0 * ae258f702dfe 000000000000 000000000000
996 996 1 * b004912a8510 000000000000 000000000000
997 997 2 * 5cce88bf349f ae258f702dfe 000000000000
998 998 3 * cc269dd788c8 b004912a8510 5cce88bf349f
999 999 4 * 51c91a115080 5cce88bf349f b004912a8510
1000 1000 5 * cea2d99c0fde ae258f702dfe 000000000000
1001 1001 #endif
1002 1002 $ hg log -G --rev '::(desc("mBF-change-m")+desc("mFB-change-m"))'
1003 1003 @ mFB-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
1004 1004 |\
1005 1005 +---o mBF-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
1006 1006 | |/
1007 1007 | o f-2: rename i -> d
1008 1008 | |
1009 1009 | o f-1: rename h -> i
1010 1010 | |
1011 1011 o | b-1: b update
1012 1012 |/
1013 1013 o i-2: c -move-> d, s -move-> t
1014 1014 |
1015 1015 o i-1: a -move-> c, p -move-> s
1016 1016 |
1017 1017 o i-0 initial commit: a b h p q r
1018 1018
1019 1019
1020 1020 Subcase: restoring and untouched deleted file, while touching it
1021 1021 ````````````````````````````````````````````````````````````````
1022 1022
1023 1023 Merge:
1024 1024 - one removing a file (d)
1025 1025 - one leaving the file untouched
1026 1026 - the merge actively restore the file to the same content.
1027 1027
1028 1028 In this case, the file keep on living after the merge. So we should not drop its
1029 1029 copy tracing chain.
1030 1030
1031 1031 $ case_desc="merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge)"
1032 1032
1033 1033 $ hg up 'desc("c-1")'
1034 1034 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1035 1035 $ hg merge 'desc("b-1")'
1036 1036 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1037 1037 (branch merge, don't forget to commit)
1038 1038 $ hg revert --rev 'desc("b-1")' d
1039 1039 $ echo "new content for d after the revert" > d
1040 1040 $ hg ci -m "mCB-change-m-0 $case_desc - one way"
1041 1041 created new head
1042 1042 $ hg manifest --rev . --debug | grep " d"
1043 1043 e333780c17752a3b0dd15e3ad48aa4e5c745f621 644 d (no-changeset !)
1044 1044 4b540a18ad699234b2b2aa18cb69555ac9c4b1df 644 d (changeset !)
1045 1045
1046 1046 $ hg up 'desc("b-1")'
1047 1047 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1048 1048 $ hg merge 'desc("c-1")'
1049 1049 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1050 1050 (branch merge, don't forget to commit)
1051 1051 $ hg revert --rev 'desc("b-1")' d
1052 1052 $ echo "new content for d after the revert" > d
1053 1053 $ hg ci -m "mBC-change-m-0 $case_desc - the other way"
1054 1054 created new head
1055 1055 $ hg manifest --rev . --debug | grep " d"
1056 1056 e333780c17752a3b0dd15e3ad48aa4e5c745f621 644 d (no-changeset !)
1057 1057 4b540a18ad699234b2b2aa18cb69555ac9c4b1df 644 d (changeset !)
1058 1058
1059 1059
1060 1060 $ hg up null --quiet
1061 1061 $ hg log -G --rev '::(desc("mCB-change-m")+desc("mBC-change-m"))'
1062 1062 o mBC-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
1063 1063 |\
1064 1064 +---o mCB-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
1065 1065 | |/
1066 1066 | o c-1 delete d
1067 1067 | |
1068 1068 o | b-1: b update
1069 1069 |/
1070 1070 o i-2: c -move-> d, s -move-> t
1071 1071 |
1072 1072 o i-1: a -move-> c, p -move-> s
1073 1073 |
1074 1074 o i-0 initial commit: a b h p q r
1075 1075
1076 1076
1077 1077 Decision from previous merge are properly chained with later merge
1078 1078 ------------------------------------------------------------------
1079 1079
1080 1080 Subcase: chaining conflicting rename resolution
1081 1081 ```````````````````````````````````````````````
1082 1082
1083 1083 The "mAEm" and "mEAm" case create a rename tracking conflict on file 'f'. We
1084 1084 add more change on the respective branch and merge again. These second merge
1085 1085 does not involve the file 'f' and the arbitration done within "mAEm" and "mEA"
1086 1086 about that file should stay unchanged.
1087 1087
1088 1088 We also touch J during some of the merge to check for unrelated change to new file during merge.
1089 1089
1090 1090 $ case_desc="chained merges (conflict -> simple) - same content everywhere"
1091 1091
1092 1092 (extra unrelated changes)
1093 1093
1094 1094 $ hg up 'desc("a-2")'
1095 1095 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1096 1096 $ echo j > unrelated-j
1097 1097 $ hg add unrelated-j
1098 1098 $ hg ci -m 'j-1: unrelated changes (based on the "a" series of changes)'
1099 1099 created new head
1100 1100
1101 1101 $ hg up 'desc("e-2")'
1102 1102 2 files updated, 0 files merged, 2 files removed, 0 files unresolved (no-changeset !)
1103 1103 1 files updated, 0 files merged, 2 files removed, 0 files unresolved (changeset !)
1104 1104 $ echo k > unrelated-k
1105 1105 $ hg add unrelated-k
1106 1106 $ hg ci -m 'k-1: unrelated changes (based on "e" changes)'
1107 1107 created new head
1108 1108
1109 1109 (merge variant 1)
1110 1110
1111 1111 $ hg up 'desc("mAEm")'
1112 1112 1 files updated, 0 files merged, 2 files removed, 0 files unresolved (no-changeset !)
1113 1113 0 files updated, 0 files merged, 2 files removed, 0 files unresolved (changeset !)
1114 1114 $ hg merge 'desc("k-1")'
1115 1115 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1116 1116 (branch merge, don't forget to commit)
1117 1117 $ hg ci -m "mAE,Km: $case_desc"
1118 1118
1119 1119 (merge variant 2)
1120 1120
1121 1121 $ hg up 'desc("k-1")'
1122 1122 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
1123 1123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
1124 1124
1125 1125 $ hg merge 'desc("mAEm")'
1126 1126 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
1127 1127 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
1128 1128 (branch merge, don't forget to commit)
1129 1129 $ hg ci -m "mK,AEm: $case_desc"
1130 1130 created new head
1131 1131
1132 1132 (merge variant 3)
1133 1133
1134 1134 $ hg up 'desc("mEAm")'
1135 1135 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1136 1136 $ hg merge 'desc("j-1")'
1137 1137 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1138 1138 (branch merge, don't forget to commit)
1139 1139 $ echo jj > unrelated-j
1140 1140 $ hg ci -m "mEA,Jm: $case_desc"
1141 1141
1142 1142 (merge variant 4)
1143 1143
1144 1144 $ hg up 'desc("j-1")'
1145 1145 3 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
1146 1146 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
1147 1147 $ hg merge 'desc("mEAm")'
1148 1148 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
1149 1149 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
1150 1150 (branch merge, don't forget to commit)
1151 1151 $ echo jj > unrelated-j
1152 1152 $ hg ci -m "mJ,EAm: $case_desc"
1153 1153 created new head
1154 1154
1155 1155
1156 1156 $ hg log -G --rev '::(desc("mAE,Km") + desc("mK,AEm") + desc("mEA,Jm") + desc("mJ,EAm"))'
1157 1157 @ mJ,EAm: chained merges (conflict -> simple) - same content everywhere
1158 1158 |\
1159 1159 +---o mEA,Jm: chained merges (conflict -> simple) - same content everywhere
1160 1160 | |/
1161 1161 | | o mK,AEm: chained merges (conflict -> simple) - same content everywhere
1162 1162 | | |\
1163 1163 | | +---o mAE,Km: chained merges (conflict -> simple) - same content everywhere
1164 1164 | | | |/
1165 1165 | | | o k-1: unrelated changes (based on "e" changes)
1166 1166 | | | |
1167 1167 | o | | j-1: unrelated changes (based on the "a" series of changes)
1168 1168 | | | |
1169 1169 o-----+ mEAm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - the other way
1170 1170 |/ / /
1171 1171 | o / mAEm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - one way
1172 1172 |/|/
1173 1173 | o e-2 g -move-> f
1174 1174 | |
1175 1175 | o e-1 b -move-> g
1176 1176 | |
1177 1177 o | a-2: e -move-> f
1178 1178 | |
1179 1179 o | a-1: d -move-> e
1180 1180 |/
1181 1181 o i-2: c -move-> d, s -move-> t
1182 1182 |
1183 1183 o i-1: a -move-> c, p -move-> s
1184 1184 |
1185 1185 o i-0 initial commit: a b h p q r
1186 1186
1187 1187
1188 1188 Subcase: chaining conflicting rename resolution, with actual merging happening
1189 1189 ``````````````````````````````````````````````````````````````````````````````
1190 1190
1191 1191 The "mPQm" and "mQPm" case create a rename tracking conflict on file 't'. We
1192 1192 add more change on the respective branch and merge again. These second merge
1193 1193 does not involve the file 't' and the arbitration done within "mPQm" and "mQP"
1194 1194 about that file should stay unchanged.
1195 1195
1196 1196 $ case_desc="chained merges (conflict -> simple) - different content"
1197 1197
1198 1198 (extra unrelated changes)
1199 1199
1200 1200 $ hg up 'desc("p-2")'
1201 1201 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
1202 1202 $ echo s > unrelated-s
1203 1203 $ hg add unrelated-s
1204 1204 $ hg ci -m 's-1: unrelated changes (based on the "p" series of changes)'
1205 1205 created new head
1206 1206
1207 1207 $ hg up 'desc("q-2")'
1208 1208 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
1209 1209 $ echo t > unrelated-t
1210 1210 $ hg add unrelated-t
1211 1211 $ hg ci -m 't-1: unrelated changes (based on "q" changes)'
1212 1212 created new head
1213 1213
1214 1214 (merge variant 1)
1215 1215
1216 1216 $ hg up 'desc("mPQm")'
1217 1217 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1218 1218 $ hg merge 'desc("t-1")'
1219 1219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1220 1220 (branch merge, don't forget to commit)
1221 1221 $ hg ci -m "mPQ,Tm: $case_desc"
1222 1222
1223 1223 (merge variant 2)
1224 1224
1225 1225 $ hg up 'desc("t-1")'
1226 1226 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1227 1227
1228 1228 $ hg merge 'desc("mPQm")'
1229 1229 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1230 1230 (branch merge, don't forget to commit)
1231 1231 $ hg ci -m "mT,PQm: $case_desc"
1232 1232 created new head
1233 1233
1234 1234 (merge variant 3)
1235 1235
1236 1236 $ hg up 'desc("mQPm")'
1237 1237 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1238 1238 $ hg merge 'desc("s-1")'
1239 1239 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1240 1240 (branch merge, don't forget to commit)
1241 1241 $ hg ci -m "mQP,Sm: $case_desc"
1242 1242
1243 1243 (merge variant 4)
1244 1244
1245 1245 $ hg up 'desc("s-1")'
1246 1246 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1247 1247 $ hg merge 'desc("mQPm")'
1248 1248 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1249 1249 (branch merge, don't forget to commit)
1250 1250 $ hg ci -m "mS,QPm: $case_desc"
1251 1251 created new head
1252 1252 $ hg up null --quiet
1253 1253
1254 1254
1255 1255 $ hg log -G --rev '::(desc("mPQ,Tm") + desc("mT,PQm") + desc("mQP,Sm") + desc("mS,QPm"))'
1256 1256 o mS,QPm: chained merges (conflict -> simple) - different content
1257 1257 |\
1258 1258 +---o mQP,Sm: chained merges (conflict -> simple) - different content
1259 1259 | |/
1260 1260 | | o mT,PQm: chained merges (conflict -> simple) - different content
1261 1261 | | |\
1262 1262 | | +---o mPQ,Tm: chained merges (conflict -> simple) - different content
1263 1263 | | | |/
1264 1264 | | | o t-1: unrelated changes (based on "q" changes)
1265 1265 | | | |
1266 1266 | o | | s-1: unrelated changes (based on the "p" series of changes)
1267 1267 | | | |
1268 1268 o-----+ mQPm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - the other way
1269 1269 |/ / /
1270 1270 | o / mPQm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - one way
1271 1271 |/|/
1272 1272 | o q-2 w -move-> v
1273 1273 | |
1274 1274 | o q-1 r -move-> w
1275 1275 | |
1276 1276 o | p-2: u -move-> v
1277 1277 | |
1278 1278 o | p-1: t -move-> u
1279 1279 |/
1280 1280 o i-2: c -move-> d, s -move-> t
1281 1281 |
1282 1282 o i-1: a -move-> c, p -move-> s
1283 1283 |
1284 1284 o i-0 initial commit: a b h p q r
1285 1285
1286 1286
1287 1287 Subcase: chaining salvage information during a merge
1288 1288 ````````````````````````````````````````````````````
1289 1289
1290 1290 We add more change on the branch were the file was deleted. merging again
1291 1291 should preserve the fact eh file was salvaged.
1292 1292
1293 1293 $ case_desc="chained merges (salvaged -> simple) - same content (when the file exists)"
1294 1294
1295 1295 (creating the change)
1296 1296
1297 1297 $ hg up 'desc("c-1")'
1298 1298 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1299 $ echo l > unrelated-l
1300 1300 $ hg add unrelated-l
1301 1301 $ hg ci -m 'l-1: unrelated changes (based on "c" changes)'
1302 1302 created new head
1303 1303
1304 1304 (Merge variant 1)
1305 1305
1306 1306 $ hg up 'desc("mBC-revert-m")'
1307 1307 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1308 1308 $ hg merge 'desc("l-1")'
1309 1309 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1310 1310 (branch merge, don't forget to commit)
1311 1311 $ hg ci -m "mBC+revert,Lm: $case_desc"
1312 1312
1313 1313 (Merge variant 2)
1314 1314
1315 1315 $ hg up 'desc("mCB-revert-m")'
1316 1316 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1317 1317 $ hg merge 'desc("l-1")'
1318 1318 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1319 1319 (branch merge, don't forget to commit)
1320 1320 $ hg ci -m "mCB+revert,Lm: $case_desc"
1321 1321
1322 1322 (Merge variant 3)
1323 1323
1324 1324 $ hg up 'desc("l-1")'
1325 1325 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1326 1326
1327 1327 $ hg merge 'desc("mBC-revert-m")'
1328 1328 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1329 1329 (branch merge, don't forget to commit)
1330 1330 $ hg ci -m "mL,BC+revertm: $case_desc"
1331 1331 created new head
1332 1332
1333 1333 (Merge variant 4)
1334 1334
1335 1335 $ hg up 'desc("l-1")'
1336 1336 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1337 1337
1338 1338 $ hg merge 'desc("mCB-revert-m")'
1339 1339 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1340 1340 (branch merge, don't forget to commit)
1341 1341 $ hg ci -m "mL,CB+revertm: $case_desc"
1342 1342 created new head
1343 1343
1344 1344 $ hg log -G --rev '::(desc("mBC+revert,Lm") + desc("mCB+revert,Lm") + desc("mL,BC+revertm") + desc("mL,CB+revertm"))'
1345 1345 @ mL,CB+revertm: chained merges (salvaged -> simple) - same content (when the file exists)
1346 1346 |\
1347 1347 | | o mL,BC+revertm: chained merges (salvaged -> simple) - same content (when the file exists)
1348 1348 | |/|
1349 1349 +-+---o mCB+revert,Lm: chained merges (salvaged -> simple) - same content (when the file exists)
1350 1350 | | |
1351 1351 | +---o mBC+revert,Lm: chained merges (salvaged -> simple) - same content (when the file exists)
1352 1352 | | |/
1353 1353 | o | l-1: unrelated changes (based on "c" changes)
1354 1354 | | |
1355 1355 | | o mBC-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
1356 1356 | |/|
1357 1357 o---+ mCB-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
1358 1358 |/ /
1359 1359 o | c-1 delete d
1360 1360 | |
1361 1361 | o b-1: b update
1362 1362 |/
1363 1363 o i-2: c -move-> d, s -move-> t
1364 1364 |
1365 1365 o i-1: a -move-> c, p -move-> s
1366 1366 |
1367 1367 o i-0 initial commit: a b h p q r
1368 1368
1369 1369
1370 1370
1371 1371 Subcase: chaining "merged" information during a merge
1372 1372 ``````````````````````````````````````````````````````
1373 1373
1374 1374 When a non-rename change are merged with a copy overwrite, the merge pick the copy source from (p1) as the reference. We should preserve this information in subsequent merges.
1375 1375
1376 1376 $ case_desc="chained merges (copy-overwrite -> simple) - same content"
1377 1377
1378 1378 (extra unrelated changes)
1379 1379
1380 1380 $ hg up 'desc("f-2")'
1381 1381 2 files updated, 0 files merged, 2 files removed, 0 files unresolved (no-changeset !)
1382 1382 1 files updated, 0 files merged, 2 files removed, 0 files unresolved (changeset !)
1383 1383 $ echo n > unrelated-n
1384 1384 $ hg add unrelated-n
1385 1385 $ hg ci -m 'n-1: unrelated changes (based on the "f" series of changes)'
1386 1386 created new head
1387 1387
1388 1388 $ hg up 'desc("g-1")'
1389 1389 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1390 1390 $ echo o > unrelated-o
1391 1391 $ hg add unrelated-o
1392 1392 $ hg ci -m 'o-1: unrelated changes (based on "g" changes)'
1393 1393 created new head
1394 1394
1395 1395 (merge variant 1)
1396 1396
1397 1397 $ hg up 'desc("mFGm")'
1398 1398 1 files updated, 0 files merged, 2 files removed, 0 files unresolved (no-changeset !)
1399 1399 0 files updated, 0 files merged, 2 files removed, 0 files unresolved (changeset !)
1400 1400 $ hg merge 'desc("o-1")'
1401 1401 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1402 1402 (branch merge, don't forget to commit)
1403 1403 $ hg ci -m "mFG,Om: $case_desc"
1404 1404
1405 1405 (merge variant 2)
1406 1406
1407 1407 $ hg up 'desc("o-1")'
1408 1408 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-changeset !)
1409 1409 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (changeset !)
1410 1410 $ hg merge 'desc("FGm")'
1411 1411 1 files updated, 0 files merged, 1 files removed, 0 files unresolved (no-changeset !)
1412 1412 0 files updated, 0 files merged, 1 files removed, 0 files unresolved (changeset !)
1413 1413 (branch merge, don't forget to commit)
1414 1414 $ hg ci -m "mO,FGm: $case_desc"
1415 1415 created new head
1416 1416
1417 1417 (merge variant 3)
1418 1418
1419 1419 $ hg up 'desc("mGFm")'
1420 1420 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1421 1421 $ hg merge 'desc("n-1")'
1422 1422 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1423 1423 (branch merge, don't forget to commit)
1424 1424 $ hg ci -m "mGF,Nm: $case_desc"
1425 1425
1426 1426 (merge variant 4)
1427 1427
1428 1428 $ hg up 'desc("n-1")'
1429 1429 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1430 1430 $ hg merge 'desc("mGFm")'
1431 1431 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1432 1432 (branch merge, don't forget to commit)
1433 1433 $ hg ci -m "mN,GFm: $case_desc"
1434 1434 created new head
1435 1435
1436 1436 $ hg log -G --rev '::(desc("mFG,Om") + desc("mO,FGm") + desc("mGF,Nm") + desc("mN,GFm"))'
1437 1437 @ mN,GFm: chained merges (copy-overwrite -> simple) - same content
1438 1438 |\
1439 1439 +---o mGF,Nm: chained merges (copy-overwrite -> simple) - same content
1440 1440 | |/
1441 1441 | | o mO,FGm: chained merges (copy-overwrite -> simple) - same content
1442 1442 | | |\
1443 1443 | | +---o mFG,Om: chained merges (copy-overwrite -> simple) - same content
1444 1444 | | | |/
1445 1445 | | | o o-1: unrelated changes (based on "g" changes)
1446 1446 | | | |
1447 1447 | o | | n-1: unrelated changes (based on the "f" series of changes)
1448 1448 | | | |
1449 1449 o-----+ mGFm-0 merge - G side: content change, F side: copy overwrite, no content change - the other way
1450 1450 |/ / /
1451 1451 | o / mFGm-0 merge - G side: content change, F side: copy overwrite, no content change - one way
1452 1452 |/|/
1453 1453 | o g-1: update d
1454 1454 | |
1455 1455 o | f-2: rename i -> d
1456 1456 | |
1457 1457 o | f-1: rename h -> i
1458 1458 |/
1459 1459 o i-2: c -move-> d, s -move-> t
1460 1460 |
1461 1461 o i-1: a -move-> c, p -move-> s
1462 1462 |
1463 1463 o i-0 initial commit: a b h p q r
1464 1464
1465 1465
1466 1466 Subcase: chaining conflicting rename resolution, with extra change during the merge
1467 1467 ```````````````````````````````````````````````````````````````````````````````````
1468 1468
1469 1469 The "mEA-change-m-0" and "mAE-change-m-0" case create a rename tracking conflict on file 'f'. We
1470 1470 add more change on the respective branch and merge again. These second merge
1471 1471 does not involve the file 'f' and the arbitration done within "mAEm" and "mEA"
1472 1472 about that file should stay unchanged.
1473 1473
1474 1474 $ case_desc="chained merges (conflict+change -> simple) - same content on both branch in the initial merge"
1475 1475
1476 1476
1477 1477 (merge variant 1)
1478 1478
1479 1479 $ hg up 'desc("mAE-change-m")'
1480 1480 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
1481 1481 $ hg merge 'desc("k-1")'
1482 1482 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1483 1483 (branch merge, don't forget to commit)
1484 1484 $ hg ci -m "mAE-change,Km: $case_desc"
1485 1485
1486 1486 (merge variant 2)
1487 1487
1488 1488 $ hg up 'desc("k-1")'
1489 1489 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1490 1490
1491 1491 $ hg merge 'desc("mAE-change-m")'
1492 1492 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1493 1493 (branch merge, don't forget to commit)
1494 1494 $ hg ci -m "mK,AE-change-m: $case_desc"
1495 1495 created new head
1496 1496
1497 1497 (merge variant 3)
1498 1498
1499 1499 $ hg up 'desc("mEA-change-m")'
1500 1500 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1501 1501 $ hg merge 'desc("j-1")'
1502 1502 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1503 1503 (branch merge, don't forget to commit)
1504 1504 $ hg ci -m "mEA-change,Jm: $case_desc"
1505 1505
1506 1506 (merge variant 4)
1507 1507
1508 1508 $ hg up 'desc("j-1")'
1509 1509 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1510 1510 $ hg merge 'desc("mEA-change-m")'
1511 1511 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1512 1512 (branch merge, don't forget to commit)
1513 1513 $ hg ci -m "mJ,EA-change-m: $case_desc"
1514 1514 created new head
1515 1515
1516 1516
1517 1517 $ hg log -G --rev '::(desc("mAE-change,Km") + desc("mK,AE-change-m") + desc("mEA-change,Jm") + desc("mJ,EA-change-m"))'
1518 1518 @ mJ,EA-change-m: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1519 1519 |\
1520 1520 +---o mEA-change,Jm: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1521 1521 | |/
1522 1522 | | o mK,AE-change-m: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1523 1523 | | |\
1524 1524 | | +---o mAE-change,Km: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1525 1525 | | | |/
1526 1526 | | | o k-1: unrelated changes (based on "e" changes)
1527 1527 | | | |
1528 1528 | o | | j-1: unrelated changes (based on the "a" series of changes)
1529 1529 | | | |
1530 1530 o-----+ mEA-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - the other way
1531 1531 |/ / /
1532 1532 | o / mAE-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - one way
1533 1533 |/|/
1534 1534 | o e-2 g -move-> f
1535 1535 | |
1536 1536 | o e-1 b -move-> g
1537 1537 | |
1538 1538 o | a-2: e -move-> f
1539 1539 | |
1540 1540 o | a-1: d -move-> e
1541 1541 |/
1542 1542 o i-2: c -move-> d, s -move-> t
1543 1543 |
1544 1544 o i-1: a -move-> c, p -move-> s
1545 1545 |
1546 1546 o i-0 initial commit: a b h p q r
1547 1547
1548 1548
1549 1549 Summary of all created cases
1550 1550 ----------------------------
1551 1551
1552 1552 $ hg up --quiet null
1553 1553
1554 1554 (This exists to help keeping a compact list of the various cases we have built)
1555 1555
1556 1556 $ hg log -T '{desc|firstline}\n'| sort
1557 1557 a-1: d -move-> e
1558 1558 a-2: e -move-> f
1559 1559 b-1: b update
1560 1560 c-1 delete d
1561 1561 d-1 delete d
1562 1562 d-2 re-add d
1563 1563 e-1 b -move-> g
1564 1564 e-2 g -move-> f
1565 1565 f-1: rename h -> i
1566 1566 f-2: rename i -> d
1567 1567 g-1: update d
1568 1568 h-1: b -(move)-> d
1569 1569 i-0 initial commit: a b h p q r
1570 1570 i-1: a -move-> c, p -move-> s
1571 1571 i-2: c -move-> d, s -move-> t
1572 1572 j-1: unrelated changes (based on the "a" series of changes)
1573 1573 k-1: unrelated changes (based on "e" changes)
1574 1574 l-1: unrelated changes (based on "c" changes)
1575 1575 mABm-0 simple merge - A side: multiple renames, B side: unrelated update - the other way
1576 1576 mAE,Km: chained merges (conflict -> simple) - same content everywhere
1577 1577 mAE-change,Km: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1578 1578 mAE-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - one way
1579 1579 mAEm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - one way
1580 1580 mBAm-0 simple merge - A side: multiple renames, B side: unrelated update - one way
1581 1581 mBC+revert,Lm: chained merges (salvaged -> simple) - same content (when the file exists)
1582 1582 mBC-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
1583 1583 mBC-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
1584 1584 mBCm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - one way
1585 1585 mBCm-1 re-add d
1586 1586 mBDm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - one way
1587 1587 mBF-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
1588 1588 mBFm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
1589 1589 mBRm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - one way
1590 1590 mCB+revert,Lm: chained merges (salvaged -> simple) - same content (when the file exists)
1591 1591 mCB-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
1592 1592 mCB-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
1593 1593 mCBm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - the other way
1594 1594 mCBm-1 re-add d
1595 1595 mCGm-0 merge updated/deleted - revive the file (updated content) - one way
1596 1596 mCH-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - one way
1597 1597 mDBm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - the other way
1598 1598 mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
1599 1599 mEA,Jm: chained merges (conflict -> simple) - same content everywhere
1600 1600 mEA-change,Jm: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1601 1601 mEA-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - the other way
1602 1602 mEAm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - the other way
1603 1603 mFB-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
1604 1604 mFBm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
1605 1605 mFG,Om: chained merges (copy-overwrite -> simple) - same content
1606 1606 mFGm-0 merge - G side: content change, F side: copy overwrite, no content change - one way
1607 1607 mGCm-0 merge updated/deleted - revive the file (updated content) - the other way
1608 1608 mGDm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - the other way
1609 1609 mGF,Nm: chained merges (copy-overwrite -> simple) - same content
1610 1610 mGFm-0 merge - G side: content change, F side: copy overwrite, no content change - the other way
1611 1611 mHC-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - the other way
1612 1612 mJ,EA-change-m: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1613 1613 mJ,EAm: chained merges (conflict -> simple) - same content everywhere
1614 1614 mK,AE-change-m: chained merges (conflict+change -> simple) - same content on both branch in the initial merge
1615 1615 mK,AEm: chained merges (conflict -> simple) - same content everywhere
1616 1616 mL,BC+revertm: chained merges (salvaged -> simple) - same content (when the file exists)
1617 1617 mL,CB+revertm: chained merges (salvaged -> simple) - same content (when the file exists)
1618 1618 mN,GFm: chained merges (copy-overwrite -> simple) - same content
1619 1619 mO,FGm: chained merges (copy-overwrite -> simple) - same content
1620 1620 mPQ,Tm: chained merges (conflict -> simple) - different content
1621 1621 mPQm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - one way
1622 1622 mQP,Sm: chained merges (conflict -> simple) - different content
1623 1623 mQPm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - the other way
1624 1624 mRBm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - the other way
1625 1625 mS,QPm: chained merges (conflict -> simple) - different content
1626 1626 mT,PQm: chained merges (conflict -> simple) - different content
1627 1627 n-1: unrelated changes (based on the "f" series of changes)
1628 1628 o-1: unrelated changes (based on "g" changes)
1629 1629 p-1: t -move-> u
1630 1630 p-2: u -move-> v
1631 1631 q-1 r -move-> w
1632 1632 q-2 w -move-> v
1633 1633 r-1: rename r -> x
1634 1634 r-2: rename t -> x
1635 1635 s-1: unrelated changes (based on the "p" series of changes)
1636 1636 t-1: unrelated changes (based on "q" changes)
1637 1637
1638 1638
1639 1639 Test that sidedata computations during upgrades are correct
1640 1640 ===========================================================
1641 1641
1642 1642 We upgrade a repository that is not using sidedata (the filelog case) and
1643 1643 check that the same side data have been generated as if they were computed at
1644 1644 commit time.
1645 1645
1646 1646
1647 1647 #if upgraded
1648 1648 $ cat >> $HGRCPATH << EOF
1649 1649 > [format]
1650 1650 > exp-use-copies-side-data-changeset = yes
1651 1651 > EOF
1652 1652 $ hg debugformat -v | egrep 'changelog-v2|revlog-v2|copies-sdc'
1653 1653 copies-sdc: no yes no
1654 1654 revlog-v2: no no no
1655 1655 changelog-v2: no yes no
1656 1656 $ hg debugupgraderepo --run --quiet
1657 1657 upgrade will perform the following actions:
1658 1658
1659 1659 requirements
1660 1660 preserved: * (glob)
1661 1661 added: exp-changelog-v2, exp-copies-sidedata-changeset
1662 1662
1663 1663 processed revlogs:
1664 1664 - all-filelogs
1665 1665 - changelog
1666 1666 - manifest
1667 1667
1668 1668 #endif
1669 1669
1670 1670 #if upgraded-parallel
1671 1671 $ cat >> $HGRCPATH << EOF
1672 1672 > [format]
1673 1673 > exp-use-copies-side-data-changeset = yes
1674 1674 > [experimental]
1675 1675 > worker.repository-upgrade=yes
1676 1676 > [worker]
1677 1677 > enabled=yes
1678 1678 > numcpus=8
1679 1679 > EOF
1680 1680 $ hg debugformat -v | egrep 'changelog-v2|revlog-v2|copies-sdc'
1681 1681 copies-sdc: no yes no
1682 1682 revlog-v2: no no no
1683 1683 changelog-v2: no yes no
1684 1684 $ hg debugupgraderepo --run --quiet
1685 1685 upgrade will perform the following actions:
1686 1686
1687 1687 requirements
1688 1688 preserved: * (glob)
1689 1689 added: exp-changelog-v2, exp-copies-sidedata-changeset
1690 1690
1691 1691 processed revlogs:
1692 1692 - all-filelogs
1693 1693 - changelog
1694 1694 - manifest
1695 1695
1696 1696 #endif
1697 1697
1698 1698 #if pull
1699 1699 $ cd ..
1700 1700 $ mv repo-chain repo-source
1701 1701 $ hg init repo-chain
1702 1702 $ cd repo-chain
1703 1703 $ hg pull ../repo-source
1704 1704 pulling from ../repo-source
1705 1705 requesting all changes
1706 1706 adding changesets
1707 1707 adding manifests
1708 1708 adding file changes
1709 1709 added 80 changesets with 44 changes to 25 files (+39 heads)
1710 1710 new changesets a3a31bbefea6:908ce9259ffa
1711 1711 (run 'hg heads' to see heads, 'hg merge' to merge)
1712 1712 #endif
1713 1713
1714 1714 #if pull-upgrade
1715 1715 $ cat >> $HGRCPATH << EOF
1716 1716 > [format]
1717 1717 > exp-use-copies-side-data-changeset = yes
1718 1718 > [experimental]
1719 1719 > changegroup4 = yes
1720 1720 > EOF
1721 1721 $ cd ..
1722 1722 $ mv repo-chain repo-source
1723 1723 $ hg init repo-chain
1724 1724 $ cd repo-chain
1725 1725 $ hg pull ../repo-source
1726 1726 pulling from ../repo-source
1727 1727 requesting all changes
1728 1728 adding changesets
1729 1729 adding manifests
1730 1730 adding file changes
1731 1731 added 80 changesets with 44 changes to 25 files (+39 heads)
1732 1732 new changesets a3a31bbefea6:908ce9259ffa
1733 1733 (run 'hg heads' to see heads, 'hg merge' to merge)
1734 1734 #endif
1735 1735
1736 1736 #if push
1737 1737 $ cd ..
1738 1738 $ mv repo-chain repo-source
1739 1739 $ hg init repo-chain
1740 1740 $ cd repo-source
1741 1741 $ hg push ../repo-chain
1742 1742 pushing to ../repo-chain
1743 1743 searching for changes
1744 1744 adding changesets
1745 1745 adding manifests
1746 1746 adding file changes
1747 1747 added 80 changesets with 44 changes to 25 files (+39 heads)
1748 1748 $ cd ../repo-chain
1749 1749 #endif
1750 1750
1751 1751 #if push-upgrade
1752 1752 $ cat >> $HGRCPATH << EOF
1753 1753 > [format]
1754 1754 > exp-use-copies-side-data-changeset = yes
1755 1755 > [experimental]
1756 1756 > changegroup4 = yes
1757 1757 > EOF
1758 1758 $ cd ..
1759 1759 $ mv repo-chain repo-source
1760 1760 $ hg init repo-chain
1761 1761 $ cd repo-source
1762 1762 $ hg push ../repo-chain
1763 1763 pushing to ../repo-chain
1764 1764 searching for changes
1765 1765 adding changesets
1766 1766 adding manifests
1767 1767 adding file changes
1768 1768 added 80 changesets with 44 changes to 25 files (+39 heads)
1769 1769 $ cd ../repo-chain
1770 1770 #endif
1771 1771
1772 1772 #if no-compatibility no-filelog no-changeset
1773 1773
1774 1774 $ hg debugchangedfiles --compute 0
1775 1775 added : a, ;
1776 1776 added : b, ;
1777 1777 added : h, ;
1778 1778 added : p, ;
1779 1779 added : q, ;
1780 1780 added : r, ;
1781 1781
1782 1782 $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
1783 1783 > case_id=`hg log -r $rev -T '{word(0, desc, ":")}\n'`
1784 1784 > echo "##### revision \"$case_id\" #####"
1785 1785 > hg debugsidedata -c -v -- $rev
1786 1786 > hg debugchangedfiles $rev
1787 1787 > done
1788 1788 ##### revision "i-0 initial commit" #####
1789 1789 1 sidedata entries
1790 1790 entry-0014 size 64
1791 1791 '\x00\x00\x00\x06\x04\x00\x00\x00\x01\x00\x00\x00\x00\x04\x00\x00\x00\x02\x00\x00\x00\x00\x04\x00\x00\x00\x03\x00\x00\x00\x00\x04\x00\x00\x00\x04\x00\x00\x00\x00\x04\x00\x00\x00\x05\x00\x00\x00\x00\x04\x00\x00\x00\x06\x00\x00\x00\x00abhpqr'
1792 1792 added : a, ;
1793 1793 added : b, ;
1794 1794 added : h, ;
1795 1795 added : p, ;
1796 1796 added : q, ;
1797 1797 added : r, ;
1798 1798 ##### revision "i-1" #####
1799 1799 1 sidedata entries
1800 1800 entry-0014 size 44
1801 1801 '\x00\x00\x00\x04\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00\x0c\x00\x00\x00\x03\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x02acps'
1802 1802 removed : a, ;
1803 1803 added p1: c, a;
1804 1804 removed : p, ;
1805 1805 added p1: s, p;
1806 1806 ##### revision "i-2" #####
1807 1807 1 sidedata entries
1808 1808 entry-0014 size 44
1809 1809 '\x00\x00\x00\x04\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00\x0c\x00\x00\x00\x03\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x02cdst'
1810 1810 removed : c, ;
1811 1811 added p1: d, c;
1812 1812 removed : s, ;
1813 1813 added p1: t, s;
1814 1814 ##### revision "a-1" #####
1815 1815 1 sidedata entries
1816 1816 entry-0014 size 24
1817 1817 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00de'
1818 1818 removed : d, ;
1819 1819 added p1: e, d;
1820 1820 ##### revision "a-2" #####
1821 1821 1 sidedata entries
1822 1822 entry-0014 size 24
1823 1823 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ef'
1824 1824 removed : e, ;
1825 1825 added p1: f, e;
1826 1826 ##### revision "b-1" #####
1827 1827 1 sidedata entries
1828 1828 entry-0014 size 14
1829 1829 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00b'
1830 1830 touched : b, ;
1831 1831 ##### revision "c-1 delete d" #####
1832 1832 1 sidedata entries
1833 1833 entry-0014 size 14
1834 1834 '\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
1835 1835 removed : d, ;
1836 1836 ##### revision "d-1 delete d" #####
1837 1837 1 sidedata entries
1838 1838 entry-0014 size 14
1839 1839 '\x00\x00\x00\x01\x0c\x00\x00\x00\x01\x00\x00\x00\x00d'
1840 1840 removed : d, ;
1841 1841 ##### revision "d-2 re-add d" #####
1842 1842 1 sidedata entries
1843 1843 entry-0014 size 14
1844 1844 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1845 1845 added : d, ;
1846 1846 ##### revision "e-1 b -move-> g" #####
1847 1847 1 sidedata entries
1848 1848 entry-0014 size 24
1849 1849 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bg'
1850 1850 removed : b, ;
1851 1851 added p1: g, b;
1852 1852 ##### revision "e-2 g -move-> f" #####
1853 1853 1 sidedata entries
1854 1854 entry-0014 size 24
1855 1855 '\x00\x00\x00\x02\x06\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00fg'
1856 1856 added p1: f, g;
1857 1857 removed : g, ;
1858 1858 ##### revision "p-1" #####
1859 1859 1 sidedata entries
1860 1860 entry-0014 size 24
1861 1861 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00tu'
1862 1862 removed : t, ;
1863 1863 added p1: u, t;
1864 1864 ##### revision "p-2" #####
1865 1865 1 sidedata entries
1866 1866 entry-0014 size 24
1867 1867 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00uv'
1868 1868 removed : u, ;
1869 1869 added p1: v, u;
1870 1870 ##### revision "q-1 r -move-> w" #####
1871 1871 1 sidedata entries
1872 1872 entry-0014 size 24
1873 1873 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00rw'
1874 1874 removed : r, ;
1875 1875 added p1: w, r;
1876 1876 ##### revision "q-2 w -move-> v" #####
1877 1877 1 sidedata entries
1878 1878 entry-0014 size 24
1879 1879 '\x00\x00\x00\x02\x06\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00vw'
1880 1880 added p1: v, w;
1881 1881 removed : w, ;
1882 1882 ##### revision "mBAm-0 simple merge - A side" #####
1883 1883 1 sidedata entries
1884 1884 entry-0014 size 4
1885 1885 '\x00\x00\x00\x00'
1886 1886 ##### revision "mABm-0 simple merge - A side" #####
1887 1887 1 sidedata entries
1888 1888 entry-0014 size 4
1889 1889 '\x00\x00\x00\x00'
1890 1890 ##### revision "mBCm-0 simple merge - C side" #####
1891 1891 1 sidedata entries
1892 1892 entry-0014 size 4
1893 1893 '\x00\x00\x00\x00'
1894 1894 ##### revision "mBCm-1 re-add d" #####
1895 1895 1 sidedata entries
1896 1896 entry-0014 size 14
1897 1897 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1898 1898 added : d, ;
1899 1899 ##### revision "mCBm-0 simple merge - C side" #####
1900 1900 1 sidedata entries
1901 1901 entry-0014 size 4
1902 1902 '\x00\x00\x00\x00'
1903 1903 ##### revision "mCBm-1 re-add d" #####
1904 1904 1 sidedata entries
1905 1905 entry-0014 size 14
1906 1906 '\x00\x00\x00\x01\x04\x00\x00\x00\x01\x00\x00\x00\x00d'
1907 1907 added : d, ;
1908 1908 ##### revision "mBDm-0 simple merge - B side" #####
1909 1909 1 sidedata entries
1910 1910 entry-0014 size 4
1911 1911 '\x00\x00\x00\x00'
1912 1912 ##### revision "mDBm-0 simple merge - B side" #####
1913 1913 1 sidedata entries
1914 1914 entry-0014 size 4
1915 1915 '\x00\x00\x00\x00'
1916 1916 ##### revision "mAEm-0 merge with copies info on both side - A side" #####
1917 1917 1 sidedata entries
1918 1918 entry-0014 size 14
1919 1919 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
1920 1920 merged : f, ;
1921 1921 ##### revision "mEAm-0 merge with copies info on both side - A side" #####
1922 1922 1 sidedata entries
1923 1923 entry-0014 size 14
1924 1924 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
1925 1925 merged : f, ;
1926 1926 ##### revision "mPQm-0 merge with copies info on both side - P side" #####
1927 1927 1 sidedata entries
1928 1928 entry-0014 size 14
1929 1929 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00v'
1930 1930 merged : v, ;
1931 1931 ##### revision "mQPm-0 merge with copies info on both side - P side" #####
1932 1932 1 sidedata entries
1933 1933 entry-0014 size 14
1934 1934 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00v'
1935 1935 merged : v, ;
1936 1936 ##### revision "f-1" #####
1937 1937 1 sidedata entries
1938 1938 entry-0014 size 24
1939 1939 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00hi'
1940 1940 removed : h, ;
1941 1941 added p1: i, h;
1942 1942 ##### revision "f-2" #####
1943 1943 1 sidedata entries
1944 1944 entry-0014 size 24
1945 1945 '\x00\x00\x00\x02\x16\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00di'
1946 1946 touched p1: d, i;
1947 1947 removed : i, ;
1948 1948 ##### revision "mBFm-0 simple merge - B side" #####
1949 1949 1 sidedata entries
1950 1950 entry-0014 size 4
1951 1951 '\x00\x00\x00\x00'
1952 1952 ##### revision "mFBm-0 simple merge - B side" #####
1953 1953 1 sidedata entries
1954 1954 entry-0014 size 4
1955 1955 '\x00\x00\x00\x00'
1956 1956 ##### revision "r-1" #####
1957 1957 1 sidedata entries
1958 1958 entry-0014 size 24
1959 1959 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00rx'
1960 1960 removed : r, ;
1961 1961 added p1: x, r;
1962 1962 ##### revision "r-2" #####
1963 1963 1 sidedata entries
1964 1964 entry-0014 size 24
1965 1965 '\x00\x00\x00\x02\x16\x00\x00\x00\x01\x00\x00\x00\x01\x0c\x00\x00\x00\x02\x00\x00\x00\x00tx'
1966 1966 touched p1: t, x;
1967 1967 removed : x, ;
1968 1968 ##### revision "mBRm-0 simple merge - B side" #####
1969 1969 1 sidedata entries
1970 1970 entry-0014 size 4
1971 1971 '\x00\x00\x00\x00'
1972 1972 ##### revision "mRBm-0 simple merge - B side" #####
1973 1973 1 sidedata entries
1974 1974 entry-0014 size 4
1975 1975 '\x00\x00\x00\x00'
1976 1976 ##### revision "g-1" #####
1977 1977 1 sidedata entries
1978 1978 entry-0014 size 14
1979 1979 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
1980 1980 touched : d, ;
1981 1981 ##### revision "mDGm-0 actual content merge, copies on one side - D side" #####
1982 1982 1 sidedata entries
1983 1983 entry-0014 size 14
1984 1984 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1985 1985 merged : d, ;
1986 1986 ##### revision "mGDm-0 actual content merge, copies on one side - D side" #####
1987 1987 1 sidedata entries
1988 1988 entry-0014 size 14
1989 1989 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1990 1990 merged : d, ;
1991 1991 ##### revision "mFGm-0 merge - G side" #####
1992 1992 1 sidedata entries
1993 1993 entry-0014 size 14
1994 1994 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
1995 1995 merged : d, ;
1996 1996 ##### revision "mGFm-0 merge - G side" #####
1997 1997 1 sidedata entries
1998 1998 entry-0014 size 14
1999 1999 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00d'
2000 2000 merged : d, ;
2001 2001 ##### revision "mCGm-0 merge updated/deleted - revive the file (updated content) - one way" #####
2002 2002 1 sidedata entries
2003 2003 entry-0014 size 14
2004 2004 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2005 2005 salvaged : d, ;
2006 2006 ##### revision "mGCm-0 merge updated/deleted - revive the file (updated content) - the other way" #####
2007 2007 1 sidedata entries
2008 2008 entry-0014 size 14
2009 2009 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2010 2010 salvaged : d, ;
2011 2011 ##### revision "mCB-revert-m-0 merge explicitely revive deleted file - B side" #####
2012 2012 1 sidedata entries
2013 2013 entry-0014 size 14
2014 2014 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2015 2015 salvaged : d, ;
2016 2016 ##### revision "mBC-revert-m-0 merge explicitely revive deleted file - B side" #####
2017 2017 1 sidedata entries
2018 2018 entry-0014 size 14
2019 2019 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2020 2020 salvaged : d, ;
2021 2021 ##### revision "h-1" #####
2022 2022 1 sidedata entries
2023 2023 entry-0014 size 24
2024 2024 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00bd'
2025 2025 removed : b, ;
2026 2026 added p1: d, b;
2027 2027 ##### revision "mCH-delete-before-conflict-m-0 simple merge - C side" #####
2028 2028 1 sidedata entries
2029 2029 entry-0014 size 4
2030 2030 '\x00\x00\x00\x00'
2031 2031 ##### revision "mHC-delete-before-conflict-m-0 simple merge - C side" #####
2032 2032 1 sidedata entries
2033 2033 entry-0014 size 4
2034 2034 '\x00\x00\x00\x00'
2035 2035 ##### revision "mAE-change-m-0 merge with file update and copies info on both side - A side" #####
2036 2036 1 sidedata entries
2037 2037 entry-0014 size 14
2038 2038 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
2039 2039 merged : f, ;
2040 2040 ##### revision "mEA-change-m-0 merge with file update and copies info on both side - A side" #####
2041 2041 1 sidedata entries
2042 2042 entry-0014 size 14
2043 2043 '\x00\x00\x00\x01\x08\x00\x00\x00\x01\x00\x00\x00\x00f'
2044 2044 merged : f, ;
2045 2045 ##### revision "mBF-change-m-0 merge with extra change - B side" #####
2046 2046 1 sidedata entries
2047 2047 entry-0014 size 14
2048 2048 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
2049 2049 touched : d, ;
2050 2050 ##### revision "mFB-change-m-0 merge with extra change - B side" #####
2051 2051 1 sidedata entries
2052 2052 entry-0014 size 14
2053 2053 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00d'
2054 2054 touched : d, ;
2055 2055 ##### revision "mCB-change-m-0 merge explicitely revive deleted file - B side" #####
2056 2056 1 sidedata entries
2057 2057 entry-0014 size 14
2058 2058 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2059 2059 salvaged : d, ;
2060 2060 ##### revision "mBC-change-m-0 merge explicitely revive deleted file - B side" #####
2061 2061 1 sidedata entries
2062 2062 entry-0014 size 14
2063 2063 '\x00\x00\x00\x01\x10\x00\x00\x00\x01\x00\x00\x00\x00d'
2064 2064 salvaged : d, ;
2065 2065 ##### revision "j-1" #####
2066 2066 1 sidedata entries
2067 2067 entry-0014 size 24
2068 2068 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-j'
2069 2069 added : unrelated-j, ;
2070 2070 ##### revision "k-1" #####
2071 2071 1 sidedata entries
2072 2072 entry-0014 size 24
2073 2073 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-k'
2074 2074 added : unrelated-k, ;
2075 2075 ##### revision "mAE,Km" #####
2076 2076 1 sidedata entries
2077 2077 entry-0014 size 4
2078 2078 '\x00\x00\x00\x00'
2079 2079 ##### revision "mK,AEm" #####
2080 2080 1 sidedata entries
2081 2081 entry-0014 size 4
2082 2082 '\x00\x00\x00\x00'
2083 2083 ##### revision "mEA,Jm" #####
2084 2084 1 sidedata entries
2085 2085 entry-0014 size 24
2086 2086 '\x00\x00\x00\x01\x14\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-j'
2087 2087 touched : unrelated-j, ;
2088 2088 ##### revision "mJ,EAm" #####
2089 2089 1 sidedata entries
2090 2090 entry-0014 size 24
2091 2091 '\x00\x00\x00\x01\x14\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-j'
2092 2092 touched : unrelated-j, ;
2093 2093 ##### revision "s-1" #####
2094 2094 1 sidedata entries
2095 2095 entry-0014 size 24
2096 2096 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-s'
2097 2097 added : unrelated-s, ;
2098 2098 ##### revision "t-1" #####
2099 2099 1 sidedata entries
2100 2100 entry-0014 size 24
2101 2101 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-t'
2102 2102 added : unrelated-t, ;
2103 2103 ##### revision "mPQ,Tm" #####
2104 2104 1 sidedata entries
2105 2105 entry-0014 size 4
2106 2106 '\x00\x00\x00\x00'
2107 2107 ##### revision "mT,PQm" #####
2108 2108 1 sidedata entries
2109 2109 entry-0014 size 4
2110 2110 '\x00\x00\x00\x00'
2111 2111 ##### revision "mQP,Sm" #####
2112 2112 1 sidedata entries
2113 2113 entry-0014 size 4
2114 2114 '\x00\x00\x00\x00'
2115 2115 ##### revision "mS,QPm" #####
2116 2116 1 sidedata entries
2117 2117 entry-0014 size 4
2118 2118 '\x00\x00\x00\x00'
2119 2119 ##### revision "l-1" #####
2120 2120 1 sidedata entries
2121 2121 entry-0014 size 24
2122 2122 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-l'
2123 2123 added : unrelated-l, ;
2124 2124 ##### revision "mBC+revert,Lm" #####
2125 2125 1 sidedata entries
2126 2126 entry-0014 size 4
2127 2127 '\x00\x00\x00\x00'
2128 2128 ##### revision "mCB+revert,Lm" #####
2129 2129 1 sidedata entries
2130 2130 entry-0014 size 4
2131 2131 '\x00\x00\x00\x00'
2132 2132 ##### revision "mL,BC+revertm" #####
2133 2133 1 sidedata entries
2134 2134 entry-0014 size 4
2135 2135 '\x00\x00\x00\x00'
2136 2136 ##### revision "mL,CB+revertm" #####
2137 2137 1 sidedata entries
2138 2138 entry-0014 size 4
2139 2139 '\x00\x00\x00\x00'
2140 2140 ##### revision "n-1" #####
2141 2141 1 sidedata entries
2142 2142 entry-0014 size 24
2143 2143 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-n'
2144 2144 added : unrelated-n, ;
2145 2145 ##### revision "o-1" #####
2146 2146 1 sidedata entries
2147 2147 entry-0014 size 24
2148 2148 '\x00\x00\x00\x01\x04\x00\x00\x00\x0b\x00\x00\x00\x00unrelated-o'
2149 2149 added : unrelated-o, ;
2150 2150 ##### revision "mFG,Om" #####
2151 2151 1 sidedata entries
2152 2152 entry-0014 size 4
2153 2153 '\x00\x00\x00\x00'
2154 2154 ##### revision "mO,FGm" #####
2155 2155 1 sidedata entries
2156 2156 entry-0014 size 4
2157 2157 '\x00\x00\x00\x00'
2158 2158 ##### revision "mGF,Nm" #####
2159 2159 1 sidedata entries
2160 2160 entry-0014 size 4
2161 2161 '\x00\x00\x00\x00'
2162 2162 ##### revision "mN,GFm" #####
2163 2163 1 sidedata entries
2164 2164 entry-0014 size 4
2165 2165 '\x00\x00\x00\x00'
2166 2166 ##### revision "mAE-change,Km" #####
2167 2167 1 sidedata entries
2168 2168 entry-0014 size 4
2169 2169 '\x00\x00\x00\x00'
2170 2170 ##### revision "mK,AE-change-m" #####
2171 2171 1 sidedata entries
2172 2172 entry-0014 size 4
2173 2173 '\x00\x00\x00\x00'
2174 2174 ##### revision "mEA-change,Jm" #####
2175 2175 1 sidedata entries
2176 2176 entry-0014 size 4
2177 2177 '\x00\x00\x00\x00'
2178 2178 ##### revision "mJ,EA-change-m" #####
2179 2179 1 sidedata entries
2180 2180 entry-0014 size 4
2181 2181 '\x00\x00\x00\x00'
2182 2182
2183 2183 #endif
2184 2184
2185 2185
2186 2186 Test copy information chaining
2187 2187 ==============================
2188 2188
2189 2189 Check that matching only affect the destination and not intermediate path
2190 2190 -------------------------------------------------------------------------
2191 2191
2192 2192 The two status call should give the same value for f
2193 2193
2194 2194 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("a-2")'
2195 2195 A f
2196 2196 a
2197 2197 A t
2198 2198 p
2199 2199 R a
2200 2200 R p
2201 2201 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("a-2")' f
2202 2202 A f
2203 2203 a (no-changeset no-compatibility !)
2204 2204
2205 2205 merging with unrelated change does not interfere with the renames
2206 2206 ---------------------------------------------------------------
2207 2207
2208 2208 - rename on one side
2209 2209 - unrelated change on the other side
2210 2210
2211 2211 $ hg log -G --rev '::(desc("mABm")+desc("mBAm"))'
2212 2212 o mABm-0 simple merge - A side: multiple renames, B side: unrelated update - the other way
2213 2213 |\
2214 2214 +---o mBAm-0 simple merge - A side: multiple renames, B side: unrelated update - one way
2215 2215 | |/
2216 2216 | o b-1: b update
2217 2217 | |
2218 2218 o | a-2: e -move-> f
2219 2219 | |
2220 2220 o | a-1: d -move-> e
2221 2221 |/
2222 2222 o i-2: c -move-> d, s -move-> t
2223 2223 |
2224 2224 o i-1: a -move-> c, p -move-> s
2225 2225 |
2226 2226 o i-0 initial commit: a b h p q r
2227 2227
2228 2228
2229 2229 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
2230 2230 A f
2231 2231 d
2232 2232 R d
2233 2233 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
2234 2234 A f
2235 2235 d
2236 2236 R d
2237 2237 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
2238 2238 M b
2239 2239 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
2240 2240 M b
2241 2241 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
2242 2242 M b
2243 2243 A f
2244 2244 d
2245 2245 R d
2246 2246 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
2247 2247 M b
2248 2248 A f
2249 2249 d
2250 2250 R d
2251 2251 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
2252 2252 M b
2253 2253 A f
2254 2254 a
2255 2255 A t
2256 2256 p
2257 2257 R a
2258 2258 R p
2259 2259 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
2260 2260 M b
2261 2261 A f
2262 2262 a
2263 2263 A t
2264 2264 p
2265 2265 R a
2266 2266 R p
2267 2267
2268 2268 merging with the side having a delete
2269 2269 -------------------------------------
2270 2270
2271 2271 case summary:
2272 2272 - one with change to an unrelated file
2273 2273 - one deleting the change
2274 2274 and recreate an unrelated file after the merge
2275 2275
2276 2276 $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
2277 2277 o mCBm-1 re-add d
2278 2278 |
2279 2279 o mCBm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - the other way
2280 2280 |\
2281 2281 | | o mBCm-1 re-add d
2282 2282 | | |
2283 2283 +---o mBCm-0 simple merge - C side: delete a file with copies history , B side: unrelated update - one way
2284 2284 | |/
2285 2285 | o c-1 delete d
2286 2286 | |
2287 2287 o | b-1: b update
2288 2288 |/
2289 2289 o i-2: c -move-> d, s -move-> t
2290 2290 |
2291 2291 o i-1: a -move-> c, p -move-> s
2292 2292 |
2293 2293 o i-0 initial commit: a b h p q r
2294 2294
2295 2295 - comparing from the merge
2296 2296
2297 2297 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
2298 2298 R d
2299 2299 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-0")'
2300 2300 R d
2301 2301 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-0")'
2302 2302 M b
2303 2303 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-0")'
2304 2304 M b
2305 2305 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-0")'
2306 2306 M b
2307 2307 R d
2308 2308 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-0")'
2309 2309 M b
2310 2310 R d
2311 2311 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-0")'
2312 2312 M b
2313 2313 A t
2314 2314 p
2315 2315 R a
2316 2316 R p
2317 2317 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-0")'
2318 2318 M b
2319 2319 A t
2320 2320 p
2321 2321 R a
2322 2322 R p
2323 2323
2324 2324 - comparing with the merge children re-adding the file
2325 2325
2326 2326 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-1")'
2327 2327 M d
2328 2328 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-1")'
2329 2329 M d
2330 2330 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-1")'
2331 2331 M b
2332 2332 A d
2333 2333 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-1")'
2334 2334 M b
2335 2335 A d
2336 2336 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-1")'
2337 2337 M b
2338 2338 M d
2339 2339 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-1")'
2340 2340 M b
2341 2341 M d
2342 2342 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-1")'
2343 2343 M b
2344 2344 A d
2345 2345 A t
2346 2346 p
2347 2347 R a
2348 2348 R p
2349 2349 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-1")'
2350 2350 M b
2351 2351 A d
2352 2352 A t
2353 2353 p
2354 2354 R a
2355 2355 R p
2356 2356
2357 2357 Comparing with a merge re-adding the file afterward
2358 2358 ---------------------------------------------------
2359 2359
2360 2360 Merge:
2361 2361 - one with change to an unrelated file
2362 2362 - one deleting and recreating the change
2363 2363
2364 2364 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
2365 2365 o mDBm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - the other way
2366 2366 |\
2367 2367 +---o mBDm-0 simple merge - B side: unrelated update, D side: delete and recreate a file (with different content) - one way
2368 2368 | |/
2369 2369 | o d-2 re-add d
2370 2370 | |
2371 2371 | o d-1 delete d
2372 2372 | |
2373 2373 o | b-1: b update
2374 2374 |/
2375 2375 o i-2: c -move-> d, s -move-> t
2376 2376 |
2377 2377 o i-1: a -move-> c, p -move-> s
2378 2378 |
2379 2379 o i-0 initial commit: a b h p q r
2380 2380
2381 2381 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
2382 2382 M d
2383 2383 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
2384 2384 M d
2385 2385 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mBDm-0")'
2386 2386 M b
2387 2387 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDBm-0")'
2388 2388 M b
2389 2389 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBDm-0")'
2390 2390 M b
2391 2391 M d
2392 2392 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mDBm-0")'
2393 2393 M b
2394 2394 M d
2395 2395
2396 2396 The bugs makes recorded copy is different depending of where we started the merge from since
2397 2397
2398 2398 $ hg manifest --debug --rev 'desc("mBDm-0")' | grep '644 d'
2399 2399 b004912a8510032a0350a74daa2803dadfb00e12 644 d
2400 2400 $ hg manifest --debug --rev 'desc("mDBm-0")' | grep '644 d'
2401 2401 b004912a8510032a0350a74daa2803dadfb00e12 644 d
2402 2402
2403 2403 $ hg manifest --debug --rev 'desc("d-2")' | grep '644 d'
2404 2404 b004912a8510032a0350a74daa2803dadfb00e12 644 d
2405 2405 $ hg manifest --debug --rev 'desc("b-1")' | grep '644 d'
2406 2406 d8252ab2e760b0d4e5288fd44cbd15a0fa567e16 644 d (no-changeset !)
2407 2407 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 d (changeset !)
2408 2408 $ hg debugindex d | head -n 4 | "$PYTHON" ../no-linkrev
2409 2409 rev linkrev nodeid p1 p2
2410 2410 0 * d8252ab2e760 000000000000 000000000000 (no-changeset !)
2411 2411 0 * ae258f702dfe 000000000000 000000000000 (changeset !)
2412 2412 1 * b004912a8510 000000000000 000000000000
2413 2413 2 * 7b79e2fe0c89 000000000000 000000000000 (no-changeset !)
2414 2414 2 * 5cce88bf349f ae258f702dfe 000000000000 (changeset !)
2415 2415
2416 2416 Log output should not include a merge commit as it did not happen
2417 2417
2418 2418 $ hg log -Gfr 'desc("mBDm-0")' d
2419 2419 o d-2 re-add d
2420 2420 |
2421 2421 ~
2422 2422
2423 2423 $ hg log -Gfr 'desc("mDBm-0")' d
2424 2424 o d-2 re-add d
2425 2425 |
2426 2426 ~
2427 2427
2428 2428 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBDm-0")'
2429 2429 M b
2430 2430 A d
2431 2431 A t
2432 2432 p
2433 2433 R a
2434 2434 R p
2435 2435 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDBm-0")'
2436 2436 M b
2437 2437 A d
2438 2438 A t
2439 2439 p
2440 2440 R a
2441 2441 R p
2442 2442
2443 2443
2444 2444 Comparing with a merge with colliding rename
2445 2445 --------------------------------------------
2446 2446
2447 2447 Subcase: new copy information on both side
2448 2448 ``````````````````````````````````````````
2449 2449
2450 2450 - the "e-" branch renaming b to f (through 'g')
2451 2451 - the "a-" branch renaming d to f (through e)
2452 2452
2453 2453 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
2454 2454 o mEAm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - the other way
2455 2455 |\
2456 2456 +---o mAEm-0 merge with copies info on both side - A side: rename d to f, E side: b to f, (same content for f) - one way
2457 2457 | |/
2458 2458 | o e-2 g -move-> f
2459 2459 | |
2460 2460 | o e-1 b -move-> g
2461 2461 | |
2462 2462 o | a-2: e -move-> f
2463 2463 | |
2464 2464 o | a-1: d -move-> e
2465 2465 |/
2466 2466 o i-2: c -move-> d, s -move-> t
2467 2467 |
2468 2468 o i-1: a -move-> c, p -move-> s
2469 2469 |
2470 2470 o i-0 initial commit: a b h p q r
2471 2471
2472 2472 #if no-changeset
2473 2473 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
2474 2474 2ff93c643948464ee1f871867910ae43a45b0bea 644 f
2475 2475 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
2476 2476 2ff93c643948464ee1f871867910ae43a45b0bea 644 f
2477 2477 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
2478 2478 b76eb76580df486c3d51d63c5c210d4dd43a8ac7 644 f
2479 2479 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
2480 2480 e8825b386367b29fec957283a80bb47b47483fe1 644 f
2481 2481 $ hg debugindex f | "$PYTHON" ../no-linkrev
2482 2482 rev linkrev nodeid p1 p2
2483 2483 0 * b76eb76580df 000000000000 000000000000
2484 2484 1 * e8825b386367 000000000000 000000000000
2485 2485 2 * 2ff93c643948 b76eb76580df e8825b386367
2486 2486 3 * 2f649fba7eb2 b76eb76580df e8825b386367
2487 2487 4 * 774e7c1637d5 e8825b386367 b76eb76580df
2488 2488 #else
2489 2489 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
2490 2490 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
2491 2491 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
2492 2492 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
2493 2493 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
2494 2494 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
2495 2495 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
2496 2496 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
2497 2497 $ hg debugindex f | "$PYTHON" ../no-linkrev
2498 2498 rev linkrev nodeid p1 p2
2499 2499 0 * ae258f702dfe 000000000000 000000000000
2500 2500 1 * d3613c1ec831 ae258f702dfe 000000000000
2501 2501 2 * 05e03c868bbc ae258f702dfe 000000000000
2502 2502 #endif
2503 2503
2504 2504 # Here the filelog based implementation is not looking at the rename
2505 2505 # information (because the file exist on both side). However the changelog
2506 2506 # based on works fine. We have different output.
2507 2507
2508 2508 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
2509 2509 M f (no-changeset !)
2510 2510 b (no-filelog no-changeset !)
2511 2511 R b
2512 2512 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
2513 2513 M f (no-changeset !)
2514 2514 b (no-filelog no-changeset !)
2515 2515 R b
2516 2516 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAEm-0")'
2517 2517 M f (no-changeset !)
2518 2518 d (no-filelog no-changeset !)
2519 2519 R d
2520 2520 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
2521 2521 M f (no-changeset !)
2522 2522 d (no-filelog no-changeset !)
2523 2523 R d
2524 2524 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
2525 2525 A f
2526 2526 d
2527 2527 R d
2528 2528 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
2529 2529 A f
2530 2530 b
2531 2531 R b
2532 2532
2533 2533 # From here, we run status against revision where both source file exists.
2534 2534 #
2535 2535 # The filelog based implementation picks an arbitrary side based on revision
2536 2536 # numbers. So the same side "wins" whatever the parents order is. This is
2537 2537 # sub-optimal because depending on revision numbers means the result can be
2538 2538 # different from one repository to the next.
2539 2539 #
2540 2540 # The changeset based algorithm use the parent order to break tie on conflicting
2541 2541 # information and will have a different order depending on who is p1 and p2.
2542 2542 # That order is stable accross repositories. (data from p1 prevails)
2543 2543
2544 2544 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAEm-0")'
2545 2545 A f
2546 2546 d
2547 2547 R b
2548 2548 R d
2549 2549 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
2550 2550 A f
2551 2551 d (filelog !)
2552 2552 b (no-filelog !)
2553 2553 R b
2554 2554 R d
2555 2555 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
2556 2556 A f
2557 2557 a
2558 2558 A t
2559 2559 p
2560 2560 R a
2561 2561 R b
2562 2562 R p
2563 2563 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
2564 2564 A f
2565 2565 a (filelog !)
2566 2566 b (no-filelog !)
2567 2567 A t
2568 2568 p
2569 2569 R a
2570 2570 R b
2571 2571 R p
2572 2572
2573 2573
2574 2574 Subcase: existing copy information overwritten on one branch
2575 2575 ````````````````````````````````````````````````````````````
2576 2576
2577 2577 Note:
2578 2578 | In this case, one of the merge wrongly record a merge while there is none.
2579 2579 | This lead to bad copy tracing information to be dug up.
2580 2580
2581 2581
2582 2582 Merge:
2583 2583 - one with change to an unrelated file (b)
2584 2584 - one overwriting a file (d) with a rename (from h to i to d)
2585 2585
2586 2586 $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
2587 2587 o mFBm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
2588 2588 |\
2589 2589 +---o mBFm-0 simple merge - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
2590 2590 | |/
2591 2591 | o f-2: rename i -> d
2592 2592 | |
2593 2593 | o f-1: rename h -> i
2594 2594 | |
2595 2595 o | b-1: b update
2596 2596 |/
2597 2597 o i-2: c -move-> d, s -move-> t
2598 2598 |
2599 2599 o i-1: a -move-> c, p -move-> s
2600 2600 |
2601 2601 o i-0 initial commit: a b h p q r
2602 2602
2603 2603 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBFm-0")'
2604 2604 M b
2605 2605 A d
2606 2606 h
2607 2607 A t
2608 2608 p
2609 2609 R a
2610 2610 R h
2611 2611 R p
2612 2612 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFBm-0")'
2613 2613 M b
2614 2614 A d
2615 2615 h
2616 2616 A t
2617 2617 p
2618 2618 R a
2619 2619 R h
2620 2620 R p
2621 2621 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBFm-0")'
2622 2622 M d (no-changeset !)
2623 2623 h (no-filelog no-changeset !)
2624 2624 R h
2625 2625 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mBFm-0")'
2626 2626 M b
2627 2627 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mBFm-0")'
2628 2628 M b
2629 2629 M d (no-changeset !)
2630 2630 i (no-filelog no-changeset !)
2631 2631 R i
2632 2632 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mFBm-0")'
2633 2633 M d (no-changeset !)
2634 2634 h (no-filelog no-changeset !)
2635 2635 R h
2636 2636 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFBm-0")'
2637 2637 M b
2638 2638 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFBm-0")'
2639 2639 M b
2640 2640 M d (no-changeset !)
2641 2641 i (no-filelog no-changeset !)
2642 2642 R i
2643 2643
2644 2644 #if no-changeset
2645 2645 $ hg log -Gfr 'desc("mBFm-0")' d
2646 2646 o f-2: rename i -> d
2647 2647 |
2648 2648 o f-1: rename h -> i
2649 2649 :
2650 2650 o i-0 initial commit: a b h p q r
2651 2651
2652 2652 #else
2653 2653 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2654 2654 $ hg log -Gfr 'desc("mBFm-0")' d
2655 2655 o i-2: c -move-> d, s -move-> t
2656 2656 |
2657 2657 ~
2658 2658 #endif
2659 2659
2660 2660 #if no-changeset
2661 2661 $ hg log -Gfr 'desc("mFBm-0")' d
2662 2662 o f-2: rename i -> d
2663 2663 |
2664 2664 o f-1: rename h -> i
2665 2665 :
2666 2666 o i-0 initial commit: a b h p q r
2667 2667
2668 2668 #else
2669 2669 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2670 2670 $ hg log -Gfr 'desc("mFBm-0")' d
2671 2671 o i-2: c -move-> d, s -move-> t
2672 2672 |
2673 2673 ~
2674 2674 #endif
2675 2675
2676 2676
2677 2677 Subcase: existing copy information overwritten on one branch, with different content)
2678 2678 `````````````````````````````````````````````````````````````````````````````````````
2679 2679
2680 2680 Merge:
2681 2681 - one with change to an unrelated file (b)
2682 2682 - one overwriting a file (t) with a rename (from r to x to t), v content is not the same as on the other branch
2683 2683
2684 2684 $ hg log -G --rev '::(desc("mBRm")+desc("mRBm"))'
2685 2685 o mRBm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - the other way
2686 2686 |\
2687 2687 +---o mBRm-0 simple merge - B side: unrelated change, R side: overwrite d with a copy (from r->x->t) different content - one way
2688 2688 | |/
2689 2689 | o r-2: rename t -> x
2690 2690 | |
2691 2691 | o r-1: rename r -> x
2692 2692 | |
2693 2693 o | b-1: b update
2694 2694 |/
2695 2695 o i-2: c -move-> d, s -move-> t
2696 2696 |
2697 2697 o i-1: a -move-> c, p -move-> s
2698 2698 |
2699 2699 o i-0 initial commit: a b h p q r
2700 2700
2701 2701 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBRm-0")'
2702 2702 M b
2703 2703 A d
2704 2704 a
2705 2705 A t
2706 2706 r
2707 2707 R a
2708 2708 R p
2709 2709 R r
2710 2710 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mRBm-0")'
2711 2711 M b
2712 2712 A d
2713 2713 a
2714 2714 A t
2715 2715 r
2716 2716 R a
2717 2717 R p
2718 2718 R r
2719 2719 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBRm-0")'
2720 2720 M t
2721 2721 r (no-filelog !)
2722 2722 R r
2723 2723 $ hg status --copies --rev 'desc("r-2")' --rev 'desc("mBRm-0")'
2724 2724 M b
2725 2725 $ hg status --copies --rev 'desc("r-1")' --rev 'desc("mBRm-0")'
2726 2726 M b
2727 2727 M t
2728 2728 x (no-filelog !)
2729 2729 R x
2730 2730 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mRBm-0")'
2731 2731 M t
2732 2732 r (no-filelog !)
2733 2733 R r
2734 2734 $ hg status --copies --rev 'desc("r-2")' --rev 'desc("mRBm-0")'
2735 2735 M b
2736 2736 $ hg status --copies --rev 'desc("r-1")' --rev 'desc("mRBm-0")'
2737 2737 M b
2738 2738 M t
2739 2739 x (no-filelog !)
2740 2740 R x
2741 2741
2742 2742 #if no-changeset
2743 2743 $ hg log -Gfr 'desc("mBRm-0")' d
2744 2744 o i-2: c -move-> d, s -move-> t
2745 2745 |
2746 2746 o i-1: a -move-> c, p -move-> s
2747 2747 |
2748 2748 o i-0 initial commit: a b h p q r
2749 2749
2750 2750 #else
2751 2751 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2752 2752 $ hg log -Gfr 'desc("mBRm-0")' d
2753 2753 o i-2: c -move-> d, s -move-> t
2754 2754 |
2755 2755 ~
2756 2756 #endif
2757 2757
2758 2758 #if no-changeset
2759 2759 $ hg log -Gfr 'desc("mRBm-0")' d
2760 2760 o i-2: c -move-> d, s -move-> t
2761 2761 |
2762 2762 o i-1: a -move-> c, p -move-> s
2763 2763 |
2764 2764 o i-0 initial commit: a b h p q r
2765 2765
2766 2766 #else
2767 2767 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2768 2768 $ hg log -Gfr 'desc("mRBm-0")' d
2769 2769 o i-2: c -move-> d, s -move-> t
2770 2770 |
2771 2771 ~
2772 2772 #endif
2773 2773
2774 2774 Subcase: reset of the copy history on one side
2775 2775 ``````````````````````````````````````````````
2776 2776
2777 2777 Merge:
2778 2778 - one with change to a file
2779 2779 - one deleting and recreating the file
2780 2780
2781 2781 Unlike in the 'BD/DB' cases, an actual merge happened here. So we should
2782 2782 consider history and rename on both branch of the merge.
2783 2783
2784 2784 $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
2785 2785 o mGDm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - the other way
2786 2786 |\
2787 2787 +---o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
2788 2788 | |/
2789 2789 | o g-1: update d
2790 2790 | |
2791 2791 o | d-2 re-add d
2792 2792 | |
2793 2793 o | d-1 delete d
2794 2794 |/
2795 2795 o i-2: c -move-> d, s -move-> t
2796 2796 |
2797 2797 o i-1: a -move-> c, p -move-> s
2798 2798 |
2799 2799 o i-0 initial commit: a b h p q r
2800 2800
2801 2801 One side of the merge have a long history with rename. The other side of the
2802 2802 merge point to a new file with a smaller history. Each side is "valid".
2803 2803
2804 2804 (and again the filelog based algorithm only explore one, with a pick based on
2805 2805 revision numbers)
2806 2806
2807 2807 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
2808 2808 A d
2809 2809 a (filelog !)
2810 2810 A t
2811 2811 p
2812 2812 R a
2813 2813 R p
2814 2814 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
2815 2815 A d
2816 2816 a
2817 2817 A t
2818 2818 p
2819 2819 R a
2820 2820 R p
2821 2821 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDGm-0")'
2822 2822 M d
2823 2823 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mGDm-0")'
2824 2824 M d
2825 2825 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mDGm-0")'
2826 2826 M d
2827 2827 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGDm-0")'
2828 2828 M d
2829 2829
2830 2830 #if no-changeset
2831 2831 $ hg log -Gfr 'desc("mDGm-0")' d
2832 2832 o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
2833 2833 |\
2834 2834 | o g-1: update d
2835 2835 | |
2836 2836 o | d-2 re-add d
2837 2837 |/
2838 2838 o i-2: c -move-> d, s -move-> t
2839 2839 |
2840 2840 o i-1: a -move-> c, p -move-> s
2841 2841 |
2842 2842 o i-0 initial commit: a b h p q r
2843 2843
2844 2844 #else
2845 2845 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2846 2846 $ hg log -Gfr 'desc("mDGm-0")' d
2847 2847 o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
2848 2848 |\
2849 2849 | o g-1: update d
2850 2850 | |
2851 2851 o | d-2 re-add d
2852 2852 |/
2853 2853 o i-2: c -move-> d, s -move-> t
2854 2854 |
2855 2855 ~
2856 2856 #endif
2857 2857
2858 2858
2859 2859 #if no-changeset
2860 2860 $ hg log -Gfr 'desc("mDGm-0")' d
2861 2861 o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
2862 2862 |\
2863 2863 | o g-1: update d
2864 2864 | |
2865 2865 o | d-2 re-add d
2866 2866 |/
2867 2867 o i-2: c -move-> d, s -move-> t
2868 2868 |
2869 2869 o i-1: a -move-> c, p -move-> s
2870 2870 |
2871 2871 o i-0 initial commit: a b h p q r
2872 2872
2873 2873 #else
2874 2874 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2875 2875 $ hg log -Gfr 'desc("mDGm-0")' d
2876 2876 o mDGm-0 actual content merge, copies on one side - D side: delete and re-add (different content), G side: update content - one way
2877 2877 |\
2878 2878 | o g-1: update d
2879 2879 | |
2880 2880 o | d-2 re-add d
2881 2881 |/
2882 2882 o i-2: c -move-> d, s -move-> t
2883 2883 |
2884 2884 ~
2885 2885 #endif
2886 2886
2887 2887 Subcase: merging a change to a file with a "copy overwrite" to that file from another branch
2888 2888 ````````````````````````````````````````````````````````````````````````````````````````````
2889 2889
2890 2890 Merge:
2891 2891 - one with change to a file (d)
2892 2892 - one overwriting that file with a rename (from h to i, to d)
2893 2893
2894 2894 This case is similar to BF/FB, but an actual merge happens, so both side of the
2895 2895 history are relevant.
2896 2896
2897 2897
2898 2898 $ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
2899 2899 o mGFm-0 merge - G side: content change, F side: copy overwrite, no content change - the other way
2900 2900 |\
2901 2901 +---o mFGm-0 merge - G side: content change, F side: copy overwrite, no content change - one way
2902 2902 | |/
2903 2903 | o g-1: update d
2904 2904 | |
2905 2905 o | f-2: rename i -> d
2906 2906 | |
2907 2907 o | f-1: rename h -> i
2908 2908 |/
2909 2909 o i-2: c -move-> d, s -move-> t
2910 2910 |
2911 2911 o i-1: a -move-> c, p -move-> s
2912 2912 |
2913 2913 o i-0 initial commit: a b h p q r
2914 2914
2915 2915
2916 2916 Note:
2917 2917 | In this case, the merge get conflicting information since on one side we have
2918 2918 | "a -> c -> d". and one the other one we have "h -> i -> d".
2919 2919 |
2920 2920 | The current code arbitrarily pick one side depending the ordering of the merged hash:
2921 2921
2922 2922 In this case, the file hash from "f-2" is lower, so it will be `p1` of the resulting filenode its copy tracing information will win (and trace back to "h"):
2923 2923
2924 2924 Details on this hash ordering pick:
2925 2925
2926 2926 $ hg manifest --debug 'desc("g-1")' | egrep 'd$'
2927 2927 17ec97e605773eb44a117d1136b3849bcdc1924f 644 d (no-changeset !)
2928 2928 5cce88bf349f7c742bb440f2c53f81db9c294279 644 d (changeset !)
2929 2929 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("g-1")' d
2930 2930 A d
2931 2931 a (no-changeset no-compatibility !)
2932 2932
2933 2933 $ hg manifest --debug 'desc("f-2")' | egrep 'd$'
2934 2934 7b79e2fe0c8924e0e598a82f048a7b024afa4d96 644 d (no-changeset !)
2935 2935 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 d (changeset !)
2936 2936 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("f-2")' d
2937 2937 A d
2938 2938 h (no-changeset no-compatibility !)
2939 2939
2940 2940 Copy tracing data on the resulting merge:
2941 2941
2942 2942 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm-0")'
2943 2943 A d
2944 2944 h (no-filelog !)
2945 2945 a (filelog !)
2946 2946 A t
2947 2947 p
2948 2948 R a
2949 2949 R h
2950 2950 R p
2951 2951 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm-0")'
2952 2952 A d
2953 2953 a (no-changeset !)
2954 2954 h (changeset !)
2955 2955 A t
2956 2956 p
2957 2957 R a
2958 2958 R h
2959 2959 R p
2960 2960 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFGm-0")'
2961 2961 M d
2962 2962 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mGFm-0")'
2963 2963 M d
2964 2964 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFGm-0")'
2965 2965 M d
2966 2966 i (no-filelog !)
2967 2967 R i
2968 2968 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mGFm-0")'
2969 2969 M d
2970 2970 i (no-filelog !)
2971 2971 R i
2972 2972 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mFGm-0")'
2973 2973 M d (no-changeset !)
2974 2974 h (no-filelog no-changeset !)
2975 2975 R h
2976 2976 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGFm-0")'
2977 2977 M d (no-changeset !)
2978 2978 h (no-filelog no-changeset !)
2979 2979 R h
2980 2980
2981 2981 #if no-changeset
2982 2982 $ hg log -Gfr 'desc("mFGm-0")' d
2983 2983 o mFGm-0 merge - G side: content change, F side: copy overwrite, no content change - one way
2984 2984 |\
2985 2985 | o g-1: update d
2986 2986 | |
2987 2987 o | f-2: rename i -> d
2988 2988 | |
2989 2989 o | f-1: rename h -> i
2990 2990 |/
2991 2991 o i-2: c -move-> d, s -move-> t
2992 2992 |
2993 2993 o i-1: a -move-> c, p -move-> s
2994 2994 |
2995 2995 o i-0 initial commit: a b h p q r
2996 2996
2997 2997 #else
2998 2998 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
2999 2999 $ hg log -Gfr 'desc("mFGm-0")' d
3000 3000 o g-1: update d
3001 3001 |
3002 3002 o i-2: c -move-> d, s -move-> t
3003 3003 |
3004 3004 ~
3005 3005 #endif
3006 3006
3007 3007 #if no-changeset
3008 3008 $ hg log -Gfr 'desc("mGFm-0")' d
3009 3009 o mGFm-0 merge - G side: content change, F side: copy overwrite, no content change - the other way
3010 3010 |\
3011 3011 | o g-1: update d
3012 3012 | |
3013 3013 o | f-2: rename i -> d
3014 3014 | |
3015 3015 o | f-1: rename h -> i
3016 3016 |/
3017 3017 o i-2: c -move-> d, s -move-> t
3018 3018 |
3019 3019 o i-1: a -move-> c, p -move-> s
3020 3020 |
3021 3021 o i-0 initial commit: a b h p q r
3022 3022
3023 3023 #else
3024 3024 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
3025 3025 $ hg log -Gfr 'desc("mGFm-0")' d
3026 3026 o g-1: update d
3027 3027 |
3028 3028 o i-2: c -move-> d, s -move-> t
3029 3029 |
3030 3030 ~
3031 3031 #endif
3032 3032
3033 3033 Subcase: new copy information on both side with an actual merge happening
3034 3034 `````````````````````````````````````````````````````````````````````````
3035 3035
3036 3036 - the "p-" branch renaming 't' to 'v' (through 'u')
3037 3037 - the "q-" branch renaming 'r' to 'v' (through 'w')
3038 3038
3039 3039
3040 3040 $ hg log -G --rev '::(desc("mPQm")+desc("mQPm"))'
3041 3041 o mQPm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - the other way
3042 3042 |\
3043 3043 +---o mPQm-0 merge with copies info on both side - P side: rename t to v, Q side: r to v, (different content) - one way
3044 3044 | |/
3045 3045 | o q-2 w -move-> v
3046 3046 | |
3047 3047 | o q-1 r -move-> w
3048 3048 | |
3049 3049 o | p-2: u -move-> v
3050 3050 | |
3051 3051 o | p-1: t -move-> u
3052 3052 |/
3053 3053 o i-2: c -move-> d, s -move-> t
3054 3054 |
3055 3055 o i-1: a -move-> c, p -move-> s
3056 3056 |
3057 3057 o i-0 initial commit: a b h p q r
3058 3058
3059 3059
3060 3060 #if no-changeset
3061 3061 $ hg manifest --debug --rev 'desc("mPQm-0")' | grep '644 v'
3062 3062 0946c662ef16e4e67397fd717389eb6693d41749 644 v
3063 3063 $ hg manifest --debug --rev 'desc("mQPm-0")' | grep '644 v'
3064 3064 0db3aad7fcc1ec27fab57060e327b9e864ea0cc9 644 v
3065 3065 $ hg manifest --debug --rev 'desc("p-2")' | grep '644 v'
3066 3066 3f91841cd75cadc9a1f1b4e7c1aa6d411f76032e 644 v
3067 3067 $ hg manifest --debug --rev 'desc("q-2")' | grep '644 v'
3068 3068 c43c088b811fd27983c0a9aadf44f3343cd4cd7e 644 v
3069 3069 $ hg debugindex v | "$PYTHON" ../no-linkrev
3070 3070 rev linkrev nodeid p1 p2
3071 3071 0 * 3f91841cd75c 000000000000 000000000000
3072 3072 1 * c43c088b811f 000000000000 000000000000
3073 3073 2 * 0946c662ef16 3f91841cd75c c43c088b811f
3074 3074 3 * 0db3aad7fcc1 c43c088b811f 3f91841cd75c
3075 3075 #else
3076 3076 $ hg manifest --debug --rev 'desc("mPQm-0")' | grep '644 v'
3077 3077 65fde9f6e4d4da23b3f610e07b53673ea9541d75 644 v
3078 3078 $ hg manifest --debug --rev 'desc("mQPm-0")' | grep '644 v'
3079 3079 a098dda6413aecf154eefc976afc38b295acb7e5 644 v
3080 3080 $ hg manifest --debug --rev 'desc("p-2")' | grep '644 v'
3081 3081 5aed6a8dbff0301328c08360d24354d3d064cf0d 644 v
3082 3082 $ hg manifest --debug --rev 'desc("q-2")' | grep '644 v'
3083 3083 a38b2fa170219750dac9bc7d19df831f213ba708 644 v
3084 3084 $ hg debugindex v | "$PYTHON" ../no-linkrev
3085 3085 rev linkrev nodeid p1 p2
3086 3086 0 * 5aed6a8dbff0 000000000000 000000000000
3087 3087 1 * a38b2fa17021 000000000000 000000000000
3088 3088 2 * 65fde9f6e4d4 5aed6a8dbff0 a38b2fa17021
3089 3089 3 * a098dda6413a a38b2fa17021 5aed6a8dbff0
3090 3090 #endif
3091 3091
3092 3092 # Here the filelog based implementation is not looking at the rename
3093 3093 # information (because the file exist on both side). However the changelog
3094 3094 # based on works fine. We have different output.
3095 3095
3096 3096 $ hg status --copies --rev 'desc("p-2")' --rev 'desc("mPQm-0")'
3097 3097 M v
3098 3098 r (no-filelog !)
3099 3099 R r
3100 3100 $ hg status --copies --rev 'desc("p-2")' --rev 'desc("mQPm-0")'
3101 3101 M v
3102 3102 r (no-filelog !)
3103 3103 R r
3104 3104 $ hg status --copies --rev 'desc("q-2")' --rev 'desc("mPQm-0")'
3105 3105 M v
3106 3106 t (no-filelog !)
3107 3107 R t
3108 3108 $ hg status --copies --rev 'desc("q-2")' --rev 'desc("mQPm-0")'
3109 3109 M v
3110 3110 t (no-filelog !)
3111 3111 R t
3112 3112 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("p-2")'
3113 3113 A v
3114 3114 t
3115 3115 R t
3116 3116 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("q-2")'
3117 3117 A v
3118 3118 r
3119 3119 R r
3120 3120
3121 3121 # From here, we run status against revision where both source file exists.
3122 3122 #
3123 3123 # The filelog based implementation picks an arbitrary side based on revision
3124 3124 # numbers. So the same side "wins" whatever the parents order is. This is
3125 3125 # sub-optimal because depending on revision numbers means the result can be
3126 3126 # different from one repository to the next.
3127 3127 #
3128 3128 # The changeset based algorithm use the parent order to break tie on conflicting
3129 3129 # information and will have a different order depending on who is p1 and p2.
3130 3130 # That order is stable accross repositories. (data from p1 prevails)
3131 3131
3132 3132 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mPQm-0")'
3133 3133 A v
3134 3134 t
3135 3135 R r
3136 3136 R t
3137 3137 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mQPm-0")'
3138 3138 A v
3139 3139 t (filelog !)
3140 3140 r (no-filelog !)
3141 3141 R r
3142 3142 R t
3143 3143 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQm-0")'
3144 3144 A d
3145 3145 a
3146 3146 A v
3147 3147 r (filelog !)
3148 3148 p (no-filelog !)
3149 3149 R a
3150 3150 R p
3151 3151 R r
3152 3152 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mQPm-0")'
3153 3153 A d
3154 3154 a
3155 3155 A v
3156 3156 r
3157 3157 R a
3158 3158 R p
3159 3159 R r
3160 3160
3161 3161
3162 3162 Comparing with merging with a deletion (and keeping the file)
3163 3163 -------------------------------------------------------------
3164 3164
3165 3165 Merge:
3166 3166 - one removing a file (d)
3167 3167 - one updating that file
3168 3168 - the merge keep the modified version of the file (canceling the delete)
3169 3169
3170 3170 In this case, the file keep on living after the merge. So we should not drop its
3171 3171 copy tracing chain.
3172 3172
3173 3173 $ hg log -G --rev '::(desc("mCGm")+desc("mGCm"))'
3174 3174 o mGCm-0 merge updated/deleted - revive the file (updated content) - the other way
3175 3175 |\
3176 3176 +---o mCGm-0 merge updated/deleted - revive the file (updated content) - one way
3177 3177 | |/
3178 3178 | o g-1: update d
3179 3179 | |
3180 3180 o | c-1 delete d
3181 3181 |/
3182 3182 o i-2: c -move-> d, s -move-> t
3183 3183 |
3184 3184 o i-1: a -move-> c, p -move-> s
3185 3185 |
3186 3186 o i-0 initial commit: a b h p q r
3187 3187
3188 3188
3189 3189 'a' is the copy source of 'd'
3190 3190
3191 3191 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCGm-0")'
3192 3192 A d
3193 3193 a (no-compatibility no-changeset !)
3194 3194 A t
3195 3195 p
3196 3196 R a
3197 3197 R p
3198 3198 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGCm-0")'
3199 3199 A d
3200 3200 a (no-compatibility no-changeset !)
3201 3201 A t
3202 3202 p
3203 3203 R a
3204 3204 R p
3205 3205 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCGm-0")'
3206 3206 A d
3207 3207 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mGCm-0")'
3208 3208 A d
3209 3209 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mCGm-0")'
3210 3210 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGCm-0")'
3211 3211
3212 3212
3213 3213 Comparing with merge restoring an untouched deleted file
3214 3214 --------------------------------------------------------
3215 3215
3216 3216 Merge:
3217 3217 - one removing a file (d)
3218 3218 - one leaving the file untouched
3219 3219 - the merge actively restore the file to the same content.
3220 3220
3221 3221 In this case, the file keep on living after the merge. So we should not drop its
3222 3222 copy tracing chain.
3223 3223
3224 3224 $ hg log -G --rev '::(desc("mCB-revert-m")+desc("mBC-revert-m"))'
3225 3225 o mBC-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
3226 3226 |\
3227 3227 +---o mCB-revert-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
3228 3228 | |/
3229 3229 | o c-1 delete d
3230 3230 | |
3231 3231 o | b-1: b update
3232 3232 |/
3233 3233 o i-2: c -move-> d, s -move-> t
3234 3234 |
3235 3235 o i-1: a -move-> c, p -move-> s
3236 3236 |
3237 3237 o i-0 initial commit: a b h p q r
3238 3238
3239 3239
3240 3240 'a' is the the copy source of 'd'
3241 3241
3242 3242 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB-revert-m-0")'
3243 3243 M b
3244 3244 A d
3245 3245 a (no-compatibility no-changeset !)
3246 3246 A t
3247 3247 p
3248 3248 R a
3249 3249 R p
3250 3250 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC-revert-m-0")'
3251 3251 M b
3252 3252 A d
3253 3253 a (no-compatibility no-changeset !)
3254 3254 A t
3255 3255 p
3256 3256 R a
3257 3257 R p
3258 3258 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCB-revert-m-0")'
3259 3259 M b
3260 3260 A d
3261 3261 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBC-revert-m-0")'
3262 3262 M b
3263 3263 A d
3264 3264 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCB-revert-m-0")'
3265 3265 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBC-revert-m-0")'
3266 3266
3267 3267
3268 3268 Merging a branch where a rename was deleted with a branch where the same file was renamed
3269 3269 ------------------------------------------------------------------------------------------
3270 3270
3271 3271 Create a "conflicting" merge where `d` get removed on one branch before its
3272 3272 rename information actually conflict with the other branch.
3273 3273
3274 3274 (the copy information from the branch that was not deleted should win).
3275 3275
3276 3276 $ hg log -G --rev '::(desc("mCH-delete-before-conflict-m")+desc("mHC-delete-before-conflict-m"))'
3277 3277 o mHC-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - the other way
3278 3278 |\
3279 3279 +---o mCH-delete-before-conflict-m-0 simple merge - C side: d is the results of renames then deleted, H side: d is result of another rename (same content as the other branch) - one way
3280 3280 | |/
3281 3281 | o h-1: b -(move)-> d
3282 3282 | |
3283 3283 o | c-1 delete d
3284 3284 | |
3285 3285 o | i-2: c -move-> d, s -move-> t
3286 3286 | |
3287 3287 o | i-1: a -move-> c, p -move-> s
3288 3288 |/
3289 3289 o i-0 initial commit: a b h p q r
3290 3290
3291 3291
3292 3292 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCH-delete-before-conflict-m")'
3293 3293 A d
3294 3294 b (no-compatibility no-changeset !)
3295 3295 A t
3296 3296 p
3297 3297 R a
3298 3298 R b
3299 3299 R p
3300 3300 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mHC-delete-before-conflict-m")'
3301 3301 A d
3302 3302 b
3303 3303 A t
3304 3304 p
3305 3305 R a
3306 3306 R b
3307 3307 R p
3308 3308 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCH-delete-before-conflict-m")'
3309 3309 A d
3310 3310 b
3311 3311 R b
3312 3312 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mHC-delete-before-conflict-m")'
3313 3313 A d
3314 3314 b
3315 3315 R b
3316 3316 $ hg status --copies --rev 'desc("h-1")' --rev 'desc("mCH-delete-before-conflict-m")'
3317 3317 A t
3318 3318 p
3319 3319 R a
3320 3320 R p
3321 3321 $ hg status --copies --rev 'desc("h-1")' --rev 'desc("mHC-delete-before-conflict-m")'
3322 3322 A t
3323 3323 p
3324 3324 R a
3325 3325 R p
3326 3326
3327 3327 Variant of previous with extra changes introduced by the merge
3328 3328 --------------------------------------------------------------
3329 3329
3330 3330 (see case declaration for details)
3331 3331
3332 3332 Subcase: merge has same initial content on both side, but merge introduced a change
3333 3333 ```````````````````````````````````````````````````````````````````````````````````
3334 3334
3335 3335 - the "e-" branch renaming b to f (through 'g')
3336 3336 - the "a-" branch renaming d to f (through e)
3337 3337 - the merge add new change to b
3338 3338
3339 3339 $ hg log -G --rev '::(desc("mAE-change-m")+desc("mEA-change-m"))'
3340 3340 o mEA-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - the other way
3341 3341 |\
3342 3342 +---o mAE-change-m-0 merge with file update and copies info on both side - A side: rename d to f, E side: b to f, (same content for f in parent) - one way
3343 3343 | |/
3344 3344 | o e-2 g -move-> f
3345 3345 | |
3346 3346 | o e-1 b -move-> g
3347 3347 | |
3348 3348 o | a-2: e -move-> f
3349 3349 | |
3350 3350 o | a-1: d -move-> e
3351 3351 |/
3352 3352 o i-2: c -move-> d, s -move-> t
3353 3353 |
3354 3354 o i-1: a -move-> c, p -move-> s
3355 3355 |
3356 3356 o i-0 initial commit: a b h p q r
3357 3357
3358 3358 #if no-changeset
3359 3359 $ hg manifest --debug --rev 'desc("mAE-change-m-0")' | grep '644 f'
3360 3360 2f649fba7eb284e720d02b61f0546fcef694c045 644 f
3361 3361 $ hg manifest --debug --rev 'desc("mEA-change-m-0")' | grep '644 f'
3362 3362 774e7c1637d536b99e2d8ef16fd731f87a82bd09 644 f
3363 3363 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
3364 3364 b76eb76580df486c3d51d63c5c210d4dd43a8ac7 644 f
3365 3365 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
3366 3366 e8825b386367b29fec957283a80bb47b47483fe1 644 f
3367 3367 $ hg debugindex f | "$PYTHON" ../no-linkrev
3368 3368 rev linkrev nodeid p1 p2
3369 3369 0 * b76eb76580df 000000000000 000000000000
3370 3370 1 * e8825b386367 000000000000 000000000000
3371 3371 2 * 2ff93c643948 b76eb76580df e8825b386367
3372 3372 3 * 2f649fba7eb2 b76eb76580df e8825b386367
3373 3373 4 * 774e7c1637d5 e8825b386367 b76eb76580df
3374 3374 #else
3375 3375 $ hg manifest --debug --rev 'desc("mAE-change-m-0")' | grep '644 f'
3376 3376 d3613c1ec8310a812ac4268fd853ac576b6caea5 644 f
3377 3377 $ hg manifest --debug --rev 'desc("mEA-change-m-0")' | grep '644 f'
3378 3378 05e03c868bbcab4a649cb33a238d7aa07398a469 644 f
3379 3379 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
3380 3380 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
3381 3381 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
3382 3382 ae258f702dfeca05bf9b6a22a97a4b5645570f11 644 f
3383 3383 $ hg debugindex f | "$PYTHON" ../no-linkrev
3384 3384 rev linkrev nodeid p1 p2
3385 3385 0 * ae258f702dfe 000000000000 000000000000
3386 3386 1 * d3613c1ec831 ae258f702dfe 000000000000
3387 3387 2 * 05e03c868bbc ae258f702dfe 000000000000
3388 3388 #endif
3389 3389
3390 3390 # Here the filelog based implementation is not looking at the rename
3391 3391 # information (because the file exist on both side). However the changelog
3392 3392 # based on works fine. We have different output.
3393 3393
3394 3394 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAE-change-m-0")'
3395 3395 M f
3396 3396 b (no-filelog !)
3397 3397 R b
3398 3398 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEA-change-m-0")'
3399 3399 M f
3400 3400 b (no-filelog !)
3401 3401 R b
3402 3402 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAE-change-m-0")'
3403 3403 M f
3404 3404 d (no-filelog !)
3405 3405 R d
3406 3406 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEA-change-m-0")'
3407 3407 M f
3408 3408 d (no-filelog !)
3409 3409 R d
3410 3410 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
3411 3411 A f
3412 3412 d
3413 3413 R d
3414 3414 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
3415 3415 A f
3416 3416 b
3417 3417 R b
3418 3418
3419 3419 # From here, we run status against revision where both source file exists.
3420 3420 #
3421 3421 # The filelog based implementation picks an arbitrary side based on revision
3422 3422 # numbers. So the same side "wins" whatever the parents order is. This is
3423 3423 # sub-optimal because depending on revision numbers means the result can be
3424 3424 # different from one repository to the next.
3425 3425 #
3426 3426 # The changeset based algorithm use the parent order to break tie on conflicting
3427 3427 # information and will have a different order depending on who is p1 and p2.
3428 3428 # That order is stable accross repositories. (data from p1 prevails)
3429 3429
3430 3430 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAE-change-m-0")'
3431 3431 A f
3432 3432 d
3433 3433 R b
3434 3434 R d
3435 3435 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEA-change-m-0")'
3436 3436 A f
3437 3437 d (filelog !)
3438 3438 b (no-filelog !)
3439 3439 R b
3440 3440 R d
3441 3441 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE-change-m-0")'
3442 3442 A f
3443 3443 a
3444 3444 A t
3445 3445 p
3446 3446 R a
3447 3447 R b
3448 3448 R p
3449 3449 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change-m-0")'
3450 3450 A f
3451 3451 a (filelog !)
3452 3452 b (no-filelog !)
3453 3453 A t
3454 3454 p
3455 3455 R a
3456 3456 R b
3457 3457 R p
3458 3458
3459 3459
3460 3460 Subcase: merge overwrite common copy information, but with extra change during the merge
3461 3461 ```````````````````````````````````````````````````````````````````````````````````
3462 3462
3463 3463 Merge:
3464 3464 - one with change to an unrelated file (b)
3465 3465 - one overwriting a file (d) with a rename (from h to i to d)
3466 3466
3467 3467 $ hg log -G --rev '::(desc("mBF-change-m")+desc("mFB-change-m"))'
3468 3468 o mFB-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
3469 3469 |\
3470 3470 +---o mBF-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
3471 3471 | |/
3472 3472 | o f-2: rename i -> d
3473 3473 | |
3474 3474 | o f-1: rename h -> i
3475 3475 | |
3476 3476 o | b-1: b update
3477 3477 |/
3478 3478 o i-2: c -move-> d, s -move-> t
3479 3479 |
3480 3480 o i-1: a -move-> c, p -move-> s
3481 3481 |
3482 3482 o i-0 initial commit: a b h p q r
3483 3483
3484 3484 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBF-change-m-0")'
3485 3485 M b
3486 3486 A d
3487 3487 h
3488 3488 A t
3489 3489 p
3490 3490 R a
3491 3491 R h
3492 3492 R p
3493 3493 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFB-change-m-0")'
3494 3494 M b
3495 3495 A d
3496 3496 h
3497 3497 A t
3498 3498 p
3499 3499 R a
3500 3500 R h
3501 3501 R p
3502 3502 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBF-change-m-0")'
3503 3503 M d
3504 3504 h (no-filelog !)
3505 3505 R h
3506 3506 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mBF-change-m-0")'
3507 3507 M b
3508 3508 M d
3509 3509 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mBF-change-m-0")'
3510 3510 M b
3511 3511 M d
3512 3512 i (no-filelog !)
3513 3513 R i
3514 3514 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mFB-change-m-0")'
3515 3515 M d
3516 3516 h (no-filelog !)
3517 3517 R h
3518 3518 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFB-change-m-0")'
3519 3519 M b
3520 3520 M d
3521 3521 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFB-change-m-0")'
3522 3522 M b
3523 3523 M d
3524 3524 i (no-filelog !)
3525 3525 R i
3526 3526
3527 3527 #if no-changeset
3528 3528 $ hg log -Gfr 'desc("mBF-change-m-0")' d
3529 3529 o mBF-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
3530 3530 |\
3531 3531 o : f-2: rename i -> d
3532 3532 | :
3533 3533 o : f-1: rename h -> i
3534 3534 :/
3535 3535 o i-0 initial commit: a b h p q r
3536 3536
3537 3537 #else
3538 3538 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
3539 3539 $ hg log -Gfr 'desc("mBF-change-m-0")' d
3540 3540 o mBF-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - one way
3541 3541 :
3542 3542 o i-2: c -move-> d, s -move-> t
3543 3543 |
3544 3544 ~
3545 3545 #endif
3546 3546
3547 3547 #if no-changeset
3548 3548 $ hg log -Gfr 'desc("mFB-change-m-0")' d
3549 3549 o mFB-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
3550 3550 |\
3551 3551 o : f-2: rename i -> d
3552 3552 | :
3553 3553 o : f-1: rename h -> i
3554 3554 :/
3555 3555 o i-0 initial commit: a b h p q r
3556 3556
3557 3557 #else
3558 3558 BROKEN: `hg log --follow <file>` relies on filelog metadata to work
3559 3559 $ hg log -Gfr 'desc("mFB-change-m-0")' d
3560 3560 o mFB-change-m-0 merge with extra change - B side: unrelated change, F side: overwrite d with a copy (from h->i->d) - the other way
3561 3561 :
3562 3562 o i-2: c -move-> d, s -move-> t
3563 3563 |
3564 3564 ~
3565 3565 #endif
3566 3566
3567 3567
3568 3568 Subcase: restoring and untouched deleted file, while touching it
3569 3569 ````````````````````````````````````````````````````````````````
3570 3570
3571 3571 Merge:
3572 3572 - one removing a file (d)
3573 3573 - one leaving the file untouched
3574 3574 - the merge actively restore the file to the same content.
3575 3575
3576 3576 In this case, the file keep on living after the merge. So we should not drop its
3577 3577 copy tracing chain.
3578 3578
3579 3579 $ hg log -G --rev '::(desc("mCB-change-m")+desc("mBC-change-m"))'
3580 3580 o mBC-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - the other way
3581 3581 |\
3582 3582 +---o mCB-change-m-0 merge explicitely revive deleted file - B side: unrelated change, C side: delete d (restored by merge) - one way
3583 3583 | |/
3584 3584 | o c-1 delete d
3585 3585 | |
3586 3586 o | b-1: b update
3587 3587 |/
3588 3588 o i-2: c -move-> d, s -move-> t
3589 3589 |
3590 3590 o i-1: a -move-> c, p -move-> s
3591 3591 |
3592 3592 o i-0 initial commit: a b h p q r
3593 3593
3594 3594
3595 3595 'a' is the the copy source of 'd'
3596 3596
3597 3597 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB-change-m-0")'
3598 3598 M b
3599 3599 A d
3600 3600 a (no-compatibility no-changeset !)
3601 3601 A t
3602 3602 p
3603 3603 R a
3604 3604 R p
3605 3605 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC-change-m-0")'
3606 3606 M b
3607 3607 A d
3608 3608 a (no-compatibility no-changeset !)
3609 3609 A t
3610 3610 p
3611 3611 R a
3612 3612 R p
3613 3613 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCB-change-m-0")'
3614 3614 M b
3615 3615 A d
3616 3616 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBC-change-m-0")'
3617 3617 M b
3618 3618 A d
3619 3619 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCB-change-m-0")'
3620 3620 M d
3621 3621 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBC-change-m-0")'
3622 3622 M d
3623 3623
3624 3624
3625 3625 Decision from previous merge are properly chained with later merge
3626 3626 ------------------------------------------------------------------
3627 3627
3628 3628
3629 3629 Subcase: chaining conflicting rename resolution
3630 3630 ```````````````````````````````````````````````
3631 3631
3632 3632 The "mAEm" and "mEAm" case create a rename tracking conflict on file 'f'. We
3633 3633 add more change on the respective branch and merge again. These second merge
3634 3634 does not involve the file 'f' and the arbitration done within "mAEm" and "mEA"
3635 3635 about that file should stay unchanged.
3636 3636
3637 3637 The result from mAEm is the same for the subsequent merge:
3638 3638
3639 3639 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm")' f
3640 3640 A f
3641 3641 a (no-changeset no-compatibility !)
3642 3642
3643 3643 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE,Km")' f
3644 3644 A f
3645 3645 a (no-changeset no-compatibility !)
3646 3646
3647 3647 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mK,AEm")' f
3648 3648 A f
3649 3649 a (no-changeset no-compatibility !)
3650 3650
3651 3651
3652 3652 The result from mEAm is the same for the subsequent merge:
3653 3653
3654 3654 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm")' f
3655 3655 A f
3656 3656 a (filelog !)
3657 3657 b (no-changeset no-compatibility no-filelog !)
3658 3658
3659 3659 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA,Jm")' f
3660 3660 A f
3661 3661 a (filelog !)
3662 3662 b (no-changeset no-compatibility no-filelog !)
3663 3663
3664 3664 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EAm")' f
3665 3665 A f
3666 3666 a (filelog !)
3667 3667 b (no-changeset no-compatibility no-filelog !)
3668 3668
3669 3669 Subcase: chaining conflicting rename resolution
3670 3670 ```````````````````````````````````````````````
3671 3671
3672 3672 The "mPQm" and "mQPm" case create a rename tracking conflict on file 'v'. We
3673 3673 add more change on the respective branch and merge again. These second merge
3674 3674 does not involve the file 'v' and the arbitration done within "mPQm" and "mQP"
3675 3675 about that file should stay unchanged.
3676 3676
3677 3677 The result from mPQm is the same for the subsequent merge:
3678 3678
3679 3679 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQm")' v
3680 3680 A v
3681 3681 r (filelog !)
3682 3682 p (no-changeset no-compatibility no-filelog !)
3683 3683
3684 3684 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQ,Tm")' v
3685 3685 A v
3686 3686 r (filelog !)
3687 3687 p (no-changeset no-compatibility no-filelog !)
3688 3688
3689 3689 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mT,PQm")' v
3690 3690 A v
3691 3691 r (filelog !)
3692 3692 p (no-changeset no-compatibility no-filelog !)
3693 3693
3694 3694 The result from mQPm is the same for the subsequent merge:
3695 3695
3696 3696 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mQPm")' v
3697 3697 A v
3698 3698 r (no-changeset no-compatibility !)
3699 3699
3700 3700 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mQP,Sm")' v
3701 3701 A v
3702 3702 r (no-changeset no-compatibility !)
3703 3703
3704 3704 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mS,QPm")' v
3705 3705 A v
3706 3706 r (filelog !)
3707 3707 r (no-changeset no-compatibility no-filelog !)
3708 3708
3709 3709
3710 3710 Subcase: chaining salvage information during a merge
3711 3711 ````````````````````````````````````````````````````
3712 3712
3713 3713 We add more change on the branch were the file was deleted. merging again
3714 3714 should preserve the fact eh file was salvaged.
3715 3715
3716 3716 reference output:
3717 3717
3718 3718 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB-revert-m-0")'
3719 3719 M b
3720 3720 A d
3721 3721 a (no-changeset no-compatibility !)
3722 3722 A t
3723 3723 p
3724 3724 R a
3725 3725 R p
3726 3726 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC-revert-m-0")'
3727 3727 M b
3728 3728 A d
3729 3729 a (no-changeset no-compatibility !)
3730 3730 A t
3731 3731 p
3732 3732 R a
3733 3733 R p
3734 3734
3735 3735 chained output
3736 3736 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBC+revert,Lm")'
3737 3737 M b
3738 3738 A d
3739 3739 a (no-changeset no-compatibility !)
3740 3740 A t
3741 3741 p
3742 3742 A unrelated-l
3743 3743 R a
3744 3744 R p
3745 3745 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCB+revert,Lm")'
3746 3746 M b
3747 3747 A d
3748 3748 a (no-changeset no-compatibility !)
3749 3749 A t
3750 3750 p
3751 3751 A unrelated-l
3752 3752 R a
3753 3753 R p
3754 3754 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mL,BC+revertm")'
3755 3755 M b
3756 3756 A d
3757 3757 a (no-changeset no-compatibility !)
3758 3758 A t
3759 3759 p
3760 3760 A unrelated-l
3761 3761 R a
3762 3762 R p
3763 3763 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mL,CB+revertm")'
3764 3764 M b
3765 3765 A d
3766 3766 a (no-changeset no-compatibility !)
3767 3767 A t
3768 3768 p
3769 3769 A unrelated-l
3770 3770 R a
3771 3771 R p
3772 3772
3773 3773 Subcase: chaining "merged" information during a merge
3774 3774 ``````````````````````````````````````````````````````
3775 3775
3776 3776 When a non-rename change are merged with a copy overwrite, the merge pick the copy source from (p1) as the reference. We should preserve this information in subsequent merges.
3777 3777
3778 3778
3779 3779 reference output:
3780 3780
3781 3781 (for details about the filelog pick, check the mFGm/mGFm case)
3782 3782
3783 3783 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm")' d
3784 3784 A d
3785 3785 a (filelog !)
3786 3786 h (no-changeset no-compatibility no-filelog !)
3787 3787 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm")' d
3788 3788 A d
3789 3789 a (filelog !)
3790 3790 a (no-changeset no-compatibility no-filelog !)
3791 3791
3792 3792 Chained output
3793 3793
3794 3794 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mO,FGm")' d
3795 3795 A d
3796 3796 a (filelog !)
3797 3797 h (no-changeset no-compatibility no-filelog !)
3798 3798 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFG,Om")' d
3799 3799 A d
3800 3800 a (filelog !)
3801 3801 h (no-changeset no-compatibility no-filelog !)
3802 3802
3803 3803
3804 3804 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGF,Nm")' d
3805 3805 A d
3806 3806 a (no-changeset no-compatibility !)
3807 3807 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mN,GFm")' d
3808 3808 A d
3809 3809 a (no-changeset no-compatibility !)
3810 3810
3811 3811
3812 3812 Subcase: chaining conflicting rename resolution, with extra change during the merge
3813 3813 ```````````````````````````````````````````````````````````````````````````````````
3814 3814
3815 3815 The "mAEm" and "mEAm" case create a rename tracking conflict on file 'f'. We
3816 3816 add more change on the respective branch and merge again. These second merge
3817 3817 does not involve the file 'f' and the arbitration done within "mAEm" and "mEA"
3818 3818 about that file should stay unchanged.
3819 3819
3820 3820 The result from mAEm is the same for the subsequent merge:
3821 3821
3822 3822 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE-change-m")' f
3823 3823 A f
3824 3824 a (no-changeset no-compatibility !)
3825 3825
3826 3826 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE-change,Km")' f
3827 3827 A f
3828 3828 a (no-changeset no-compatibility !)
3829 3829
3830 3830 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mK,AE-change-m")' f
3831 3831 A f
3832 3832 a (no-changeset no-compatibility !)
3833 3833
3834 3834
3835 3835 The result from mEAm is the same for the subsequent merge:
3836 3836
3837 3837 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change-m")' f
3838 3838 A f
3839 3839 a (filelog !)
3840 3840 b (no-changeset no-compatibility no-filelog !)
3841 3841
3842 3842 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change,Jm")' f
3843 3843 A f
3844 3844 a (filelog !)
3845 3845 b (no-changeset no-compatibility no-filelog !)
3846 3846
3847 3847 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EA-change-m")' f
3848 3848 A f
3849 3849 a (filelog !)
3850 3850 b (no-changeset no-compatibility no-filelog !)
@@ -1,141 +1,141 b''
1 1 Make sure that the internal merge tools (internal:fail, internal:local,
2 2 internal:union and internal:other) are used when matched by a
3 3 merge-pattern in hgrc
4 4
5 5 Make sure HGMERGE doesn't interfere with the test:
6 6
7 7 $ unset HGMERGE
8 8
9 9 $ hg init
10 10
11 11 Initial file contents:
12 12
13 13 $ echo "line 1" > f
14 14 $ echo "line 2" >> f
15 15 $ echo "line 3" >> f
16 16 $ hg ci -Am "revision 0"
17 17 adding f
18 18
19 19 $ cat f
20 20 line 1
21 21 line 2
22 22 line 3
23 23
24 24 Branch 1: editing line 1:
25 25
26 26 $ sed 's/line 1/first line/' f > f.new
27 27 $ mv f.new f
28 28 $ hg ci -Am "edited first line"
29 29
30 30 Branch 2: editing line 3:
31 31
32 32 $ hg update 0
33 33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 34 $ sed 's/line 3/third line/' f > f.new
35 35 $ mv f.new f
36 36 $ hg ci -Am "edited third line"
37 37 created new head
38 38
39 39 Merge using internal:fail tool:
40 40
41 41 $ echo "[merge-patterns]" > .hg/hgrc
42 42 $ echo "* = internal:fail" >> .hg/hgrc
43 43
44 44 $ hg merge
45 45 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
46 46 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
47 47 [1]
48 48
49 49 $ cat f
50 50 line 1
51 51 line 2
52 52 third line
53 53
54 54 $ hg stat
55 55 M f
56 56
57 57 Merge using internal:local tool:
58 58
59 59 $ hg update -C 2
60 60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 61 $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
62 62 $ mv .hg/hgrc.new .hg/hgrc
63 63
64 64 $ hg merge
65 65 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
66 66 (branch merge, don't forget to commit)
67 67
68 68 $ cat f
69 69 line 1
70 70 line 2
71 71 third line
72 72
73 73 $ hg stat
74 74 M f
75 75
76 76 Merge using internal:other tool:
77 77
78 78 $ hg update -C 2
79 79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 80 $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
81 81 $ mv .hg/hgrc.new .hg/hgrc
82 82
83 83 $ hg merge
84 84 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 85 (branch merge, don't forget to commit)
86 86
87 87 $ cat f
88 88 first line
89 89 line 2
90 90 line 3
91 91
92 92 $ hg stat
93 93 M f
94 94
95 95 Merge using default tool:
96 96
97 97 $ hg update -C 2
98 98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 99 $ rm .hg/hgrc
100 100
101 101 $ hg merge
102 102 merging f
103 103 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
104 104 (branch merge, don't forget to commit)
105 105
106 106 $ cat f
107 107 first line
108 108 line 2
109 109 third line
110 110
111 111 $ hg stat
112 112 M f
113 113
114 114 Merge using internal:union tool:
115 115
116 116 $ hg update -C 2
117 117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 118
119 119 $ echo "line 4a" >>f
120 120 $ hg ci -Am "Adding fourth line (commit 4)"
121 121 $ hg update 2
122 122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 123
124 124 $ echo "line 4b" >>f
125 125 $ hg ci -Am "Adding fourth line v2 (commit 5)"
126 126 created new head
127 127
128 128 $ echo "[merge-patterns]" > .hg/hgrc
129 129 $ echo "* = internal:union" >> .hg/hgrc
130 130
131 131 $ hg merge 3
132 132 merging f
133 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
134 134 (branch merge, don't forget to commit)
135 135
136 136 $ cat f
137 137 line 1
138 138 line 2
139 139 third line
140 140 line 4b
141 141 line 4a
General Comments 0
You need to be logged in to leave comments. Login now