[Updated] [+- ] D8941: merge: add missing ACTION_KEEP when both remote and ancestor are not present

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Thu Aug 27 09:38:45 UTC 2020


pulkit updated this revision to Diff 22474.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8941?vs=22432&id=22474

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8941/new/

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

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
@@ -413,6 +413,8 @@
   resolving manifests
    branchmerge: True, force: False, partial: False
    ancestor: 11b5b303e36c, local: c0ef19750a22+, remote: 6ca01f7342b9
+   d1/a: ancestor missing, remote missing -> k
+   d1/b: ancestor missing, remote missing -> k
    d2/b: remote created -> g
   
   calculating bids for ancestor 154e6000f54e
@@ -431,18 +433,16 @@
    d2/b: remote created -> g
   
   auction for merging merge bids
-   d1/a: consensus for r
-   d1/b: consensus for r
+   d1/a: picking 'keep' action
+   d1/b: picking 'keep' action
    d2/b: consensus for g
   end of auction
   
-   d1/a: other deleted -> r
-  removing d1/a
-   d1/b: other deleted -> r
-  removing d1/b
    d2/b: remote created -> g
   getting d2/b
-  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+   d1/a: ancestor missing, remote missing -> k
+   d1/b: ancestor missing, remote missing -> k
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
 
@@ -624,15 +624,16 @@
   $ hg update --clean 'desc("merge-keeping-the-file-from-updated")'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge          'desc("merge-deleting-the-file-from-updated")'
-  0 files updated, 0 files merged, 1 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 -1
   other-file
+  the-file
 
 (merging two "keeping" together → no conflict)
 
   $ hg update --clean 'desc("merge-keeping-the-file-from-deleted")'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge          'desc("merge-keeping-the-file-from-updated")'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
@@ -658,7 +659,8 @@
   $ hg update --clean 'desc("merge-keeping-the-file-from-deleted")'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge          'desc("merge-deleting-the-file-from-updated")'
-  0 files updated, 0 files merged, 1 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 -1
   other-file
+  the-file
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -928,6 +928,14 @@
                     mresult.addfile(
                         f, mergestatemod.ACTION_REMOVE, None, b'other deleted',
                     )
+            else:  # file not in ancestor, not in remote
+                mresult.addfile(
+                    f,
+                    mergestatemod.ACTION_KEEP,
+                    None,
+                    b'ancestor missing, remote missing',
+                )
+
         elif n2:  # file exists only on remote side
             if f in copied1:
                 pass  # we'll deal with it on m1 side



To: pulkit, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200827/2502111c/attachment-0002.html>


More information about the Mercurial-patches mailing list