##// END OF EJS Templates
copies: clean up _related logic...
Gábor Stefanik -
r37410:a4f02a17 default
parent child Browse files
Show More
@@ -698,9 +698,6 b' def _heuristicscopytracing(repo, c1, c2,'
698 698 basenametofilename[basename].append(f)
699 699 dirnametofilename[dirname].append(f)
700 700
701 # in case of a rebase/graft, base may not be a common ancestor
702 anc = c1.ancestor(c2)
703
704 701 for f in missingfiles:
705 702 basename = os.path.basename(f)
706 703 dirname = os.path.dirname(f)
@@ -723,7 +720,7 b' def _heuristicscopytracing(repo, c1, c2,'
723 720
724 721 for candidate in movecandidates:
725 722 f1 = c1.filectx(candidate)
726 if _related(f1, f2, anc.rev()):
723 if _related(f1, f2):
727 724 # if there are a few related copies then we'll merge
728 725 # changes into all of them. This matches the behaviour
729 726 # of upstream copytracing
@@ -731,7 +728,7 b' def _heuristicscopytracing(repo, c1, c2,'
731 728
732 729 return copies, {}, {}, {}, {}
733 730
734 def _related(f1, f2, limit):
731 def _related(f1, f2):
735 732 """return True if f1 and f2 filectx have a common ancestor
736 733
737 734 Walk back to common ancestor to see if the two files originate
@@ -758,10 +755,8 b' def _related(f1, f2, limit):'
758 755 f1 = next(g1)
759 756 elif f2r > f1r:
760 757 f2 = next(g2)
761 elif f1 == f2:
762 return f1 # a match
763 elif f1r == f2r or f1r < limit or f2r < limit:
764 return False # copy no longer relevant
758 else: # f1 and f2 point to files in the same linkrev
759 return f1 == f2 # true if they point to the same file
765 760 except StopIteration:
766 761 return False
767 762
@@ -829,7 +824,7 b' def _checkcopies(srcctx, dstctx, f, base'
829 824 c2 = getdstfctx(of, mdst[of])
830 825 # c2 might be a plain new file on added on destination side that is
831 826 # unrelated to the droids we are looking for.
832 cr = _related(oc, c2, tca.rev())
827 cr = _related(oc, c2)
833 828 if cr and (of == f or of == c2.path()): # non-divergent
834 829 if backwards:
835 830 data['copy'][of] = f
General Comments 0
You need to be logged in to leave comments. Login now