Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commit.py @ 45588: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 |
comparison
equal
deleted
inserted
replaced
45587:4c8a93ec6908 | 45588:479cce8c9882 |
---|---|
330 ms.active() | 330 ms.active() |
331 and ms.extras(fname).get(b'filenode-source') == b'other' | 331 and ms.extras(fname).get(b'filenode-source') == b'other' |
332 ): | 332 ): |
333 fparent1, fparent2 = fparent2, nullid | 333 fparent1, fparent2 = fparent2, nullid |
334 | 334 |
335 force_new_node = False | |
336 # The file might have been deleted by merge code and user explicitly choose | |
337 # to revert the file and keep it. The other case can be where there is | |
338 # change-delete or delete-change conflict and user explicitly choose to keep | |
339 # the file. The goal is to create a new filenode for users explicit choices | |
340 if ( | |
341 repo.ui.configbool(b'experimental', b'merge-track-salvaged') | |
342 and ms.active() | |
343 and ms.extras(fname).get(b'merge-removal-candidate') == b'yes' | |
344 ): | |
345 force_new_node = True | |
335 # is the file changed? | 346 # is the file changed? |
336 text = fctx.data() | 347 text = fctx.data() |
337 if fparent2 != nullid or meta or flog.cmp(fparent1, text): | 348 if fparent2 != nullid or meta or flog.cmp(fparent1, text) or force_new_node: |
338 if touched is None: # do not overwrite added | 349 if touched is None: # do not overwrite added |
339 touched = 'modified' | 350 touched = 'modified' |
340 fnode = flog.add(text, meta, tr, linkrev, fparent1, fparent2) | 351 fnode = flog.add(text, meta, tr, linkrev, fparent1, fparent2) |
341 # are just the flags changed during merge? | 352 # are just the flags changed during merge? |
342 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags(): | 353 elif fname in manifest1 and manifest1.flags(fname) != fctx.flags(): |