324 match = a.repo().narrowmatch(match) |
324 match = a.repo().narrowmatch(match) |
325 # check for working copy |
325 # check for working copy |
326 if b.rev() is None: |
326 if b.rev() is None: |
327 cm = _committedforwardcopies(a, b.p1(), match) |
327 cm = _committedforwardcopies(a, b.p1(), match) |
328 # combine copies from dirstate if necessary |
328 # combine copies from dirstate if necessary |
329 return _chainandfilter(a, b, cm, _dirstatecopies(b._repo, match)) |
329 copies = _chainandfilter(a, b, cm, _dirstatecopies(b._repo, match)) |
330 return _committedforwardcopies(a, b, match) |
330 else: |
|
331 copies = _committedforwardcopies(a, b, match) |
|
332 return copies |
331 |
333 |
332 def _backwardrenames(a, b, match): |
334 def _backwardrenames(a, b, match): |
333 if a._repo.ui.config('experimental', 'copytrace') == 'off': |
335 if a._repo.ui.config('experimental', 'copytrace') == 'off': |
334 return {} |
336 return {} |
335 |
337 |
364 if debug: |
366 if debug: |
365 repo.ui.debug('debug.copies: search mode: forward\n') |
367 repo.ui.debug('debug.copies: search mode: forward\n') |
366 if y.rev() is None and x == y.p1(): |
368 if y.rev() is None and x == y.p1(): |
367 # short-circuit to avoid issues with merge states |
369 # short-circuit to avoid issues with merge states |
368 return _dirstatecopies(repo, match) |
370 return _dirstatecopies(repo, match) |
369 return _forwardcopies(x, y, match=match) |
371 copies = _forwardcopies(x, y, match=match) |
370 if a == y: |
372 elif a == y: |
371 if debug: |
373 if debug: |
372 repo.ui.debug('debug.copies: search mode: backward\n') |
374 repo.ui.debug('debug.copies: search mode: backward\n') |
373 return _backwardrenames(x, y, match=match) |
375 copies = _backwardrenames(x, y, match=match) |
374 if debug: |
376 else: |
375 repo.ui.debug('debug.copies: search mode: combined\n') |
377 if debug: |
376 return _chainandfilter(x, y, _backwardrenames(x, a, match=match), |
378 repo.ui.debug('debug.copies: search mode: combined\n') |
377 _forwardcopies(a, y, match=match)) |
379 copies = _chainandfilter(x, y, _backwardrenames(x, a, match=match), |
|
380 _forwardcopies(a, y, match=match)) |
|
381 return copies |
378 |
382 |
379 def mergecopies(repo, c1, c2, base): |
383 def mergecopies(repo, c1, c2, base): |
380 """ |
384 """ |
381 Finds moves and copies between context c1 and c2 that are relevant for |
385 Finds moves and copies between context c1 and c2 that are relevant for |
382 merging. 'base' will be used as the merge base. |
386 merging. 'base' will be used as the merge base. |