Show More
@@ -155,11 +155,15 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
155 | 155 | |
|
156 | 156 | copy = {} |
|
157 | 157 | fullcopy = {} |
|
158 | diverge = {} | |
|
158 | 159 | |
|
159 | 160 | def checkcopies(c, man): |
|
160 | 161 | '''check possible copies for filectx c''' |
|
161 | 162 | for of in findold(c): |
|
163 | fullcopy[c.path()] = of # remember for dir rename detection | |
|
162 | 164 | if of not in man: # original file not in other manifest? |
|
165 | if of in ma: | |
|
166 | diverge.setdefault(of, []).append(c.path()) | |
|
163 | 167 | continue |
|
164 | 168 | c2 = ctx(of, man[of]) |
|
165 | 169 | ca = c.ancestor(c2) |
@@ -167,17 +171,16 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
167 | 171 | continue |
|
168 | 172 | # named changed on only one side? |
|
169 | 173 | if ca.path() == c.path() or ca.path() == c2.path(): |
|
170 | fullcopy[c.path()] = of # remember for dir rename detection | |
|
171 | 174 | if c == ca or c2 == ca: # no merge needed, ignore copy |
|
172 | 175 | continue |
|
173 | 176 | copy[c.path()] = of |
|
174 | 177 | |
|
175 | 178 | if not repo.ui.configbool("merge", "followcopies", True): |
|
176 | return {} | |
|
179 | return {}, {} | |
|
177 | 180 | |
|
178 | 181 | # avoid silly behavior for update from empty dir |
|
179 | 182 | if not m1 or not m2 or not ma: |
|
180 | return {} | |
|
183 | return {}, {} | |
|
181 | 184 | |
|
182 | 185 | u1 = nonoverlap(m1, m2, ma) |
|
183 | 186 | u2 = nonoverlap(m2, m1, ma) |
@@ -188,8 +191,16 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
188 | 191 | for f in u2: |
|
189 | 192 | checkcopies(ctx(f, m2[f]), m1) |
|
190 | 193 | |
|
194 | d2 = {} | |
|
195 | for of, fl in diverge.items(): | |
|
196 | for f in fl: | |
|
197 | fo = list(fl) | |
|
198 | fo.remove(f) | |
|
199 | d2[f] = (of, fo) | |
|
200 | #diverge = d2 | |
|
201 | ||
|
191 | 202 | if not fullcopy or not repo.ui.configbool("merge", "followdirs", True): |
|
192 | return copy | |
|
203 | return copy, diverge | |
|
193 | 204 | |
|
194 | 205 | # generate a directory move map |
|
195 | 206 | d1, d2 = dirs(m1), dirs(m2) |
@@ -223,7 +234,7 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
223 | 234 | del d1, d2, invalid |
|
224 | 235 | |
|
225 | 236 | if not dirmove: |
|
226 | return copy | |
|
237 | return copy, diverge | |
|
227 | 238 | |
|
228 | 239 | # check unaccounted nonoverlapping files against directory moves |
|
229 | 240 | for f in u1 + u2: |
@@ -234,7 +245,7 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
234 | 245 | copy[f] = dirmove[d] + f[len(d):] |
|
235 | 246 | break |
|
236 | 247 | |
|
237 | return copy | |
|
248 | return copy, diverge | |
|
238 | 249 | |
|
239 | 250 | def manifestmerge(repo, p1, p2, pa, overwrite, partial): |
|
240 | 251 | """ |
@@ -254,6 +265,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
254 | 265 | backwards = (pa == p2) |
|
255 | 266 | action = [] |
|
256 | 267 | copy = {} |
|
268 | diverge = {} | |
|
257 | 269 | |
|
258 | 270 | def fmerge(f, f2=None, fa=None): |
|
259 | 271 | """merge flags""" |
@@ -273,7 +285,11 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
273 | 285 | action.append((f, m) + args) |
|
274 | 286 | |
|
275 | 287 | if not (backwards or overwrite): |
|
276 | copy = findcopies(repo, m1, m2, ma, pa.rev()) | |
|
288 | copy, diverge = findcopies(repo, m1, m2, ma, pa.rev()) | |
|
289 | ||
|
290 | for of, fl in diverge.items(): | |
|
291 | act("divergent renames", "dr", of, fl) | |
|
292 | ||
|
277 | 293 | copied = dict.fromkeys(copy.values()) |
|
278 | 294 | |
|
279 | 295 | # Compare manifests |
@@ -410,6 +426,11 b' def applyupdates(repo, action, wctx, mct' | |||
|
410 | 426 | t = mctx.filectx(f2).data() |
|
411 | 427 | repo.wwrite(fd, t, flags) |
|
412 | 428 | updated += 1 |
|
429 | elif m == "dr": # divergent renames | |
|
430 | fl = a[2] | |
|
431 | repo.ui.warn("warning: detected divergent renames of %s to:\n" % f) | |
|
432 | for nf in fl: | |
|
433 | repo.ui.warn(" %s\n" % nf) | |
|
413 | 434 | elif m == "e": # exec |
|
414 | 435 | flags = a[2] |
|
415 | 436 | util.set_exec(repo.wjoin(f), flags) |
@@ -197,6 +197,9 b' checking manifests' | |||
|
197 | 197 | crosschecking files in changesets and manifests |
|
198 | 198 | checking files |
|
199 | 199 | 3 files, 7 changesets, 6 total revisions |
|
200 | warning: detected divergent renames of afile to: | |
|
201 | anotherfile | |
|
202 | adifferentfile | |
|
200 | 203 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
201 | 204 | (branch merge, don't forget to commit) |
|
202 | 205 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
@@ -4,12 +4,16 b' merge' | |||
|
4 | 4 | resolving manifests |
|
5 | 5 | overwrite None partial False |
|
6 | 6 | ancestor af1939970a1c local f26ec4fc3fa3+ remote 8e765a822af2 |
|
7 | a2: divergent renames -> dr | |
|
7 | 8 | a: remote moved to b -> m |
|
8 | 9 | b2: remote created -> g |
|
9 | 10 | merging a and b |
|
10 | 11 | my a@f26ec4fc3fa3+ other b@8e765a822af2 ancestor a@af1939970a1c |
|
11 | 12 | copying a to b |
|
12 | 13 | removing a |
|
14 | warning: detected divergent renames of a2 to: | |
|
15 | c2 | |
|
16 | b2 | |
|
13 | 17 | getting b2 |
|
14 | 18 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
15 | 19 | (branch merge, don't forget to commit) |
@@ -173,8 +173,12 b' test L:nm a b R:nm a c W: - 11 get' | |||
|
173 | 173 | resolving manifests |
|
174 | 174 | overwrite None partial False |
|
175 | 175 | ancestor 924404dff337 local ecf3cb2a4219+ remote e6abcc1a30c2 |
|
176 | a: divergent renames -> dr | |
|
176 | 177 | rev: versions differ -> m |
|
177 | 178 | c: remote created -> g |
|
179 | warning: detected divergent renames of a to: | |
|
180 | b | |
|
181 | c | |
|
178 | 182 | getting c |
|
179 | 183 | merging rev |
|
180 | 184 | my rev@ecf3cb2a4219+ other rev@e6abcc1a30c2 ancestor rev@924404dff337 |
General Comments 0
You need to be logged in to leave comments.
Login now