Mercurial > hg
diff mercurial/sparse.py @ 45294:30f3e278c5d7
mergeactions: use action constants instead of string values
Having constants inplace of strings like 'c', 'cm' etc. makes it easier to
understand the code.
Differential Revision: https://phab.mercurial-scm.org/D8832
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 24 Jul 2020 23:40:07 +0530 |
parents | d70c972cec74 |
children | 6a8eafaeff3b |
line wrap: on
line diff
--- a/mercurial/sparse.py Sun Aug 02 10:24:28 2020 -0700 +++ b/mercurial/sparse.py Fri Jul 24 23:40:07 2020 +0530 @@ -395,17 +395,17 @@ files.add(file) if sparsematch(file): prunedactions[file] = action - elif type == b'm': + elif type == mergestatemod.ACTION_MERGE: temporaryfiles.append(file) prunedactions[file] = action elif branchmerge: - if type != b'k': + if type != mergestatemod.ACTION_KEEP: temporaryfiles.append(file) prunedactions[file] = action - elif type == b'f': + elif type == mergestatemod.ACTION_FORGET: prunedactions[file] = action elif file in wctx: - prunedactions[file] = (b'r', args, msg) + prunedactions[file] = (mergestatemod.ACTION_REMOVE, args, msg) if branchmerge and type == mergestatemod.ACTION_MERGE: f1, f2, fa, move, anc = args @@ -432,7 +432,7 @@ actions.append((file, (fctx.flags(), False), message)) typeactions = mergemod.emptyactions() - typeactions[b'g'] = actions + typeactions[mergestatemod.ACTION_GET] = actions mergemod.applyupdates( repo, typeactions, repo[None], repo[b'.'], False, wantfiledata=False ) @@ -453,9 +453,13 @@ new = sparsematch(file) if not old and new: flags = mf.flags(file) - prunedactions[file] = (b'g', (flags, False), b'') + prunedactions[file] = ( + mergestatemod.ACTION_GET, + (flags, False), + b'', + ) elif old and not new: - prunedactions[file] = (b'r', [], b'') + prunedactions[file] = (mergestatemod.ACTION_REMOVE, [], b'') mresult.setactions(prunedactions)