Mercurial > hg-stable
changeset 45477:14b3dbfa4eeb
mergeresult: introduce dedicated tuple for no-op actions
This will help us in adding more no-op actions in next patch while keeping the
code cleaner.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 14 Sep 2020 13:51:39 +0530 |
parents | 9bd60ec60601 |
children | bb9888d32601 |
files | mercurial/merge.py mercurial/sparse.py |
diffstat | 2 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Jun 19 13:27:46 2020 +0200 +++ b/mercurial/merge.py Mon Sep 14 13:51:39 2020 +0530 @@ -523,7 +523,6 @@ narrowed. """ # TODO: handle with nonconflicttypes - nooptypes = {mergestatemod.ACTION_KEEP} nonconflicttypes = { mergestatemod.ACTION_ADD, mergestatemod.ACTION_ADD_MODIFIED, @@ -541,7 +540,7 @@ pass elif not branchmerge: mresult.removefile(f) # just updating, ignore changes outside clone - elif action[0] in nooptypes: + elif action[0] in mergeresult.NO_OP_ACTIONS: mresult.removefile(f) # merge does not affect file elif action[0] in nonconflicttypes: raise error.Abort( @@ -564,6 +563,8 @@ It has information about what actions need to be performed on dirstate mapping of divergent renames and other such cases. ''' + NO_OP_ACTIONS = (mergestatemod.ACTION_KEEP,) + def __init__(self): """ filemapping: dict of filename as keys and action related info as values @@ -711,12 +712,12 @@ a not in ( mergestatemod.ACTION_GET, - mergestatemod.ACTION_KEEP, mergestatemod.ACTION_EXEC, mergestatemod.ACTION_REMOVE, mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, ) and self._actionmapping[a] + and a not in self.NO_OP_ACTIONS ): return True @@ -1420,7 +1421,7 @@ wctx[f].audit() wctx[f].remove() - numupdates = mresult.len() - mresult.len((mergestatemod.ACTION_KEEP,)) + numupdates = mresult.len() - mresult.len(mergeresult.NO_OP_ACTIONS) progress = repo.ui.makeprogress( _(b'updating'), unit=_(b'files'), total=numupdates )
--- a/mercurial/sparse.py Fri Jun 19 13:27:46 2020 +0200 +++ b/mercurial/sparse.py Mon Sep 14 13:51:39 2020 +0530 @@ -399,7 +399,7 @@ temporaryfiles.append(file) prunedactions[file] = action elif branchmerge: - if type != mergestatemod.ACTION_KEEP: + if type not in mergemod.mergeresult.NO_OP_ACTIONS: temporaryfiles.append(file) prunedactions[file] = action elif type == mergestatemod.ACTION_FORGET: