diff --git a/hgext3rd/fbsparse.py b/hgext3rd/fbsparse.py --- a/hgext3rd/fbsparse.py +++ b/hgext3rd/fbsparse.py @@ -79,7 +79,10 @@ actions, diverge, renamedelete = orig(repo, wctx, mctx, ancestors, branchmerge, *arg, **kwargs) - if not util.safehasattr(repo, 'sparsematch'): + # If the working context is inmemory (virtual), there's no need to apply + # the user's sparse rules at all (and in fact doing so would cause + # unexpected behavior in the real working copy). + if not util.safehasattr(repo, 'sparsematch') or wctx.isinmemory(): return actions, diverge, renamedelete files = set() diff --git a/hgext3rd/sparse.py b/hgext3rd/sparse.py --- a/hgext3rd/sparse.py +++ b/hgext3rd/sparse.py @@ -92,7 +92,10 @@ actions, diverge, renamedelete = orig(repo, wctx, mctx, ancestors, branchmerge, *arg, **kwargs) - if not util.safehasattr(repo, 'sparsematch'): + # If the working context is inmemory (virtual), there's no need to apply + # the user's sparse rules at all (and in fact doing so would cause + # unexpected behavior in the real working copy). + if not util.safehasattr(repo, 'sparsematch') or wctx.isinmemory(): return actions, diverge, renamedelete files = set()