# HG changeset patch # User Pulkit Goyal # Date 1532692570 -10800 # Node ID d49e490a9e85252886fd43258803bcad4fc88edb # Parent 91c405f84cf73334f8cc033988d0bb43c0daba6a 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 diff -r 91c405f84cf7 -r d49e490a9e85 mercurial/merge.py --- 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 diff -r 91c405f84cf7 -r d49e490a9e85 tests/test-sparse-merges.t --- 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]