351 if debug: |
351 if debug: |
352 repo.ui.debug('debug.copies: search mode: combined\n') |
352 repo.ui.debug('debug.copies: search mode: combined\n') |
353 return _chain(x, y, _backwardrenames(x, a, match=match), |
353 return _chain(x, y, _backwardrenames(x, a, match=match), |
354 _forwardcopies(a, y, match=match)) |
354 _forwardcopies(a, y, match=match)) |
355 |
355 |
356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''): |
356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, debug=True): |
357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1 |
357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1 |
358 and c2. This is its own function so extensions can easily wrap this call |
358 and c2. This is its own function so extensions can easily wrap this call |
359 to see what files mergecopies is about to process. |
359 to see what files mergecopies is about to process. |
360 |
360 |
361 Even though c1 and c2 are not used in this function, they are useful in |
361 Even though c1 and c2 are not used in this function, they are useful in |
362 other extensions for being able to read the file nodes of the changed files. |
362 other extensions for being able to read the file nodes of the changed files. |
363 |
|
364 "baselabel" can be passed to help distinguish the multiple computations |
|
365 done in the graft case. |
|
366 """ |
363 """ |
367 u1 = sorted(addedinm1 - addedinm2) |
364 u1 = sorted(addedinm1 - addedinm2) |
368 u2 = sorted(addedinm2 - addedinm1) |
365 u2 = sorted(addedinm2 - addedinm1) |
369 |
366 |
370 header = " unmatched files in %s" |
367 if debug: |
371 if baselabel: |
368 header = " unmatched files in %s" |
372 header += ' (from %s)' % baselabel |
369 if u1: |
373 if u1: |
370 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1))) |
374 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1))) |
371 if u2: |
375 if u2: |
372 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2))) |
376 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2))) |
|
377 |
373 |
378 return u1, u2 |
374 return u1, u2 |
379 |
375 |
380 def _makegetfctx(ctx): |
376 def _makegetfctx(ctx): |
381 """return a 'getfctx' function suitable for _checkcopies usage |
377 """return a 'getfctx' function suitable for _checkcopies usage |
586 # unmatched file from base |
582 # unmatched file from base |
587 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) |
583 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) |
588 u1u, u2u = u1r, u2r |
584 u1u, u2u = u1r, u2r |
589 else: |
585 else: |
590 # unmatched file from base (DAG rotation in the graft case) |
586 # unmatched file from base (DAG rotation in the graft case) |
591 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, |
587 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2) |
592 baselabel='base') |
|
593 # unmatched file from topological common ancestors (no DAG rotation) |
588 # unmatched file from topological common ancestors (no DAG rotation) |
594 # need to recompute this for directory move handling when grafting |
589 # need to recompute this for directory move handling when grafting |
595 mta = tca.manifest() |
590 mta = tca.manifest() |
596 u1u, u2u = _computenonoverlap(repo, c1, c2, |
591 u1u, u2u = _computenonoverlap(repo, c1, c2, |
597 m1.filesnotin(mta, repo.narrowmatch()), |
592 m1.filesnotin(mta, repo.narrowmatch()), |
598 m2.filesnotin(mta, repo.narrowmatch()), |
593 m2.filesnotin(mta, repo.narrowmatch()), |
599 baselabel='topological common ancestor') |
594 debug=False) |
600 |
595 |
601 for f in u1u: |
596 for f in u1u: |
602 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1) |
597 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1) |
603 |
598 |
604 for f in u2u: |
599 for f in u2u: |