##// END OF EJS Templates
copies: make calculating lazy for dir move detection's "addedfiles"...
Kyle Lippincott -
r46725:2f357d05 default
parent child Browse files
Show More
@@ -896,18 +896,33 b' def _fullcopytracing(repo, c1, c2, base)'
896 896 )
897 897
898 898 # find interesting file sets from manifests
899 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
900 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
901 u1 = sorted(addedinm1 - addedinm2)
902 u2 = sorted(addedinm2 - addedinm1)
899 cache = []
900
901 def _get_addedfiles(idx):
902 if not cache:
903 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
904 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
905 u1 = sorted(addedinm1 - addedinm2)
906 u2 = sorted(addedinm2 - addedinm1)
907 cache.extend((u1, u2))
908 return cache[idx]
903 909
904 header = b" unmatched files in %s"
905 if u1:
906 repo.ui.debug(b"%s:\n %s\n" % (header % b'local', b"\n ".join(u1)))
907 if u2:
908 repo.ui.debug(b"%s:\n %s\n" % (header % b'other', b"\n ".join(u2)))
910 u1fn = lambda: _get_addedfiles(0)
911 u2fn = lambda: _get_addedfiles(1)
912 if repo.ui.debugflag:
913 u1 = u1fn()
914 u2 = u2fn()
909 915
910 if repo.ui.debugflag:
916 header = b" unmatched files in %s"
917 if u1:
918 repo.ui.debug(
919 b"%s:\n %s\n" % (header % b'local', b"\n ".join(u1))
920 )
921 if u2:
922 repo.ui.debug(
923 b"%s:\n %s\n" % (header % b'other', b"\n ".join(u2))
924 )
925
911 926 renamedeleteset = set()
912 927 divergeset = set()
913 928 for dsts in diverge.values():
@@ -941,8 +956,8 b' def _fullcopytracing(repo, c1, c2, base)'
941 956
942 957 repo.ui.debug(b" checking for directory renames\n")
943 958
944 dirmove1, movewithdir2 = _dir_renames(repo, c1, copy1, copies1, u2)
945 dirmove2, movewithdir1 = _dir_renames(repo, c2, copy2, copies2, u1)
959 dirmove1, movewithdir2 = _dir_renames(repo, c1, copy1, copies1, u2fn)
960 dirmove2, movewithdir1 = _dir_renames(repo, c2, copy2, copies2, u1fn)
946 961
947 962 branch_copies1 = branch_copies(copy1, renamedelete1, dirmove1, movewithdir1)
948 963 branch_copies2 = branch_copies(copy2, renamedelete2, dirmove2, movewithdir2)
@@ -950,14 +965,15 b' def _fullcopytracing(repo, c1, c2, base)'
950 965 return branch_copies1, branch_copies2, diverge
951 966
952 967
953 def _dir_renames(repo, ctx, copy, fullcopy, addedfiles):
968 def _dir_renames(repo, ctx, copy, fullcopy, addedfilesfn):
954 969 """Finds moved directories and files that should move with them.
955 970
956 971 ctx: the context for one of the sides
957 972 copy: files copied on the same side (as ctx)
958 973 fullcopy: files copied on the same side (as ctx), including those that
959 974 merge.manifestmerge() won't care about
960 addedfiles: added files on the other side (compared to ctx)
975 addedfilesfn: function returning added files on the other side (compared to
976 ctx)
961 977 """
962 978 # generate a directory move map
963 979 invalid = set()
@@ -997,7 +1013,7 b' def _dir_renames(repo, ctx, copy, fullco'
997 1013
998 1014 movewithdir = {}
999 1015 # check unaccounted nonoverlapping files against directory moves
1000 for f in addedfiles:
1016 for f in addedfilesfn():
1001 1017 if f not in fullcopy:
1002 1018 for d in dirmove:
1003 1019 if f.startswith(d):
General Comments 0
You need to be logged in to leave comments. Login now