Patchwork D8940: merge: store ACTION_KEEP when we are keeping the file deleted locally

login
register
mail settings
Submitter phabricator
Date Aug. 24, 2020, 2:14 p.m.
Message ID <differential-rev-PHID-DREV-ajosnrutxrkovo7gptfu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47040/
State Superseded
Headers show

Comments

phabricator - Aug. 24, 2020, 2:14 p.m.
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




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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.