[Updated] D8974: merge: add `ACTION_KEEP_ABSENT` to represent files we want to keep absent
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Wed Sep 16 11:49:49 UTC 2020
Closed by commit rHGbb9888d32601: merge: add `ACTION_KEEP_ABSENT` to represent files we want to keep absent (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Revision".
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D8974?vs=22508&id=22650#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8974?vs=22508&id=22650
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8974/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8974
AFFECTED FILES
mercurial/merge.py
mercurial/mergestate.py
CHANGE DETAILS
diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -120,6 +120,10 @@
ACTION_LOCAL_DIR_RENAME_GET = b'dg'
ACTION_DIR_RENAME_MOVE_LOCAL = b'dm'
ACTION_KEEP = b'k'
+# the file was absent on local side before merge and we should
+# keep it absent (absent means file not present, it can be a result
+# of file deletion, rename etc.)
+ACTION_KEEP_ABSENT = b'ka'
ACTION_EXEC = b'e'
ACTION_CREATED_MERGE = b'cm'
@@ -837,6 +841,10 @@
for f, args, msg in actions.get(ACTION_KEEP, []):
pass
+ # keep deleted
+ for f, args, msg in actions.get(ACTION_KEEP_ABSENT, []):
+ pass
+
# get
for f, args, msg in actions.get(ACTION_GET, []):
if branchmerge:
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -563,7 +563,10 @@
It has information about what actions need to be performed on dirstate
mapping of divergent renames and other such cases. '''
- NO_OP_ACTIONS = (mergestatemod.ACTION_KEEP,)
+ NO_OP_ACTIONS = (
+ mergestatemod.ACTION_KEEP,
+ mergestatemod.ACTION_KEEP_ABSENT,
+ )
def __init__(self):
"""
@@ -1176,6 +1179,11 @@
repo.ui.note(_(b" %s: picking 'keep' action\n") % f)
mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP][0])
continue
+ # If keep absent is an option, just do that
+ if mergestatemod.ACTION_KEEP_ABSENT in bids:
+ repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f)
+ mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0])
+ continue
# If there are gets and they all agree [how could they not?], do it.
if mergestatemod.ACTION_GET in bids:
ga0 = bids[mergestatemod.ACTION_GET][0]
@@ -1530,6 +1538,11 @@
):
repo.ui.debug(b" %s: %s -> k\n" % (f, msg))
# no progress
+ for f, args, msg in mresult.getactions(
+ (mergestatemod.ACTION_KEEP_ABSENT,), sort=True
+ ):
+ repo.ui.debug(b" %s: %s -> ka\n" % (f, msg))
+ # no progress
# directory rename, move local
for f, args, msg in mresult.getactions(
To: pulkit, #hg-reviewers, marmoute
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200916/69fd87e0/attachment-0002.html>
More information about the Mercurial-patches
mailing list