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