comparison mercurial/copies.py @ 30201:856ead835f56

checkcopies: handle divergences contained entirely in tca::ctx During a graftlike merge, _checkcopies runs from ctx to tca, possibly passing over the merge base. If there is a rename both before and after the base, then we're actually dealing with divergent renames. If there is no rename on the other side of tca, then the divergence is contained entirely in the range of one _checkcopies invocation, and should be detected "in the loop" without having to rely on the other _checkcopies pass.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Wed, 12 Oct 2016 11:54:03 +0200
parents 0accd5a5ad04
children a005c33d0bd7
comparison
equal deleted inserted replaced
30200:a2804ddcf9ae 30201:856ead835f56
562 # If the file exists in both the base and the source, we are not looking 562 # If the file exists in both the base and the source, we are not looking
563 # for a rename on the source side, but on the part of the DAG that is 563 # for a rename on the source side, but on the part of the DAG that is
564 # traversed backwards. 564 # traversed backwards.
565 # 565 #
566 # In the case there is both backward and forward renames (before and after 566 # In the case there is both backward and forward renames (before and after
567 # the base) this is more complicated as we must detect a divergence. This 567 # the base) this is more complicated as we must detect a divergence.
568 # is currently broken and hopefully some later code update will make that 568 # We use 'backwards = False' in that case.
569 # work (we use 'backwards = False' in that case)
570 backwards = base != tca and f in mb 569 backwards = base != tca and f in mb
571 getfctx = _makegetfctx(ctx) 570 getfctx = _makegetfctx(ctx)
572 571
573 of = None 572 of = None
574 seen = set([f]) 573 seen = set([f])
598 if cr and (of == f or of == c2.path()): # non-divergent 597 if cr and (of == f or of == c2.path()): # non-divergent
599 if backwards: 598 if backwards:
600 data['copy'][of] = f 599 data['copy'][of] = f
601 elif of in mb: 600 elif of in mb:
602 data['copy'][f] = of 601 data['copy'][f] = of
602 else: # divergence w.r.t. graft CA on one side of topological CA
603 for sf in seen:
604 if sf in mb:
605 assert sf not in data['diverge']
606 data['diverge'][sf] = [f, of]
607 break
603 return 608 return
604 609
605 if of in mb: 610 if of in mb:
606 data['diverge'].setdefault(of, []).append(f) 611 data['diverge'].setdefault(of, []).append(f)
607 612