[PATCH 3 of 6] merge: split move-merge into two actions
Mads Kiilerich
mads at kiilerich.com
Wed Dec 3 21:56:31 CST 2014
On 12/03/2014 06:17 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1416786380 28800
> # Sun Nov 23 15:46:20 2014 -0800
> # Node ID d7c59ced01f5bc3ddc34c3b597b8915740ed79c0
> # Parent 17f0fda2398ba2463589a3a59efe78b095b5d593
> merge: split move-merge into two actions
>
> The merge action for merges ('m') carries a 'move' argument, which
> tells whether to also remove the copy source. The code can be
> simplified by removing that action argument and producing a second
> action for the removal instead. Since the removal doesn't behave
> exactly like an 'r' action (specifically, it doesn't count as
> 'removed' file in the stats), we need to create new type of action.
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -343,8 +343,9 @@
> for m in 'a', 'f', 'g', 'cd', 'dc':
> for f, args, msg in actions[m]:
> pmmf.add(f)
> - for f, args, msg in actions['r']:
> - pmmf.discard(f)
> + for m in 'r', 'rm':
I would expect () around the tuple here. But well ... it seems to work
without it. But still ...
I would perhaps prefer actions['r']+actions['m'] in the next line ...
(and same pattern in later patches)
but perhaps not ...
> + for f, args, msg in actions[m]:
> + pmmf.discard(f)
> for f, args, msg in actions['dm']:
> f2, flags = args
> pmmf.discard(f2)
> @@ -352,9 +353,6 @@
> for f, args, msg in actions['dg']:
> pmmf.add(f)
> for f, args, msg in actions['m']:
> - f1, f2, fa, move, anc = args
> - if move:
> - pmmf.discard(f1)
> pmmf.add(f)
>
> # check case-folding collision in provisional merged manifest
> @@ -376,7 +374,8 @@
> acceptremote = accept the incoming changes without prompting
> """
>
> - actions = dict((m, []) for m in 'a f g cd dc r dm dg m dr e rd k'.split())
> + actions = dict((m, []) for m in
> + 'a f g cd dc r rm dm dg m dr e rd k'.split())
I wonder if this should be turned into a named dict too ;-)
/Mads
More information about the Mercurial-devel
mailing list