##// END OF EJS Templates
copies: skip directory rename checks when not merging...
Matt Mackall -
r6425:2d9328a2 default
parent child Browse files
Show More
@@ -53,7 +53,7 b' def _findoldnames(fctx, limit):'
53 53 old.sort()
54 54 return [o[1] for o in old]
55 55
56 def copies(repo, c1, c2, ca):
56 def copies(repo, c1, c2, ca, checkdirs=False):
57 57 """
58 58 Find moves and copies between context c1 and c2
59 59 """
@@ -104,9 +104,6 b' def copies(repo, c1, c2, ca):'
104 104 elif of in ma:
105 105 diverge.setdefault(of, []).append(f)
106 106
107 if not repo.ui.configbool("merge", "followcopies", True):
108 return {}, {}
109
110 107 repo.ui.debug(_(" searching for copies back to rev %d\n") % limit)
111 108
112 109 u1 = _nonoverlap(m1, m2, ma)
@@ -140,7 +137,7 b' def copies(repo, c1, c2, ca):'
140 137 repo.ui.debug(_(" %s -> %s %s\n") % (f, fullcopy[f], note))
141 138 del diverge2
142 139
143 if not fullcopy or not repo.ui.configbool("merge", "followdirs", True):
140 if not fullcopy or not checkdirs:
144 141 return copy, diverge
145 142
146 143 repo.ui.debug(_(" checking for directory renames\n"))
@@ -187,7 +184,8 b' def copies(repo, c1, c2, ca):'
187 184 for d in dirmove:
188 185 if f.startswith(d):
189 186 # new file added in a directory that was moved, move it
190 copy[f] = dirmove[d] + f[len(d):]
187 df = dirmove[d] + f[len(d):]
188 copy[f] = df
191 189 repo.ui.debug(_(" file %s -> %s\n") % (f, copy[f]))
192 190 break
193 191
@@ -101,7 +101,9 b' def manifestmerge(repo, p1, p2, pa, over'
101 101 action.append((f, m) + args)
102 102
103 103 if pa and not (backwards or overwrite):
104 copy, diverge = copies.copies(repo, p1, p2, pa)
104 if repo.ui.configbool("merge", "followcopies", True):
105 dirs = repo.ui.configbool("merge", "followdirs", True)
106 copy, diverge = copies.copies(repo, p1, p2, pa, dirs)
105 107 copied = dict.fromkeys(copy.values())
106 108 for of, fl in diverge.items():
107 109 act("divergent renames", "dr", of, fl)
@@ -11,12 +11,17 b' cd t'
11 11 # set up a boring main branch
12 12 add a a
13 13 hg add a
14 mkdir x
15 add x/x x
16 hg add x/x
14 17 hg ci -m0
15 18
16 19 add a m1
17 20 hg ci -m1
18 21
19 22 add a m2
23 add x/y y1
24 hg add x/y
20 25 hg ci -m2
21 26
22 27 show()
@@ -59,6 +64,7 b' tb()'
59 64 echo
60 65 }
61 66
67
62 68 tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
63 69 tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
64 70 tb "hg mv a b" "add b b1" "add b w" "single rename"
@@ -66,3 +72,5 b' tb "hg cp a b" "add b b1" "add a w" "sin'
66 72 tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
67 73 tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
68 74 tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"
75
76 tb "hg mv x y" "add y/x x1" "add y/x x2" "directory move"
@@ -30,6 +30,7 b' rename to b'
30 30 A b
31 31 a
32 32 R a
33 R x/y
33 34
34 35 diff --git a/a b/b
35 36 rename from a
@@ -43,6 +44,12 b' rename to b'
43 44 +0
44 45 +a1
45 46 +a2
47 diff --git a/x/y b/x/y
48 deleted file mode 100644
49 --- a/x/y
50 +++ /dev/null
51 @@ -1,1 +0,0 @@
52 -y1
46 53
47 54 - root to parent: --rev 0 --rev .
48 55 M a
@@ -70,6 +77,7 b' diff --git a/a b/a'
70 77
71 78 - branch to parent: --rev 2 --rev .
72 79 M a
80 R x/y
73 81
74 82 diff --git a/a b/a
75 83 --- a/a
@@ -81,9 +89,16 b' diff --git a/a b/a'
81 89 +0
82 90 +a1
83 91 +a2
92 diff --git a/x/y b/x/y
93 deleted file mode 100644
94 --- a/x/y
95 +++ /dev/null
96 @@ -1,1 +0,0 @@
97 -y1
84 98
85 99 - parent to branch: --rev . --rev 2
86 100 M a
101 A x/y
87 102
88 103 diff --git a/a b/a
89 104 --- a/a
@@ -95,6 +110,12 b' diff --git a/a b/a'
95 110 -a2
96 111 +m1
97 112 +m2
113 diff --git a/x/y b/x/y
114 new file mode 100644
115 --- /dev/null
116 +++ b/x/y
117 @@ -0,0 +1,1 @@
118 +y1
98 119
99 120
100 121 created new head
@@ -136,6 +157,7 b' copy to b'
136 157 M a
137 158 A b
138 159 a
160 R x/y
139 161
140 162 diff --git a/a b/a
141 163 --- a/a
@@ -159,6 +181,12 b' copy to b'
159 181 +1
160 182 +a1
161 183 +a2
184 diff --git a/x/y b/x/y
185 deleted file mode 100644
186 --- a/x/y
187 +++ /dev/null
188 @@ -1,1 +0,0 @@
189 -y1
162 190
163 191 - root to parent: --rev 0 --rev .
164 192 M a
@@ -186,6 +214,7 b' diff --git a/a b/a'
186 214
187 215 - branch to parent: --rev 2 --rev .
188 216 M a
217 R x/y
189 218
190 219 diff --git a/a b/a
191 220 --- a/a
@@ -197,9 +226,16 b' diff --git a/a b/a'
197 226 +1
198 227 +a1
199 228 +a2
229 diff --git a/x/y b/x/y
230 deleted file mode 100644
231 --- a/x/y
232 +++ /dev/null
233 @@ -1,1 +0,0 @@
234 -y1
200 235
201 236 - parent to branch: --rev . --rev 2
202 237 M a
238 A x/y
203 239
204 240 diff --git a/a b/a
205 241 --- a/a
@@ -211,6 +247,12 b' diff --git a/a b/a'
211 247 -a2
212 248 +m1
213 249 +m2
250 diff --git a/x/y b/x/y
251 new file mode 100644
252 --- /dev/null
253 +++ b/x/y
254 @@ -0,0 +1,1 @@
255 +y1
214 256
215 257
216 258 created new head
@@ -248,6 +290,7 b' rename to b'
248 290 A b
249 291 a
250 292 R a
293 R x/y
251 294
252 295 diff --git a/a b/b
253 296 rename from a
@@ -261,6 +304,12 b' rename to b'
261 304 +2
262 305 +b1
263 306 +w
307 diff --git a/x/y b/x/y
308 deleted file mode 100644
309 --- a/x/y
310 +++ /dev/null
311 @@ -1,1 +0,0 @@
312 -y1
264 313
265 314 - root to parent: --rev 0 --rev .
266 315 A b
@@ -296,6 +345,7 b' rename to a'
296 345 A b
297 346 a
298 347 R a
348 R x/y
299 349
300 350 diff --git a/a b/b
301 351 rename from a
@@ -308,10 +358,17 b' rename to b'
308 358 -m2
309 359 +2
310 360 +b1
361 diff --git a/x/y b/x/y
362 deleted file mode 100644
363 --- a/x/y
364 +++ /dev/null
365 @@ -1,1 +0,0 @@
366 -y1
311 367
312 368 - parent to branch: --rev . --rev 2
313 369 A a
314 370 b
371 A x/y
315 372 R b
316 373
317 374 diff --git a/b b/a
@@ -325,6 +382,12 b' rename to a'
325 382 -b1
326 383 +m1
327 384 +m2
385 diff --git a/x/y b/x/y
386 new file mode 100644
387 --- /dev/null
388 +++ b/x/y
389 @@ -0,0 +1,1 @@
390 +y1
328 391
329 392
330 393 created new head
@@ -367,6 +430,7 b' copy to b'
367 430 M a
368 431 A b
369 432 a
433 R x/y
370 434
371 435 diff --git a/a b/a
372 436 --- a/a
@@ -388,6 +452,12 b' copy to b'
388 452 -m2
389 453 +3
390 454 +b1
455 diff --git a/x/y b/x/y
456 deleted file mode 100644
457 --- a/x/y
458 +++ /dev/null
459 @@ -1,1 +0,0 @@
460 -y1
391 461
392 462 - root to parent: --rev 0 --rev .
393 463 M a
@@ -433,6 +503,7 b' deleted file mode 100644'
433 503 M a
434 504 A b
435 505 a
506 R x/y
436 507
437 508 diff --git a/a b/a
438 509 --- a/a
@@ -453,9 +524,16 b' copy to b'
453 524 -m2
454 525 +3
455 526 +b1
527 diff --git a/x/y b/x/y
528 deleted file mode 100644
529 --- a/x/y
530 +++ /dev/null
531 @@ -1,1 +0,0 @@
532 -y1
456 533
457 534 - parent to branch: --rev . --rev 2
458 535 M a
536 A x/y
459 537 R b
460 538
461 539 diff --git a/a b/a
@@ -474,6 +552,12 b' deleted file mode 100644'
474 552 -a
475 553 -3
476 554 -b1
555 diff --git a/x/y b/x/y
556 new file mode 100644
557 --- /dev/null
558 +++ b/x/y
559 @@ -0,0 +1,1 @@
560 +y1
477 561
478 562
479 563 created new head
@@ -506,6 +590,7 b' rename to d'
506 590 A d
507 591 a
508 592 R a
593 R x/y
509 594
510 595 diff --git a/a b/d
511 596 rename from a
@@ -517,6 +602,12 b' rename to d'
517 602 -m1
518 603 -m2
519 604 +4
605 diff --git a/x/y b/x/y
606 deleted file mode 100644
607 --- a/x/y
608 +++ /dev/null
609 @@ -1,1 +0,0 @@
610 -y1
520 611
521 612 - root to parent: --rev 0 --rev .
522 613 A c
@@ -550,6 +641,7 b' rename to a'
550 641 A c
551 642 a
552 643 R a
644 R x/y
553 645
554 646 diff --git a/a b/c
555 647 rename from a
@@ -561,10 +653,17 b' rename to c'
561 653 -m1
562 654 -m2
563 655 +4
656 diff --git a/x/y b/x/y
657 deleted file mode 100644
658 --- a/x/y
659 +++ /dev/null
660 @@ -1,1 +0,0 @@
661 -y1
564 662
565 663 - parent to branch: --rev . --rev 2
566 664 A a
567 665 c
666 A x/y
568 667 R c
569 668
570 669 diff --git a/c b/a
@@ -577,6 +676,12 b' rename to a'
577 676 -4
578 677 +m1
579 678 +m2
679 diff --git a/x/y b/x/y
680 new file mode 100644
681 --- /dev/null
682 +++ b/x/y
683 @@ -0,0 +1,1 @@
684 +y1
580 685
581 686
582 687 created new head
@@ -638,6 +743,7 b' A c'
638 743 a
639 744 A d
640 745 a
746 R x/y
641 747
642 748 diff --git a/a b/a
643 749 --- a/a
@@ -677,6 +783,12 b' copy to d'
677 783 -m1
678 784 -m2
679 785 +5
786 diff --git a/x/y b/x/y
787 deleted file mode 100644
788 --- a/x/y
789 +++ /dev/null
790 @@ -1,1 +0,0 @@
791 -y1
680 792
681 793 - root to parent: --rev 0 --rev .
682 794 M a
@@ -740,6 +852,7 b' A b'
740 852 a
741 853 A c
742 854 a
855 R x/y
743 856
744 857 diff --git a/a b/a
745 858 --- a/a
@@ -769,9 +882,16 b' copy to c'
769 882 -m1
770 883 -m2
771 884 +5
885 diff --git a/x/y b/x/y
886 deleted file mode 100644
887 --- a/x/y
888 +++ /dev/null
889 @@ -1,1 +0,0 @@
890 -y1
772 891
773 892 - parent to branch: --rev . --rev 2
774 893 M a
894 A x/y
775 895 R b
776 896 R c
777 897
@@ -797,6 +917,12 b' deleted file mode 100644'
797 917 @@ -1,2 +0,0 @@
798 918 -a
799 919 -5
920 diff --git a/x/y b/x/y
921 new file mode 100644
922 --- /dev/null
923 +++ b/x/y
924 @@ -0,0 +1,1 @@
925 +y1
800 926
801 927
802 928 created new head
@@ -824,6 +950,7 b' diff --git a/a b/a'
824 950
825 951 - working to branch: --rev 2
826 952 M a
953 R x/y
827 954
828 955 diff --git a/a b/a
829 956 --- a/a
@@ -834,6 +961,12 b' diff --git a/a b/a'
834 961 -m2
835 962 +6
836 963 +a1
964 diff --git a/x/y b/x/y
965 deleted file mode 100644
966 --- a/x/y
967 +++ /dev/null
968 @@ -1,1 +0,0 @@
969 -y1
837 970
838 971 - root to parent: --rev 0 --rev .
839 972 A b
@@ -869,6 +1002,7 b' rename to a'
869 1002 A b
870 1003 a
871 1004 R a
1005 R x/y
872 1006
873 1007 diff --git a/a b/b
874 1008 rename from a
@@ -881,10 +1015,17 b' rename to b'
881 1015 -m2
882 1016 +6
883 1017 +a1
1018 diff --git a/x/y b/x/y
1019 deleted file mode 100644
1020 --- a/x/y
1021 +++ /dev/null
1022 @@ -1,1 +0,0 @@
1023 -y1
884 1024
885 1025 - parent to branch: --rev . --rev 2
886 1026 A a
887 1027 b
1028 A x/y
888 1029 R b
889 1030
890 1031 diff --git a/b b/a
@@ -898,5 +1039,182 b' rename to a'
898 1039 -a1
899 1040 +m1
900 1041 +m2
1042 diff --git a/x/y b/x/y
1043 new file mode 100644
1044 --- /dev/null
1045 +++ b/x/y
1046 @@ -0,0 +1,1 @@
1047 +y1
901 1048
902 1049
1050 created new head
1051 moving x/x to y/x
1052 ** directory move **
1053 ** hg mv x y / add y/x x1 / add y/x x2
1054 - working to parent:
1055 M y/x
1056
1057 diff --git a/y/x b/y/x
1058 --- a/y/x
1059 +++ b/y/x
1060 @@ -1,2 +1,3 @@
1061 x
1062 x1
1063 +x2
1064
1065 - working to root: --rev 0
1066 M a
1067 A y/x
1068 x/x
1069 R x/x
1070
1071 diff --git a/a b/a
1072 --- a/a
1073 +++ b/a
1074 @@ -1,1 +1,2 @@
1075 a
1076 +7
1077 diff --git a/x/x b/y/x
1078 rename from x/x
1079 rename to y/x
1080 --- a/x/x
1081 +++ b/y/x
1082 @@ -1,1 +1,3 @@
1083 x
1084 +x1
1085 +x2
1086
1087 - working to branch: --rev 2
1088 M a
1089 A y/x
1090 x/x
1091 R x/x
1092 R x/y
1093
1094 diff --git a/a b/a
1095 --- a/a
1096 +++ b/a
1097 @@ -1,3 +1,2 @@
1098 a
1099 -m1
1100 -m2
1101 +7
1102 diff --git a/x/y b/x/y
1103 deleted file mode 100644
1104 --- a/x/y
1105 +++ /dev/null
1106 @@ -1,1 +0,0 @@
1107 -y1
1108 diff --git a/x/x b/y/x
1109 rename from x/x
1110 rename to y/x
1111 --- a/x/x
1112 +++ b/y/x
1113 @@ -1,1 +1,3 @@
1114 x
1115 +x1
1116 +x2
1117
1118 - root to parent: --rev 0 --rev .
1119 M a
1120 A y/x
1121 x/x
1122 R x/x
1123
1124 diff --git a/a b/a
1125 --- a/a
1126 +++ b/a
1127 @@ -1,1 +1,2 @@
1128 a
1129 +7
1130 diff --git a/x/x b/y/x
1131 rename from x/x
1132 rename to y/x
1133 --- a/x/x
1134 +++ b/y/x
1135 @@ -1,1 +1,2 @@
1136 x
1137 +x1
1138
1139 - parent to root: --rev . --rev 0
1140 M a
1141 A x/x
1142 y/x
1143 R y/x
1144
1145 diff --git a/a b/a
1146 --- a/a
1147 +++ b/a
1148 @@ -1,2 +1,1 @@
1149 a
1150 -7
1151 diff --git a/y/x b/x/x
1152 rename from y/x
1153 rename to x/x
1154 --- a/y/x
1155 +++ b/x/x
1156 @@ -1,2 +1,1 @@
1157 x
1158 -x1
1159
1160 - branch to parent: --rev 2 --rev .
1161 M a
1162 A y/x
1163 x/x
1164 R x/x
1165 R x/y
1166
1167 diff --git a/a b/a
1168 --- a/a
1169 +++ b/a
1170 @@ -1,3 +1,2 @@
1171 a
1172 -m1
1173 -m2
1174 +7
1175 diff --git a/x/y b/x/y
1176 deleted file mode 100644
1177 --- a/x/y
1178 +++ /dev/null
1179 @@ -1,1 +0,0 @@
1180 -y1
1181 diff --git a/x/x b/y/x
1182 rename from x/x
1183 rename to y/x
1184 --- a/x/x
1185 +++ b/y/x
1186 @@ -1,1 +1,2 @@
1187 x
1188 +x1
1189
1190 - parent to branch: --rev . --rev 2
1191 M a
1192 A x/x
1193 y/x
1194 A x/y
1195 R y/x
1196
1197 diff --git a/a b/a
1198 --- a/a
1199 +++ b/a
1200 @@ -1,2 +1,3 @@
1201 a
1202 -7
1203 +m1
1204 +m2
1205 diff --git a/y/x b/x/x
1206 rename from y/x
1207 rename to x/x
1208 --- a/y/x
1209 +++ b/x/x
1210 @@ -1,2 +1,1 @@
1211 x
1212 -x1
1213 diff --git a/x/y b/x/y
1214 new file mode 100644
1215 --- /dev/null
1216 +++ b/x/y
1217 @@ -0,0 +1,1 @@
1218 +y1
1219
1220
General Comments 0
You need to be logged in to leave comments. Login now