Show More
@@ -332,9 +332,15 b' def mergecopies(repo, c1, c2, ca):' | |||||
332 | ma = ca.manifest() |
|
332 | ma = ca.manifest() | |
333 |
|
333 | |||
334 | # see _checkcopies documentation below for these dicts |
|
334 | # see _checkcopies documentation below for these dicts | |
335 | copy1, copy2 = {}, {} |
|
335 | diverge = {} # divergence data is shared | |
336 | fullcopy1, fullcopy2 = {}, {} |
|
336 | data1 = {'copy': {}, | |
337 | diverge = {} |
|
337 | 'fullcopy': {}, | |
|
338 | 'diverge': diverge, | |||
|
339 | } | |||
|
340 | data2 = {'copy': {}, | |||
|
341 | 'fullcopy': {}, | |||
|
342 | 'diverge': diverge, | |||
|
343 | } | |||
338 |
|
344 | |||
339 | # find interesting file sets from manifests |
|
345 | # find interesting file sets from manifests | |
340 | addedinm1 = m1.filesnotin(ma) |
|
346 | addedinm1 = m1.filesnotin(ma) | |
@@ -344,13 +350,13 b' def mergecopies(repo, c1, c2, ca):' | |||||
344 | bothnew = sorted(addedinm1 & addedinm2) |
|
350 | bothnew = sorted(addedinm1 & addedinm2) | |
345 |
|
351 | |||
346 | for f in u1u: |
|
352 | for f in u1u: | |
347 |
_checkcopies(c1, f, m1, m2, ca, limit, d |
|
353 | _checkcopies(c1, f, m1, m2, ca, limit, data1) | |
348 |
|
354 | |||
349 | for f in u2u: |
|
355 | for f in u2u: | |
350 |
_checkcopies(c2, f, m2, m1, ca, limit, d |
|
356 | _checkcopies(c2, f, m2, m1, ca, limit, data2) | |
351 |
|
357 | |||
352 |
copy = dict( |
|
358 | copy = dict(data1['copy'].items() + data2['copy'].items()) | |
353 |
fullcopy = dict(fullcopy |
|
359 | fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items()) | |
354 |
|
360 | |||
355 | renamedelete = {} |
|
361 | renamedelete = {} | |
356 | renamedeleteset = set() |
|
362 | renamedeleteset = set() | |
@@ -369,10 +375,14 b' def mergecopies(repo, c1, c2, ca):' | |||||
369 | if bothnew: |
|
375 | if bothnew: | |
370 | repo.ui.debug(" unmatched files new in both:\n %s\n" |
|
376 | repo.ui.debug(" unmatched files new in both:\n %s\n" | |
371 | % "\n ".join(bothnew)) |
|
377 | % "\n ".join(bothnew)) | |
372 |
bothdiverge |
|
378 | bothdiverge = {} | |
|
379 | bothdata = {'copy': {}, | |||
|
380 | 'fullcopy': {}, | |||
|
381 | 'diverge': bothdiverge, | |||
|
382 | } | |||
373 | for f in bothnew: |
|
383 | for f in bothnew: | |
374 |
_checkcopies(c1, f, m1, m2, ca, limit, bothd |
|
384 | _checkcopies(c1, f, m1, m2, ca, limit, bothdata) | |
375 |
_checkcopies(c2, f, m2, m1, ca, limit, bothd |
|
385 | _checkcopies(c2, f, m2, m1, ca, limit, bothdata) | |
376 | for of, fl in bothdiverge.items(): |
|
386 | for of, fl in bothdiverge.items(): | |
377 | if len(fl) == 2 and fl[0] == fl[1]: |
|
387 | if len(fl) == 2 and fl[0] == fl[1]: | |
378 | copy[fl[0]] = of # not actually divergent, just matching renames |
|
388 | copy[fl[0]] = of # not actually divergent, just matching renames | |
@@ -487,7 +497,7 b' def _related(f1, f2, limit):' | |||||
487 | except StopIteration: |
|
497 | except StopIteration: | |
488 | return False |
|
498 | return False | |
489 |
|
499 | |||
490 |
def _checkcopies(ctx, f, m1, m2, base, limit, d |
|
500 | def _checkcopies(ctx, f, m1, m2, base, limit, data): | |
491 | """ |
|
501 | """ | |
492 | check possible copies of f from m1 to m2 |
|
502 | check possible copies of f from m1 to m2 | |
493 |
|
503 | |||
@@ -497,9 +507,10 b' def _checkcopies(ctx, f, m1, m2, base, l' | |||||
497 | m2 = the destination manifest |
|
507 | m2 = the destination manifest | |
498 | base = the changectx used as a merge base |
|
508 | base = the changectx used as a merge base | |
499 | limit = the rev number to not search beyond |
|
509 | limit = the rev number to not search beyond | |
500 | diverge = record all diverges in this dict |
|
510 | data = dictionary of dictionary to store copy data. The keys are: | |
501 |
|
|
511 | - diverge = record all diverges in this dict | |
502 |
|
|
512 | - copy = record all non-divergent copies in this dict | |
|
513 | - fullcopy = record all copies in this dict | |||
503 |
|
514 | |||
504 | note: limit is only an optimization, and there is no guarantee that |
|
515 | note: limit is only an optimization, and there is no guarantee that | |
505 | irrelevant revisions will not be limited |
|
516 | irrelevant revisions will not be limited | |
@@ -522,7 +533,7 b' def _checkcopies(ctx, f, m1, m2, base, l' | |||||
522 | continue |
|
533 | continue | |
523 | seen.add(of) |
|
534 | seen.add(of) | |
524 |
|
535 | |||
525 | fullcopy[f] = of # remember for dir rename detection |
|
536 | data['fullcopy'][f] = of # remember for dir rename detection | |
526 | if of not in m2: |
|
537 | if of not in m2: | |
527 | continue # no match, keep looking |
|
538 | continue # no match, keep looking | |
528 | if m2[of] == mb.get(of): |
|
539 | if m2[of] == mb.get(of): | |
@@ -532,11 +543,11 b' def _checkcopies(ctx, f, m1, m2, base, l' | |||||
532 | # unrelated to the droids we are looking for. |
|
543 | # unrelated to the droids we are looking for. | |
533 | cr = _related(oc, c2, base.rev()) |
|
544 | cr = _related(oc, c2, base.rev()) | |
534 | if cr and (of == f or of == c2.path()): # non-divergent |
|
545 | if cr and (of == f or of == c2.path()): # non-divergent | |
535 | copy[f] = of |
|
546 | data['copy'][f] = of | |
536 | return |
|
547 | return | |
537 |
|
548 | |||
538 | if of in mb: |
|
549 | if of in mb: | |
539 | diverge.setdefault(of, []).append(f) |
|
550 | data['diverge'].setdefault(of, []).append(f) | |
540 |
|
551 | |||
541 | def duplicatecopies(repo, rev, fromrev, skiprev=None): |
|
552 | def duplicatecopies(repo, rev, fromrev, skiprev=None): | |
542 | '''reproduce copies from fromrev to rev in the dirstate |
|
553 | '''reproduce copies from fromrev to rev in the dirstate |
General Comments 0
You need to be logged in to leave comments.
Login now