##// 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 return final_copies
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 def _merge_copies_dict(minor, major, isancestor, changes):
455 def _merge_copies_dict(minor, major, isancestor, changes):
450 """merge two copies-mapping together, minor and major
456 """merge two copies-mapping together, minor and major
451
457
@@ -464,34 +470,35 b' def _merge_copies_dict(minor, major, isa'
464 if other is None:
470 if other is None:
465 minor[dest] = value
471 minor[dest] = value
466 else:
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 new_tt = value[0]
481 new_tt = value[0]
468 other_tt = other[0]
482 other_tt = other[0]
483
469 if value[1] == other[1]:
484 if value[1] == other[1]:
470 continue
485 return PICK_EITHER
471 # content from "major" wins, unless it is older
486 # content from "major" wins, unless it is older
472 # than the branch point or there is a merge
487 # than the branch point or there is a merge
473 if new_tt == other_tt:
488 if new_tt == other_tt:
474 minor[dest] = value
489 return PICK_MAJOR
475 elif (
490 elif changes is not None and value[1] is None and dest in changes.salvaged:
476 changes is not None
491 return PICK_MINOR
477 and value[1] is None
492 elif changes is not None and other[1] is None and dest in changes.salvaged:
478 and dest in changes.salvaged
493 return PICK_MAJOR
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
487 elif changes is not None and dest in changes.merged:
494 elif changes is not None and dest in changes.merged:
488 minor[dest] = value
495 return PICK_MAJOR
489 elif not isancestor(new_tt, other_tt):
496 elif not isancestor(new_tt, other_tt):
490 if value[1] is not None:
497 if value[1] is not None:
491 minor[dest] = value
498 return PICK_MAJOR
492 elif isancestor(other_tt, new_tt):
499 elif isancestor(other_tt, new_tt):
493 minor[dest] = value
500 return PICK_MAJOR
494 return minor
501 return PICK_MINOR
495
502
496
503
497 def _revinfo_getter_extra(repo):
504 def _revinfo_getter_extra(repo):
General Comments 0
You need to be logged in to leave comments. Login now