##// END OF EJS Templates
copies: extract value comparison in the python copy tracing...
marmoute -
r46776:3a0c4133 default
parent child Browse files
Show More
@@ -446,6 +446,12 b' def _combine_changeset_copies('
446 446 return final_copies
447 447
448 448
449 # constant to decide which side to pick with _merge_copies_dict
450 PICK_MINOR = 0
451 PICK_MAJOR = 1
452 PICK_EITHER = 2
453
454
449 455 def _merge_copies_dict(minor, major, isancestor, changes):
450 456 """merge two copies-mapping together, minor and major
451 457
@@ -464,34 +470,35 b' def _merge_copies_dict(minor, major, isa'
464 470 if other is None:
465 471 minor[dest] = value
466 472 else:
473 pick = _compare_values(changes, isancestor, dest, other, value)
474 if pick == PICK_MAJOR:
475 minor[dest] = value
476 return minor
477
478
479 def _compare_values(changes, isancestor, dest, other, value):
480 """compare two value within a _merge_copies_dict loop iteration"""
467 481 new_tt = value[0]
468 482 other_tt = other[0]
483
469 484 if value[1] == other[1]:
470 continue
485 return PICK_EITHER
471 486 # content from "major" wins, unless it is older
472 487 # than the branch point or there is a merge
473 488 if new_tt == other_tt:
474 minor[dest] = value
475 elif (
476 changes is not None
477 and value[1] is None
478 and dest in changes.salvaged
479 ):
480 pass
481 elif (
482 changes is not None
483 and other[1] is None
484 and dest in changes.salvaged
485 ):
486 minor[dest] = value
489 return PICK_MAJOR
490 elif changes is not None and value[1] is None and dest in changes.salvaged:
491 return PICK_MINOR
492 elif changes is not None and other[1] is None and dest in changes.salvaged:
493 return PICK_MAJOR
487 494 elif changes is not None and dest in changes.merged:
488 minor[dest] = value
495 return PICK_MAJOR
489 496 elif not isancestor(new_tt, other_tt):
490 497 if value[1] is not None:
491 minor[dest] = value
498 return PICK_MAJOR
492 499 elif isancestor(other_tt, new_tt):
493 minor[dest] = value
494 return minor
500 return PICK_MAJOR
501 return PICK_MINOR
495 502
496 503
497 504 def _revinfo_getter_extra(repo):
General Comments 0
You need to be logged in to leave comments. Login now