diff -r c6eb2118f44f -r 9db856446298 mercurial/sparse.py --- a/mercurial/sparse.py Tue Aug 21 15:09:22 2018 +0300 +++ b/mercurial/sparse.py Tue Aug 21 16:11:17 2018 +0300 @@ -361,6 +361,11 @@ elif file in wctx: prunedactions[file] = ('r', args, msg) + if branchmerge and type == mergemod.ACTION_MERGE: + f1, f2, fa, move, anc = args + if not sparsematch(f1): + temporaryfiles.append(f1) + if len(temporaryfiles) > 0: repo.ui.status(_('temporarily included %d file(s) in the sparse ' 'checkout for merging\n') % len(temporaryfiles))