##// 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 old.sort()
53 old.sort()
54 return [o[1] for o in old]
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 Find moves and copies between context c1 and c2
58 Find moves and copies between context c1 and c2
59 """
59 """
@@ -104,9 +104,6 b' def copies(repo, c1, c2, ca):'
104 elif of in ma:
104 elif of in ma:
105 diverge.setdefault(of, []).append(f)
105 diverge.setdefault(of, []).append(f)
106
106
107 if not repo.ui.configbool("merge", "followcopies", True):
108 return {}, {}
109
110 repo.ui.debug(_(" searching for copies back to rev %d\n") % limit)
107 repo.ui.debug(_(" searching for copies back to rev %d\n") % limit)
111
108
112 u1 = _nonoverlap(m1, m2, ma)
109 u1 = _nonoverlap(m1, m2, ma)
@@ -140,7 +137,7 b' def copies(repo, c1, c2, ca):'
140 repo.ui.debug(_(" %s -> %s %s\n") % (f, fullcopy[f], note))
137 repo.ui.debug(_(" %s -> %s %s\n") % (f, fullcopy[f], note))
141 del diverge2
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 return copy, diverge
141 return copy, diverge
145
142
146 repo.ui.debug(_(" checking for directory renames\n"))
143 repo.ui.debug(_(" checking for directory renames\n"))
@@ -187,7 +184,8 b' def copies(repo, c1, c2, ca):'
187 for d in dirmove:
184 for d in dirmove:
188 if f.startswith(d):
185 if f.startswith(d):
189 # new file added in a directory that was moved, move it
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 repo.ui.debug(_(" file %s -> %s\n") % (f, copy[f]))
189 repo.ui.debug(_(" file %s -> %s\n") % (f, copy[f]))
192 break
190 break
193
191
@@ -101,7 +101,9 b' def manifestmerge(repo, p1, p2, pa, over'
101 action.append((f, m) + args)
101 action.append((f, m) + args)
102
102
103 if pa and not (backwards or overwrite):
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 copied = dict.fromkeys(copy.values())
107 copied = dict.fromkeys(copy.values())
106 for of, fl in diverge.items():
108 for of, fl in diverge.items():
107 act("divergent renames", "dr", of, fl)
109 act("divergent renames", "dr", of, fl)
@@ -11,12 +11,17 b' cd t'
11 # set up a boring main branch
11 # set up a boring main branch
12 add a a
12 add a a
13 hg add a
13 hg add a
14 mkdir x
15 add x/x x
16 hg add x/x
14 hg ci -m0
17 hg ci -m0
15
18
16 add a m1
19 add a m1
17 hg ci -m1
20 hg ci -m1
18
21
19 add a m2
22 add a m2
23 add x/y y1
24 hg add x/y
20 hg ci -m2
25 hg ci -m2
21
26
22 show()
27 show()
@@ -59,6 +64,7 b' tb()'
59 echo
64 echo
60 }
65 }
61
66
67
62 tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
68 tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
63 tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
69 tb "add a a1" "add a a2" "hg cp a b" "copy in working dir"
64 tb "hg mv a b" "add b b1" "add b w" "single rename"
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 tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
72 tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
67 tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
73 tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
68 tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"
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 A b
30 A b
31 a
31 a
32 R a
32 R a
33 R x/y
33
34
34 diff --git a/a b/b
35 diff --git a/a b/b
35 rename from a
36 rename from a
@@ -43,6 +44,12 b' rename to b'
43 +0
44 +0
44 +a1
45 +a1
45 +a2
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 - root to parent: --rev 0 --rev .
54 - root to parent: --rev 0 --rev .
48 M a
55 M a
@@ -70,6 +77,7 b' diff --git a/a b/a'
70
77
71 - branch to parent: --rev 2 --rev .
78 - branch to parent: --rev 2 --rev .
72 M a
79 M a
80 R x/y
73
81
74 diff --git a/a b/a
82 diff --git a/a b/a
75 --- a/a
83 --- a/a
@@ -81,9 +89,16 b' diff --git a/a b/a'
81 +0
89 +0
82 +a1
90 +a1
83 +a2
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 - parent to branch: --rev . --rev 2
99 - parent to branch: --rev . --rev 2
86 M a
100 M a
101 A x/y
87
102
88 diff --git a/a b/a
103 diff --git a/a b/a
89 --- a/a
104 --- a/a
@@ -95,6 +110,12 b' diff --git a/a b/a'
95 -a2
110 -a2
96 +m1
111 +m1
97 +m2
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 created new head
121 created new head
@@ -136,6 +157,7 b' copy to b'
136 M a
157 M a
137 A b
158 A b
138 a
159 a
160 R x/y
139
161
140 diff --git a/a b/a
162 diff --git a/a b/a
141 --- a/a
163 --- a/a
@@ -159,6 +181,12 b' copy to b'
159 +1
181 +1
160 +a1
182 +a1
161 +a2
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 - root to parent: --rev 0 --rev .
191 - root to parent: --rev 0 --rev .
164 M a
192 M a
@@ -186,6 +214,7 b' diff --git a/a b/a'
186
214
187 - branch to parent: --rev 2 --rev .
215 - branch to parent: --rev 2 --rev .
188 M a
216 M a
217 R x/y
189
218
190 diff --git a/a b/a
219 diff --git a/a b/a
191 --- a/a
220 --- a/a
@@ -197,9 +226,16 b' diff --git a/a b/a'
197 +1
226 +1
198 +a1
227 +a1
199 +a2
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 - parent to branch: --rev . --rev 2
236 - parent to branch: --rev . --rev 2
202 M a
237 M a
238 A x/y
203
239
204 diff --git a/a b/a
240 diff --git a/a b/a
205 --- a/a
241 --- a/a
@@ -211,6 +247,12 b' diff --git a/a b/a'
211 -a2
247 -a2
212 +m1
248 +m1
213 +m2
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 created new head
258 created new head
@@ -248,6 +290,7 b' rename to b'
248 A b
290 A b
249 a
291 a
250 R a
292 R a
293 R x/y
251
294
252 diff --git a/a b/b
295 diff --git a/a b/b
253 rename from a
296 rename from a
@@ -261,6 +304,12 b' rename to b'
261 +2
304 +2
262 +b1
305 +b1
263 +w
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 - root to parent: --rev 0 --rev .
314 - root to parent: --rev 0 --rev .
266 A b
315 A b
@@ -296,6 +345,7 b' rename to a'
296 A b
345 A b
297 a
346 a
298 R a
347 R a
348 R x/y
299
349
300 diff --git a/a b/b
350 diff --git a/a b/b
301 rename from a
351 rename from a
@@ -308,10 +358,17 b' rename to b'
308 -m2
358 -m2
309 +2
359 +2
310 +b1
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 - parent to branch: --rev . --rev 2
368 - parent to branch: --rev . --rev 2
313 A a
369 A a
314 b
370 b
371 A x/y
315 R b
372 R b
316
373
317 diff --git a/b b/a
374 diff --git a/b b/a
@@ -325,6 +382,12 b' rename to a'
325 -b1
382 -b1
326 +m1
383 +m1
327 +m2
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 created new head
393 created new head
@@ -367,6 +430,7 b' copy to b'
367 M a
430 M a
368 A b
431 A b
369 a
432 a
433 R x/y
370
434
371 diff --git a/a b/a
435 diff --git a/a b/a
372 --- a/a
436 --- a/a
@@ -388,6 +452,12 b' copy to b'
388 -m2
452 -m2
389 +3
453 +3
390 +b1
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 - root to parent: --rev 0 --rev .
462 - root to parent: --rev 0 --rev .
393 M a
463 M a
@@ -433,6 +503,7 b' deleted file mode 100644'
433 M a
503 M a
434 A b
504 A b
435 a
505 a
506 R x/y
436
507
437 diff --git a/a b/a
508 diff --git a/a b/a
438 --- a/a
509 --- a/a
@@ -453,9 +524,16 b' copy to b'
453 -m2
524 -m2
454 +3
525 +3
455 +b1
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 - parent to branch: --rev . --rev 2
534 - parent to branch: --rev . --rev 2
458 M a
535 M a
536 A x/y
459 R b
537 R b
460
538
461 diff --git a/a b/a
539 diff --git a/a b/a
@@ -474,6 +552,12 b' deleted file mode 100644'
474 -a
552 -a
475 -3
553 -3
476 -b1
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 created new head
563 created new head
@@ -506,6 +590,7 b' rename to d'
506 A d
590 A d
507 a
591 a
508 R a
592 R a
593 R x/y
509
594
510 diff --git a/a b/d
595 diff --git a/a b/d
511 rename from a
596 rename from a
@@ -517,6 +602,12 b' rename to d'
517 -m1
602 -m1
518 -m2
603 -m2
519 +4
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 - root to parent: --rev 0 --rev .
612 - root to parent: --rev 0 --rev .
522 A c
613 A c
@@ -550,6 +641,7 b' rename to a'
550 A c
641 A c
551 a
642 a
552 R a
643 R a
644 R x/y
553
645
554 diff --git a/a b/c
646 diff --git a/a b/c
555 rename from a
647 rename from a
@@ -561,10 +653,17 b' rename to c'
561 -m1
653 -m1
562 -m2
654 -m2
563 +4
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 - parent to branch: --rev . --rev 2
663 - parent to branch: --rev . --rev 2
566 A a
664 A a
567 c
665 c
666 A x/y
568 R c
667 R c
569
668
570 diff --git a/c b/a
669 diff --git a/c b/a
@@ -577,6 +676,12 b' rename to a'
577 -4
676 -4
578 +m1
677 +m1
579 +m2
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 created new head
687 created new head
@@ -638,6 +743,7 b' A c'
638 a
743 a
639 A d
744 A d
640 a
745 a
746 R x/y
641
747
642 diff --git a/a b/a
748 diff --git a/a b/a
643 --- a/a
749 --- a/a
@@ -677,6 +783,12 b' copy to d'
677 -m1
783 -m1
678 -m2
784 -m2
679 +5
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 - root to parent: --rev 0 --rev .
793 - root to parent: --rev 0 --rev .
682 M a
794 M a
@@ -740,6 +852,7 b' A b'
740 a
852 a
741 A c
853 A c
742 a
854 a
855 R x/y
743
856
744 diff --git a/a b/a
857 diff --git a/a b/a
745 --- a/a
858 --- a/a
@@ -769,9 +882,16 b' copy to c'
769 -m1
882 -m1
770 -m2
883 -m2
771 +5
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 - parent to branch: --rev . --rev 2
892 - parent to branch: --rev . --rev 2
774 M a
893 M a
894 A x/y
775 R b
895 R b
776 R c
896 R c
777
897
@@ -797,6 +917,12 b' deleted file mode 100644'
797 @@ -1,2 +0,0 @@
917 @@ -1,2 +0,0 @@
798 -a
918 -a
799 -5
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 created new head
928 created new head
@@ -824,6 +950,7 b' diff --git a/a b/a'
824
950
825 - working to branch: --rev 2
951 - working to branch: --rev 2
826 M a
952 M a
953 R x/y
827
954
828 diff --git a/a b/a
955 diff --git a/a b/a
829 --- a/a
956 --- a/a
@@ -834,6 +961,12 b' diff --git a/a b/a'
834 -m2
961 -m2
835 +6
962 +6
836 +a1
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 - root to parent: --rev 0 --rev .
971 - root to parent: --rev 0 --rev .
839 A b
972 A b
@@ -869,6 +1002,7 b' rename to a'
869 A b
1002 A b
870 a
1003 a
871 R a
1004 R a
1005 R x/y
872
1006
873 diff --git a/a b/b
1007 diff --git a/a b/b
874 rename from a
1008 rename from a
@@ -881,10 +1015,17 b' rename to b'
881 -m2
1015 -m2
882 +6
1016 +6
883 +a1
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 - parent to branch: --rev . --rev 2
1025 - parent to branch: --rev . --rev 2
886 A a
1026 A a
887 b
1027 b
1028 A x/y
888 R b
1029 R b
889
1030
890 diff --git a/b b/a
1031 diff --git a/b b/a
@@ -898,5 +1039,182 b' rename to a'
898 -a1
1039 -a1
899 +m1
1040 +m1
900 +m2
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