Mercurial > hg-stable
changeset 45479:09edbff6ae8d
merge: store ACTION_KEEP_ABSENT when we are keeping the file absent locally
If a file is not present on the local side, and it's unchanged between other
merge parent and ancestor, we don't use any action, neither we had a if-else
branch for that condition. This leads to bid-merge missing that there is a
such action possible which can be performed.
As test changes demonstrate, we now choose the locally deleted side instead
of choosing the remote one consistently. This is also wrong behavior which is
resulted because of missing possible action. It will be fixed in next patch.
This whole logic is not acurrate as we should prompt user on what to do
when this kind of criss-cross merge is in play.
Differential Revision: https://phab.mercurial-scm.org/D8940
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 24 Aug 2020 15:20:09 +0530 |
parents | bb9888d32601 |
children | 49ffaa4f65f6 |
files | mercurial/merge.py tests/test-merge-criss-cross.t |
diffstat | 2 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Sep 01 17:08:26 2020 +0530 +++ b/mercurial/merge.py Mon Aug 24 15:20:09 2020 +0530 @@ -1023,6 +1023,13 @@ (None, f, f, False, pa.node()), b'prompt deleted/changed', ) + else: + mresult.addfile( + f, + mergestatemod.ACTION_KEEP_ABSENT, + None, + b'local not present, remote unchanged', + ) if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'): # If we are merging, look for path conflicts.
--- a/tests/test-merge-criss-cross.t Tue Sep 01 17:08:26 2020 +0530 +++ b/tests/test-merge-criss-cross.t Mon Aug 24 15:20:09 2020 +0530 @@ -572,28 +572,26 @@ $ hg update --clean 'desc("merge-deleting-the-file-from-deleted")' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("merge-keeping-the-file-from-deleted")' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ ls -1 other-file - the-file (merging a deletion with keeping → conflict) BROKEN: this should result in conflict $ hg update --clean 'desc("merge-deleting-the-file-from-deleted")' - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("merge-keeping-the-file-from-updated")' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ ls -1 other-file - the-file (merging two deletion together → no conflict) $ hg update --clean 'desc("merge-deleting-the-file-from-updated")' - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("merge-deleting-the-file-from-deleted")' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) @@ -606,23 +604,21 @@ $ hg update --clean 'desc("merge-deleting-the-file-from-updated")' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("merge-keeping-the-file-from-deleted")' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ ls -1 other-file - the-file (merging a deletion with keeping → conflict) BROKEN: this should result in conflict $ hg update --clean 'desc("merge-deleting-the-file-from-updated")' - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge 'desc("merge-keeping-the-file-from-updated")' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ ls -1 other-file - the-file (merging two "keeping" together → no conflict)