comparison mercurial/localrepo.py @ 44687:1b8fd4af3318

mergestate: store about files resolved in favour of other Committing a merge sometimes wrongly creates a new filenode where it can re-use an existing one. This happens because the commit code does it's own calculation and does not know what happened on merge. This starts storing information in mergestate about files which were automatically merged and the other/remote version of file was used. We need this information at commit to pick the filenode parent for the new commit. This issue was found by Pierre-Yves David and idea to store the relevant parts in mergestate is also suggested by him. Somethings which can be further investigated are: 1) refactoring of commit logic more to depend on this information 2) maybe a more generic solution? Differential Revision: https://phab.mercurial-scm.org/D8392
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 09 Apr 2020 16:06:03 +0530
parents fdc802f29b2c
children c6d31e659a28 35b255e474d9
comparison
equal deleted inserted replaced
44686:bca57ad9e630 44687:1b8fd4af3318
2853 fparentancestors = flog.commonancestorsheads(fparent1, fparent2) 2853 fparentancestors = flog.commonancestorsheads(fparent1, fparent2)
2854 if fparent1 in fparentancestors: 2854 if fparent1 in fparentancestors:
2855 fparent1, fparent2 = fparent2, nullid 2855 fparent1, fparent2 = fparent2, nullid
2856 elif fparent2 in fparentancestors: 2856 elif fparent2 in fparentancestors:
2857 fparent2 = nullid 2857 fparent2 = nullid
2858 elif not fparentancestors:
2859 # TODO: this whole if-else might be simplified much more
2860 ms = mergemod.mergestate.read(self)
2861 if (
2862 fname in ms
2863 and ms[fname] == mergemod.MERGE_RECORD_MERGED_OTHER
2864 ):
2865 fparent1, fparent2 = fparent2, nullid
2858 2866
2859 # is the file changed? 2867 # is the file changed?
2860 text = fctx.data() 2868 text = fctx.data()
2861 if fparent2 != nullid or flog.cmp(fparent1, text) or meta: 2869 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
2862 changelist.append(fname) 2870 changelist.append(fname)