Mercurial > public > mercurial-scm > hg
diff mercurial/commit.py @ 45585:479cce8c9882
commit: force create a new filenode if it was set in mergestate by merge
For reasons mentioned in previous commits, we will like to forcefully create a
new filenode sometimes.
Combination of this patch and previous one, we fixed a case in
`test-merge-combination.t`.
This does not yet results in conflict where it should, I need to investigate
more about what's happening as it should be a change-delete conflict now.
Differential Revision: https://phab.mercurial-scm.org/D8989
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 03 Sep 2020 13:58:14 +0530 |
parents | 037e88d453fa |
children | 094a91a183f1 |
line wrap: on
line diff
--- a/mercurial/commit.py Thu Sep 03 13:44:06 2020 +0530 +++ b/mercurial/commit.py Thu Sep 03 13:58:14 2020 +0530 @@ -332,9 +332,20 @@ ): fparent1, fparent2 = fparent2, nullid + force_new_node = False + # The file might have been deleted by merge code and user explicitly choose + # to revert the file and keep it. The other case can be where there is + # change-delete or delete-change conflict and user explicitly choose to keep + # the file. The goal is to create a new filenode for users explicit choices + if ( + repo.ui.configbool(b'experimental', b'merge-track-salvaged') + and ms.active() + and ms.extras(fname).get(b'merge-removal-candidate') == b'yes' + ): + force_new_node = True # is the file changed? text = fctx.data() - if fparent2 != nullid or meta or flog.cmp(fparent1, text): + if fparent2 != nullid or meta or flog.cmp(fparent1, text) or force_new_node: if touched is None: # do not overwrite added touched = 'modified' fnode = flog.add(text, meta, tr, linkrev, fparent1, fparent2)