Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 48727:5dfaca4464d1
merge-actions: add an explicite "no_op" attribute
This make the MergeAction smarter and able to describe themself. This is useful
to help introducing more MergeAction object that better the complexity of the
situation.
Differential Revision: https://phab.mercurial-scm.org/D12116
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 28 Jan 2022 15:19:58 +0100 |
parents | 9bc86adf32f6 |
children | c5f05c0d1c8c |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Jan 28 19:46:37 2022 +0100 +++ b/mercurial/merge.py Fri Jan 28 15:19:58 2022 +0100 @@ -527,7 +527,7 @@ pass elif not branchmerge: mresult.removefile(f) # just updating, ignore changes outside clone - elif action[0] in mergestatemod.NO_OP_ACTIONS: + elif action[0].no_op: mresult.removefile(f) # merge does not affect file elif action[0] in nonconflicttypes: msg = _( @@ -699,7 +699,7 @@ mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, ) and self._actionmapping[a] - and a not in mergestatemod.NO_OP_ACTIONS + and not a.no_op ): return True @@ -1520,7 +1520,8 @@ # mergestate so that it can be reused on commit ms.addcommitinfo(f, op) - numupdates = mresult.len() - mresult.len(mergestatemod.NO_OP_ACTIONS) + num_no_op = mresult.len(mergestatemod.MergeAction.NO_OP_ACTIONS) + numupdates = mresult.len() - num_no_op progress = repo.ui.makeprogress( _(b'updating'), unit=_(b'files'), total=numupdates ) @@ -1624,7 +1625,7 @@ progress.increment(item=f) # keep (noop, just log it) - for a in mergestatemod.NO_OP_ACTIONS: + for a in mergestatemod.MergeAction.NO_OP_ACTIONS: for f, args, msg in mresult.getactions((a,), sort=True): repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a.__bytes__())) # no progress