# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1600071699 -19800 # Node ID 14b3dbfa4eebdd9a082a3c8be724426422ed0cec # Parent 9bd60ec60601dabbc411f8acf2d9919e9280f0a4 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. diff -r 9bd60ec60601 -r 14b3dbfa4eeb mercurial/merge.py --- 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 ) diff -r 9bd60ec60601 -r 14b3dbfa4eeb mercurial/sparse.py --- 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: