274 r, i1, copies1 = heapq.heappop(work) |
274 r, i1, copies1 = heapq.heappop(work) |
275 if work and work[0][0] == r: |
275 if work and work[0][0] == r: |
276 # We are tracing copies from both parents |
276 # We are tracing copies from both parents |
277 r, i2, copies2 = heapq.heappop(work) |
277 r, i2, copies2 = heapq.heappop(work) |
278 copies = {} |
278 copies = {} |
279 ctx = repo[r] |
|
280 p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest() |
|
281 allcopies = set(copies1) | set(copies2) |
279 allcopies = set(copies1) | set(copies2) |
282 # TODO: perhaps this filtering should be done as long as ctx |
280 # TODO: perhaps this filtering should be done as long as ctx |
283 # is merge, whether or not we're tracing from both parent. |
281 # is merge, whether or not we're tracing from both parent. |
284 for dst in allcopies: |
282 for dst in allcopies: |
285 if not match(dst): |
283 if not match(dst): |
286 continue |
284 continue |
287 if dst not in copies2: |
285 # Unlike when copies are stored in the filelog, we consider |
288 # Copied on p1 side: mark as copy from p1 side if it didn't |
286 # it a copy even if the destination already existed on the |
289 # already exist on p2 side |
287 # other branch. It's simply too expensive to check if the |
290 if dst not in p2man: |
288 # file existed in the manifest. |
291 copies[dst] = copies1[dst] |
289 if dst in copies1: |
292 elif dst not in copies1: |
290 # If it was copied on the p1 side, mark it as copied from |
293 # Copied on p2 side: mark as copy from p2 side if it didn't |
291 # that side, even if it was also copied on the p2 side. |
294 # already exist on p1 side |
292 copies[dst] = copies1[dst] |
295 if dst not in p1man: |
|
296 copies[dst] = copies2[dst] |
|
297 else: |
293 else: |
298 # Copied on both sides: mark as copy from p1 side |
294 copies[dst] = copies2[dst] |
299 copies[dst] = copies1[dst] |
|
300 else: |
295 else: |
301 copies = copies1 |
296 copies = copies1 |
302 if r == b.rev(): |
297 if r == b.rev(): |
303 _filter(a, b, copies) |
298 _filter(a, b, copies) |
304 return copies |
299 return copies |