Mercurial > hg
changeset 45284:31c454a5f1a8
merge: pass mergeresult in checkpassconflicts() instead of actions (API)
This is a part of series which aims to use mergeresult obj instead of an action
dictionary.
Differential Revision: https://phab.mercurial-scm.org/D8822
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 24 Jul 2020 17:31:26 +0530 |
parents | f1fb9a079131 |
children | e7196f1da2b1 |
files | mercurial/merge.py |
diffstat | 1 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Jul 24 16:23:55 2020 +0530 +++ b/mercurial/merge.py Fri Jul 24 17:31:26 2020 +0530 @@ -382,7 +382,7 @@ break -def checkpathconflicts(repo, wctx, mctx, actions): +def checkpathconflicts(repo, wctx, mctx, mresult): """ Check if any actions introduce path conflicts in the repository, updating actions to record or handle the path conflict accordingly. @@ -407,7 +407,7 @@ # The set of files deleted by all the actions. deletedfiles = set() - for f, (m, args, msg) in actions.items(): + for f, (m, args, msg) in mresult.actions.items(): if m in ( mergestatemod.ACTION_CREATED, mergestatemod.ACTION_DELETED_CHANGED, @@ -444,7 +444,7 @@ # A file is in a directory which aliases a local file. # We will need to rename the local file. localconflicts.add(p) - if p in actions and actions[p][0] in ( + if p in mresult.actions and mresult.actions[p][0] in ( mergestatemod.ACTION_CREATED, mergestatemod.ACTION_DELETED_CHANGED, mergestatemod.ACTION_MERGE, @@ -459,14 +459,16 @@ for p in localconflicts: if p not in deletedfiles: ctxname = bytes(wctx).rstrip(b'+') - pnew = util.safename(p, ctxname, wctx, set(actions.keys())) + pnew = util.safename(p, ctxname, wctx, set(mresult.actions.keys())) porig = wctx[p].copysource() or p - actions[pnew] = ( + mresult.addfile( + pnew, mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, (p, porig), b'local path conflict', ) - actions[p] = ( + mresult.addfile( + p, mergestatemod.ACTION_PATH_CONFLICT, (pnew, b'l'), b'path conflict', @@ -477,23 +479,27 @@ ctxname = bytes(mctx).rstrip(b'+') for f, p in _filesindirs(repo, mf, remoteconflicts): if f not in deletedfiles: - m, args, msg = actions[p] - pnew = util.safename(p, ctxname, wctx, set(actions.keys())) + m, args, msg = mresult.actions[p] + pnew = util.safename( + p, ctxname, wctx, set(mresult.actions.keys()) + ) if m in ( mergestatemod.ACTION_DELETED_CHANGED, mergestatemod.ACTION_MERGE, ): # Action was merge, just update target. - actions[pnew] = (m, args, msg) + mresult.addfile(pnew, m, args, msg) else: # Action was create, change to renamed get action. fl = args[0] - actions[pnew] = ( + mresult.addfile( + pnew, mergestatemod.ACTION_LOCAL_DIR_RENAME_GET, (p, fl), b'remote path conflict', ) - actions[p] = ( + mresult.addfile( + p, mergestatemod.ACTION_PATH_CONFLICT, (pnew, mergestatemod.ACTION_REMOVE), b'path conflict', @@ -939,7 +945,7 @@ if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'): # If we are merging, look for path conflicts. - checkpathconflicts(repo, wctx, p2, mresult.actions) + checkpathconflicts(repo, wctx, p2, mresult) narrowmatch = repo.narrowmatch() if not narrowmatch.always():