##// 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 # find interesting file sets from manifests
898 # find interesting file sets from manifests
899 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
899 cache = []
900 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
900
901 u1 = sorted(addedinm1 - addedinm2)
901 def _get_addedfiles(idx):
902 u2 = sorted(addedinm2 - addedinm1)
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"
910 u1fn = lambda: _get_addedfiles(0)
905 if u1:
911 u2fn = lambda: _get_addedfiles(1)
906 repo.ui.debug(b"%s:\n %s\n" % (header % b'local', b"\n ".join(u1)))
912 if repo.ui.debugflag:
907 if u2:
913 u1 = u1fn()
908 repo.ui.debug(b"%s:\n %s\n" % (header % b'other', b"\n ".join(u2)))
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 renamedeleteset = set()
926 renamedeleteset = set()
912 divergeset = set()
927 divergeset = set()
913 for dsts in diverge.values():
928 for dsts in diverge.values():
@@ -941,8 +956,8 b' def _fullcopytracing(repo, c1, c2, base)'
941
956
942 repo.ui.debug(b" checking for directory renames\n")
957 repo.ui.debug(b" checking for directory renames\n")
943
958
944 dirmove1, movewithdir2 = _dir_renames(repo, c1, copy1, copies1, u2)
959 dirmove1, movewithdir2 = _dir_renames(repo, c1, copy1, copies1, u2fn)
945 dirmove2, movewithdir1 = _dir_renames(repo, c2, copy2, copies2, u1)
960 dirmove2, movewithdir1 = _dir_renames(repo, c2, copy2, copies2, u1fn)
946
961
947 branch_copies1 = branch_copies(copy1, renamedelete1, dirmove1, movewithdir1)
962 branch_copies1 = branch_copies(copy1, renamedelete1, dirmove1, movewithdir1)
948 branch_copies2 = branch_copies(copy2, renamedelete2, dirmove2, movewithdir2)
963 branch_copies2 = branch_copies(copy2, renamedelete2, dirmove2, movewithdir2)
@@ -950,14 +965,15 b' def _fullcopytracing(repo, c1, c2, base)'
950 return branch_copies1, branch_copies2, diverge
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 """Finds moved directories and files that should move with them.
969 """Finds moved directories and files that should move with them.
955
970
956 ctx: the context for one of the sides
971 ctx: the context for one of the sides
957 copy: files copied on the same side (as ctx)
972 copy: files copied on the same side (as ctx)
958 fullcopy: files copied on the same side (as ctx), including those that
973 fullcopy: files copied on the same side (as ctx), including those that
959 merge.manifestmerge() won't care about
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 # generate a directory move map
978 # generate a directory move map
963 invalid = set()
979 invalid = set()
@@ -997,7 +1013,7 b' def _dir_renames(repo, ctx, copy, fullco'
997
1013
998 movewithdir = {}
1014 movewithdir = {}
999 # check unaccounted nonoverlapping files against directory moves
1015 # check unaccounted nonoverlapping files against directory moves
1000 for f in addedfiles:
1016 for f in addedfilesfn():
1001 if f not in fullcopy:
1017 if f not in fullcopy:
1002 for d in dirmove:
1018 for d in dirmove:
1003 if f.startswith(d):
1019 if f.startswith(d):
General Comments 0
You need to be logged in to leave comments. Login now