Commit bf27967e authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

merge: store cases when a file is absent post merge in commitinfo

Some merges can result in file being absent form working directory. This can be
one of file was kept deleted or file was removed by merge code.

User might revert the file back before committing. In such cases we will like to
have better handling and create new filenodes.

We store this info in mergestate as commitinfo so that we can use it while
committing to create new filenode if required.

Differential Revision: https://phab.mercurial-scm.org/D9003
parent 7d9a56694564
Pipeline #10748 failed with stage
in 22 minutes and 27 seconds
......@@ -923,6 +923,15 @@
mresult.addfile(
f, mergestatemod.ACTION_REMOVE, None, b'other deleted',
)
if branchmerge:
# the file must be absent after merging,
# howeber the user might make
# the file reappear using revert and if they does,
# we force create a new node
mresult.addcommitinfo(
f, b'merge-removal-candidate', b'yes'
)
else: # file not in ancestor, not in remote
mresult.addfile(
f,
......@@ -1033,6 +1042,12 @@
None,
b'local not present, remote unchanged',
)
if branchmerge:
# the file must be absent after merging
# however the user might make
# the file reappear using revert and if they does,
# we force create a new node
mresult.addcommitinfo(f, b'merge-removal-candidate', b'yes')
if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'):
# If we are merging, look for path conflicts.
......
......@@ -682,7 +682,9 @@
extra: the-file (merge-removal-candidate = yes)
#else
$ hg debugmergestate
no merge state found
local (working copy): adfd88e5d7d3d3e22bdd26512991ee64d59c1d8f
other (merge rev): e9b7081317232edce73f7ad5ae0b7807ff5c326a
extra: the-file (merge-removal-candidate = yes)
#endif
(merging a deletion with keeping → conflict)
......@@ -697,7 +699,9 @@
$ ls -1
other-file
$ hg debugmergestate
no merge state found
local (working copy): adfd88e5d7d3d3e22bdd26512991ee64d59c1d8f
other (merge rev): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
extra: the-file (merge-removal-candidate = yes)
(merging two deletion together no conflict)
......@@ -730,7 +734,9 @@
extra: the-file (merge-removal-candidate = yes)
#else
$ hg debugmergestate
no merge state found
local (working copy): a4e0e44229dc130be2915b92c957c093f8c7ee3e
other (merge rev): e9b7081317232edce73f7ad5ae0b7807ff5c326a
extra: the-file (merge-removal-candidate = yes)
#endif
(merging a deletion with keeping conflict)
......@@ -745,7 +751,9 @@
$ ls -1
other-file
$ hg debugmergestate
no merge state found
local (working copy): a4e0e44229dc130be2915b92c957c093f8c7ee3e
other (merge rev): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
extra: the-file (merge-removal-candidate = yes)
(merging two "keeping" together → no conflict)
......@@ -795,7 +803,9 @@
other-file
the-file
$ hg debugmergestate
no merge state found
local (working copy): 5e3eccec60d88f94a7ba57c351f32cb24c15fe0c
other (merge rev): a4e0e44229dc130be2915b92c957c093f8c7ee3e
extra: the-file (merge-removal-candidate = yes)
(merging two "keeping" together → no conflict)
......@@ -843,5 +853,7 @@
extra: the-file (merge-removal-candidate = yes)
#else
$ hg debugmergestate
no merge state found
local (working copy): e9b7081317232edce73f7ad5ae0b7807ff5c326a
other (merge rev): a4e0e44229dc130be2915b92c957c093f8c7ee3e
extra: the-file (merge-removal-candidate = yes)
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment