Mercurial > hg
changeset 45279:f4a2b329717b
merge: move conversion of file-key dict to action-key dict in mergeresult
Initially the actions dict which we get has file has keys, but later we want a
dict which has actions as keys. This patch moves code computing that to
mergeresult class as that's where it should be anyway.
Differential Revision: https://phab.mercurial-scm.org/D8817
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 24 Jul 2020 14:45:00 +0530 |
parents | 0c849f0166c2 |
children | 98218c83242f |
files | mercurial/merge.py |
diffstat | 1 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Sun Aug 02 10:12:21 2020 -0700 +++ b/mercurial/merge.py Fri Jul 24 14:45:00 2020 +0530 @@ -578,6 +578,19 @@ def commitinfo(self): return self._commitinfo + @property + def actionsdict(self): + """ returns a dictionary of actions to be perfomed with action as key + and a list of files and related arguments as values """ + # Convert to dictionary-of-lists format + actions = emptyactions() + for f, (m, args, msg) in pycompat.iteritems(self._actions): + if m not in actions: + actions[m] = [] + actions[m].append((f, args, msg)) + + return actions + def setactions(self, actions): self._actions = actions @@ -1821,8 +1834,6 @@ mergeforce=mergeforce, ) - actionbyfile = mresult.actions - if updatecheck == UPDATECHECK_NO_CONFLICT: if mresult.hasconflicts(): msg = _(b"conflicting changes") @@ -1832,9 +1843,9 @@ # Prompt and create actions. Most of this is in the resolve phase # already, but we can't handle .hgsubstate in filemerge or # subrepoutil.submerge yet so we have to keep prompting for it. - if b'.hgsubstate' in actionbyfile: + if b'.hgsubstate' in mresult.actions: f = b'.hgsubstate' - m, args, msg = actionbyfile[f] + m, args, msg = mresult.actions[f] prompts = filemerge.partextras(labels) prompts[b'f'] = f if m == mergestatemod.ACTION_CHANGED_DELETED: @@ -1847,19 +1858,19 @@ % prompts, 0, ): - actionbyfile[f] = ( + mresult.actions[f] = ( mergestatemod.ACTION_REMOVE, None, b'prompt delete', ) elif f in p1: - actionbyfile[f] = ( + mresult.actions[f] = ( mergestatemod.ACTION_ADD_MODIFIED, None, b'prompt keep', ) else: - actionbyfile[f] = ( + mresult.actions[f] = ( mergestatemod.ACTION_ADD, None, b'prompt keep', @@ -1879,20 +1890,16 @@ ) == 0 ): - actionbyfile[f] = ( + mresult.actions[f] = ( mergestatemod.ACTION_GET, (flags, False), b'prompt recreating', ) else: - del actionbyfile[f] + del mresult.actions[f] # Convert to dictionary-of-lists format - actions = emptyactions() - for f, (m, args, msg) in pycompat.iteritems(actionbyfile): - if m not in actions: - actions[m] = [] - actions[m].append((f, args, msg)) + actions = mresult.actionsdict if not util.fscasesensitive(repo.path): # check collision between files only in p2 for clean update