[Updated] D8828: sparse: pass mergeresult obj in sparse.filterupdatesactions() (API)

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sun Aug 2 17:46:18 UTC 2020


Closed by commit rHGd70c972cec74: sparse: pass mergeresult obj in sparse.filterupdatesactions() (API) (authored by pulkit).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8828?vs=22112&id=22211

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8828/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8828

AFFECTED FILES
  mercurial/merge.py
  mercurial/sparse.py

CHANGE DETAILS

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -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):
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1130,10 +1130,7 @@
         fractions = _forgetremoved(wctx, mctx, branchmerge)
         mresult.updateactions(fractions)
 
-    prunedactions = sparse.filterupdatesactions(
-        repo, wctx, mctx, branchmerge, mresult.actions
-    )
-    mresult.setactions(prunedactions)
+    sparse.filterupdatesactions(repo, wctx, mctx, branchmerge, mresult)
     _resolvetrivial(repo, wctx, mctx, ancestors[0], mresult)
 
     return mresult



To: pulkit, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200802/de87adb1/attachment-0002.html>


More information about the Mercurial-patches mailing list