[Request] [+ ] D8940: merge: store ACTION_KEEP when we are keeping the file deleted locally

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Aug 24 14:14:54 UTC 2020


pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If a file is not present on the local side, and it's unchanged between other
  merge parent and ancestor, we don't use any action, neither we had a if-else
  branch for that condition.
  
  This leads to bid-merge missing that there is a such action possible which can
  be performed. As test changes demonstrate, we now choose the locally deleted
  side instead of choosing the remote one.
  
  This whole logic is not acurrate as we should prompt user on what to do
  when this kind of criss-cross merge is in play.
  
  This patch for now uses ACTION_KEEP, in future we might want to introduce a
  ACTION_KEEP_DELETED for such cases.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8940

AFFECTED FILES
  mercurial/merge.py
  tests/test-merge-criss-cross.t

CHANGE DETAILS

diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t
--- a/tests/test-merge-criss-cross.t
+++ b/tests/test-merge-criss-cross.t
@@ -542,8 +542,7 @@
   $ hg co 411bc7ca43bc -C
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge 9c9dbcbc1e03
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ ls
   bar
-  foo
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1019,6 +1019,13 @@
                         (None, f, f, False, pa.node()),
                         b'prompt deleted/changed',
                     )
+            else:
+                mresult.addfile(
+                    f,
+                    mergestatemod.ACTION_KEEP,
+                    None,
+                    'local deleted, remote unchanged',
+                )
 
     if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'):
         # If we are merging, look for path conflicts.



To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200824/a42e8db3/attachment.html>


More information about the Mercurial-patches mailing list