comparison mercurial/copies.py @ 46183:ee63c1173c1b

copies: deal with the "same revision" special case earlier This can happens a lot in case of deletion so we better deal with it early. Differential Revision: https://phab.mercurial-scm.org/D9592
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 14 Dec 2020 02:03:36 +0100
parents 6b9d65298484
children cb8b2ee89a5d
comparison
equal deleted inserted replaced
46182:dc4564ee57dc 46183:ee63c1173c1b
476 return minor 476 return minor
477 477
478 478
479 def _compare_values(changes, isancestor, dest, minor, major): 479 def _compare_values(changes, isancestor, dest, minor, major):
480 """compare two value within a _merge_copies_dict loop iteration""" 480 """compare two value within a _merge_copies_dict loop iteration"""
481 major_tt = major[0] 481 major_tt, major_value = major
482 minor_tt = minor[0] 482 minor_tt, minor_value = minor
483 483
484 if major[1] == minor[1]: 484 # evacuate some simple case first:
485 if major_tt == minor_tt:
486 # if it comes from the same revision it must be the same value
487 assert major_value == minor_value
485 return PICK_EITHER 488 return PICK_EITHER
486 # content from "major" wins, unless it is older 489 elif major[1] == minor[1]:
487 # than the branch point or there is a merge 490 return PICK_EITHER
488 if major_tt == minor_tt: 491
489 return PICK_MAJOR 492 # actual merging needed: content from "major" wins, unless it is older than
493 # the branch point or there is a merge
490 elif changes is not None and major[1] is None and dest in changes.salvaged: 494 elif changes is not None and major[1] is None and dest in changes.salvaged:
491 return PICK_MINOR 495 return PICK_MINOR
492 elif changes is not None and minor[1] is None and dest in changes.salvaged: 496 elif changes is not None and minor[1] is None and dest in changes.salvaged:
493 return PICK_MAJOR 497 return PICK_MAJOR
494 elif changes is not None and dest in changes.merged: 498 elif changes is not None and dest in changes.merged: