merge: do the trivial resolution after updating sparse checkout stable
authorPulkit Goyal <pulkit@yandex-team.ru>
Fri, 27 Jul 2018 14:56:10 +0300
branchstable
changeset 38757 d49e490a9e85
parent 38756 91c405f84cf7
child 38758 774f92710a81
merge: do the trivial resolution after updating sparse checkout In merge, we do trivial resolution for files which were deleted on one side and changed on other. When sparse extension in involved that file might not be present in wdir and trivial resolution can lead to file not found error. This patch make sure we updates the sparse checkout before doing the trivial resolution. This fixes the test failure demonstrated in previous patch. Differential Revision: https://phab.mercurial-scm.org/D3984
mercurial/merge.py
tests/test-sparse-merges.t
--- a/mercurial/merge.py	Fri Jul 27 14:53:28 2018 +0300
+++ b/mercurial/merge.py	Fri Jul 27 14:56:10 2018 +0300
@@ -1424,14 +1424,13 @@
                 del actions[f]
         repo.ui.note(_('end of auction\n\n'))
 
-    _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
-
     if wctx.rev() is None:
         fractions = _forgetremoved(wctx, mctx, branchmerge)
         actions.update(fractions)
 
     prunedactions = sparse.filterupdatesactions(repo, wctx, mctx, branchmerge,
                                                 actions)
+    _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
 
     return prunedactions, diverge, renamedelete
 
--- a/tests/test-sparse-merges.t	Fri Jul 27 14:53:28 2018 +0300
+++ b/tests/test-sparse-merges.t	Fri Jul 27 14:56:10 2018 +0300
@@ -112,5 +112,9 @@
   a
 
   $ hg merge
-  abort: $ENOENT$: '$TESTTMP/ytest/d'
-  [255]
+  temporarily included 1 file(s) in the sparse checkout for merging
+  local [working copy] changed d which other [merge rev] deleted
+  use (c)hanged version, (d)elete, or leave (u)nresolved? u
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
+  [1]