changeset 38757:d49e490a9e85 stable

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
author Pulkit Goyal <pulkit@yandex-team.ru>
date Fri, 27 Jul 2018 14:56:10 +0300
parents 91c405f84cf7
children 774f92710a81
files mercurial/merge.py tests/test-sparse-merges.t
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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]