mercurial/copies.py
changeset 46648 eca88f5fbcb2
parent 46634 ad30b29bc23d
child 46649 324ded1aa2ab
equal deleted inserted replaced
46647:86ee73018e62 46648:eca88f5fbcb2
   702         copies = _committedforwardcopies(a, b, base, match)
   702         copies = _committedforwardcopies(a, b, base, match)
   703     return copies
   703     return copies
   704 
   704 
   705 
   705 
   706 def _backwardrenames(a, b, match):
   706 def _backwardrenames(a, b, match):
       
   707     """find renames from a to b"""
   707     if a._repo.ui.config(b'experimental', b'copytrace') == b'off':
   708     if a._repo.ui.config(b'experimental', b'copytrace') == b'off':
   708         return {}
   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     # Even though we're not taking copies into account, 1:n rename situations
   720     # Even though we're not taking copies into account, 1:n rename situations
   711     # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
   721     # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
   712     # arbitrarily pick one of the renames.
   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     r = {}
   723     r = {}
   718     for k, v in sorted(pycompat.iteritems(f)):
   724     for k, v in sorted(pycompat.iteritems(copies)):
   719         if match and not match(v):
   725         if match and not match(v):
   720             continue
   726             continue
   721         # remove copies
   727         # remove copies
   722         if v in a:
   728         if v in dst:
   723             continue
   729             continue
   724         r[v] = k
   730         r[v] = k
   725     return r
   731     return r
   726 
   732 
   727 
   733