412 u1u, u2u = _computenonoverlap(repo, c1, c2, m1.filesnotin(mta), |
412 u1u, u2u = _computenonoverlap(repo, c1, c2, m1.filesnotin(mta), |
413 m2.filesnotin(mta), |
413 m2.filesnotin(mta), |
414 baselabel='topological common ancestor') |
414 baselabel='topological common ancestor') |
415 |
415 |
416 for f in u1u: |
416 for f in u1u: |
417 _checkcopies(c1, c2, f, m1, m2, base, tca, dirtyc1, limit, data1) |
417 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1) |
418 |
418 |
419 for f in u2u: |
419 for f in u2u: |
420 _checkcopies(c2, c1, f, m2, m1, base, tca, dirtyc2, limit, data2) |
420 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2) |
421 |
421 |
422 copy = dict(data1['copy'].items() + data2['copy'].items()) |
422 copy = dict(data1['copy'].items() + data2['copy'].items()) |
423 fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items()) |
423 fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items()) |
424 |
424 |
425 if dirtyc1: |
425 if dirtyc1: |
460 'incomplete': {}, |
460 'incomplete': {}, |
461 'diverge': bothdiverge, |
461 'diverge': bothdiverge, |
462 'incompletediverge': bothincompletediverge |
462 'incompletediverge': bothincompletediverge |
463 } |
463 } |
464 for f in bothnew: |
464 for f in bothnew: |
465 _checkcopies(c1, c2, f, m1, m2, base, tca, dirtyc1, limit, both1) |
465 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1) |
466 _checkcopies(c2, c1, f, m2, m1, base, tca, dirtyc2, limit, both2) |
466 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2) |
467 if dirtyc1: |
467 if dirtyc1: |
468 # incomplete copies may only be found on the "dirty" side for bothnew |
468 # incomplete copies may only be found on the "dirty" side for bothnew |
469 assert not both2['incomplete'] |
469 assert not both2['incomplete'] |
470 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge, |
470 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge, |
471 bothincompletediverge) |
471 bothincompletediverge) |
596 elif f1r == f2r or f1r < limit or f2r < limit: |
596 elif f1r == f2r or f1r < limit or f2r < limit: |
597 return False # copy no longer relevant |
597 return False # copy no longer relevant |
598 except StopIteration: |
598 except StopIteration: |
599 return False |
599 return False |
600 |
600 |
601 def _checkcopies(srcctx, dstctx, f, msrc, mdst, base, tca, remotebase, |
601 def _checkcopies(srcctx, dstctx, f, base, tca, remotebase, limit, data): |
602 limit, data): |
|
603 """ |
602 """ |
604 check possible copies of f from msrc to mdst |
603 check possible copies of f from msrc to mdst |
605 |
604 |
606 srcctx = starting context for f in msrc |
605 srcctx = starting context for f in msrc |
607 dstctx = destination context for f in mdst |
606 dstctx = destination context for f in mdst |
608 f = the filename to check (as in msrc) |
607 f = the filename to check (as in msrc) |
609 msrc = the source manifest |
|
610 mdst = the destination manifest |
|
611 base = the changectx used as a merge base |
608 base = the changectx used as a merge base |
612 tca = topological common ancestor for graft-like scenarios |
609 tca = topological common ancestor for graft-like scenarios |
613 remotebase = True if base is outside tca::srcctx, False otherwise |
610 remotebase = True if base is outside tca::srcctx, False otherwise |
614 limit = the rev number to not search beyond |
611 limit = the rev number to not search beyond |
615 data = dictionary of dictionary to store copy data. (see mergecopies) |
612 data = dictionary of dictionary to store copy data. (see mergecopies) |
618 irrelevant revisions will not be limited |
615 irrelevant revisions will not be limited |
619 there is no easy way to make this algorithm stop in a guaranteed way |
616 there is no easy way to make this algorithm stop in a guaranteed way |
620 once it "goes behind a certain revision". |
617 once it "goes behind a certain revision". |
621 """ |
618 """ |
622 |
619 |
|
620 msrc = srcctx.manifest() |
|
621 mdst = dstctx.manifest() |
623 mb = base.manifest() |
622 mb = base.manifest() |
624 mta = tca.manifest() |
623 mta = tca.manifest() |
625 # Might be true if this call is about finding backward renames, |
624 # Might be true if this call is about finding backward renames, |
626 # This happens in the case of grafts because the DAG is then rotated. |
625 # This happens in the case of grafts because the DAG is then rotated. |
627 # If the file exists in both the base and the source, we are not looking |
626 # If the file exists in both the base and the source, we are not looking |