Mercurial > hg-stable
comparison mercurial/merge.py @ 45836:58e7ee23ddbd
copies: handle more cases where a file got replaced by a copy
This patch fixes the changeset-centric version in a pretty
straight-forward way. It fixes it to automatically resolve the
conflict, which is better than resulting in a modify/delete conflict
as it was before b4057d001760 (merge: when rename was made on both
sides, use ancestor as merge base, 2020-01-22).
I'll leave it for later to test and explicitly handle cases where
files have been renamed to the same target on different sides of the
merge.
Differential Revision: https://phab.mercurial-scm.org/D8653
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 22 Jun 2020 22:47:43 -0700 |
parents | ed0ded64a8a9 |
children | 721f765a34ac |
comparison
equal
deleted
inserted
replaced
45835:4b79e92a5ef8 | 45836:58e7ee23ddbd |
---|---|
815 msg = b'both renamed from %s' % fa | 815 msg = b'both renamed from %s' % fa |
816 else: | 816 else: |
817 args = (f, f, None, False, pa.node()) | 817 args = (f, f, None, False, pa.node()) |
818 msg = b'both created' | 818 msg = b'both created' |
819 mresult.addfile(f, mergestatemod.ACTION_MERGE, args, msg) | 819 mresult.addfile(f, mergestatemod.ACTION_MERGE, args, msg) |
820 elif f in branch_copies1.copy: | |
821 fa = branch_copies1.copy[f] | |
822 mresult.addfile( | |
823 f, | |
824 mergestatemod.ACTION_MERGE, | |
825 (f, fa, fa, False, pa.node()), | |
826 b'local replaced from %s' % fa, | |
827 ) | |
828 elif f in branch_copies2.copy: | |
829 fa = branch_copies2.copy[f] | |
830 mresult.addfile( | |
831 f, | |
832 mergestatemod.ACTION_MERGE, | |
833 (fa, f, fa, False, pa.node()), | |
834 b'other replaced from %s' % fa, | |
835 ) | |
820 else: | 836 else: |
821 a = ma[f] | 837 a = ma[f] |
822 fla = ma.flags(f) | 838 fla = ma.flags(f) |
823 nol = b'l' not in fl1 + fl2 + fla | 839 nol = b'l' not in fl1 + fl2 + fla |
824 if n2 == a and fl2 == fla: | 840 if n2 == a and fl2 == fla: |