##// END OF EJS Templates
copies: extract function _backwardcopies() for reversing renames...
Martin von Zweigbergk -
r47394:eca88f5f default
parent child Browse files
Show More
@@ -704,22 +704,28 b' def _forwardcopies(a, b, base=None, matc'
704 704
705 705
706 706 def _backwardrenames(a, b, match):
707 """find renames from a to b"""
707 708 if a._repo.ui.config(b'experimental', b'copytrace') == b'off':
708 709 return {}
709 710
711 # We don't want to pass in "match" here, since that would filter
712 # the destination by it. Since we're reversing the copies, we want
713 # to filter the source instead.
714 copies = _forwardcopies(b, a)
715 return _reverse_renames(copies, a, match)
716
717
718 def _reverse_renames(copies, dst, match):
719 """given copies to context 'dst', finds renames from that context"""
710 720 # Even though we're not taking copies into account, 1:n rename situations
711 721 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
712 722 # arbitrarily pick one of the renames.
713 # We don't want to pass in "match" here, since that would filter
714 # the destination by it. Since we're reversing the copies, we want
715 # to filter the source instead.
716 f = _forwardcopies(b, a)
717 723 r = {}
718 for k, v in sorted(pycompat.iteritems(f)):
724 for k, v in sorted(pycompat.iteritems(copies)):
719 725 if match and not match(v):
720 726 continue
721 727 # remove copies
722 if v in a:
728 if v in dst:
723 729 continue
724 730 r[v] = k
725 731 return r
General Comments 0
You need to be logged in to leave comments. Login now