Mercurial > hg
diff mercurial/sparse.py @ 45290:d70c972cec74
sparse: pass mergeresult obj in sparse.filterupdatesactions() (API)
Not able to see much which can be improved in this function by passing in
mergeresult object but for API consistency and no function directly touching
actions dict, it sounds like a good idea.
Differential Revision: https://phab.mercurial-scm.org/D8828
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 24 Jul 2020 19:19:47 +0530 |
parents | a03c177a4679 |
children | 30f3e278c5d7 |
line wrap: on
line diff
--- a/mercurial/sparse.py Fri Jul 24 19:13:20 2020 +0530 +++ b/mercurial/sparse.py Fri Jul 24 19:19:47 2020 +0530 @@ -366,16 +366,16 @@ return result -def filterupdatesactions(repo, wctx, mctx, branchmerge, actions): +def filterupdatesactions(repo, wctx, mctx, branchmerge, mresult): """Filter updates to only lay out files that match the sparse rules.""" if not enabled: - return actions + return oldrevs = [pctx.rev() for pctx in wctx.parents()] oldsparsematch = matcher(repo, oldrevs) if oldsparsematch.always(): - return actions + return files = set() prunedactions = {} @@ -390,7 +390,7 @@ sparsematch = matcher(repo, [mctx.rev()]) temporaryfiles = [] - for file, action in pycompat.iteritems(actions): + for file, action in pycompat.iteritems(mresult.actions): type, args, msg = action files.add(file) if sparsematch(file): @@ -457,7 +457,7 @@ elif old and not new: prunedactions[file] = (b'r', [], b'') - return prunedactions + mresult.setactions(prunedactions) def refreshwdir(repo, origstatus, origsparsematch, force=False):