Mercurial > public > mercurial-scm > hg-stable
diff mercurial/narrowspec.py @ 45355:b9b055f15035
merge: pass mergeresult obj instead of actions in applyupdates() (API)
This is similar to past 20 patches or so where we are replacing use of a bare
actions dict with a dedicated mergeresult object. The goal is to have a
dedicated powerful object instead of a dict while making the code more easier to
understand.
In past few patches, we have already simplified the code at some places using
the newly introduced object.
This patch does not updates applyupdates() to use the mergeresult object
directly. That will be done in next patch to make things easier to review.
Differential Revision: https://phab.mercurial-scm.org/D8876
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 03 Aug 2020 14:12:13 +0530 |
parents | b7808443ed6a |
children | 77b8588dd84e |
line wrap: on
line diff
--- a/mercurial/narrowspec.py Mon Aug 03 13:30:14 2020 +0530 +++ b/mercurial/narrowspec.py Mon Aug 03 14:12:13 2020 +0530 @@ -272,15 +272,19 @@ def _writeaddedfiles(repo, pctx, files): - actions = merge.emptyactions() - addgaction = actions[mergestatemod.ACTION_GET].append + mresult = merge.mergeresult() mf = repo[b'.'].manifest() for f in files: if not repo.wvfs.exists(f): - addgaction((f, (mf.flags(f), False), b"narrowspec updated")) + mresult.addfile( + f, + mergestatemod.ACTION_GET, + (mf.flags(f), False), + b"narrowspec updated", + ) merge.applyupdates( repo, - actions, + mresult, wctx=repo[None], mctx=repo[b'.'], overwrite=False,