# HG changeset patch # User Pierre-Yves David # Date 1607907816 -3600 # Node ID ee63c1173c1b8ba28ea95cf73d803303bfdef3e8 # Parent dc4564ee57dcdd06179f23cbbd37fbdebc88d06b 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 diff -r dc4564ee57dc -r ee63c1173c1b mercurial/copies.py --- a/mercurial/copies.py Sun Dec 20 15:47:02 2020 +0100 +++ b/mercurial/copies.py Mon Dec 14 02:03:36 2020 +0100 @@ -478,15 +478,19 @@ def _compare_values(changes, isancestor, dest, minor, major): """compare two value within a _merge_copies_dict loop iteration""" - major_tt = major[0] - minor_tt = minor[0] + major_tt, major_value = major + minor_tt, minor_value = minor - if major[1] == minor[1]: + # evacuate some simple case first: + if major_tt == minor_tt: + # if it comes from the same revision it must be the same value + assert major_value == minor_value return PICK_EITHER - # content from "major" wins, unless it is older - # than the branch point or there is a merge - if major_tt == minor_tt: - return PICK_MAJOR + elif major[1] == minor[1]: + return PICK_EITHER + + # actual merging needed: content from "major" wins, unless it is older than + # the branch point or there is a merge elif changes is not None and major[1] is None and dest in changes.salvaged: return PICK_MINOR elif changes is not None and minor[1] is None and dest in changes.salvaged: