[PATCH 1 of 3 v2] merge: refactor action calculation into function

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Nov 28 15:49:26 CST 2012


On Nov 27, 2012, at 5:36 PM, David Schleimer wrote:

> # HG changeset patch
> # User David Schleimer <dschleimer at fb.com>
> # Date 1354058840 28800
> # Node ID 11dc529474d3d0fb1cd3a43048c9d8864cdccd13
> # Parent  50cbeeb7973a24f2ff2380582936b2b2844d35fb
> merge: refactor action calculation into function
> 
> This pulls the code used to calculate the changes that need to happen
> during merge.update() into a separate function.  This is not useful on
> it's own, but is instead preparatory to performing grafts in memory

  its [bad grammar makes me [sic]]

> when there are no potential conflicts.
> 
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -448,6 +448,26 @@
> 
>     return updated, merged, removed, unresolved
> 
> +def calculateupdates(repo, tctx, mctx, ancestor, branchmerge, force, partial):
> +    "Calculate the actions needed to merge mctx into tctx"

The names mctx and tctx are totally opaque to me. The docstring would be the ideal place to explain them.

Alternatively, since you're just calling down to manifestmerge anyway, why not stick to its argument naming (p1, p2, pa)?

> @@ -608,20 +628,7 @@
>                 # Allow jumping branches if clean and specific rev given
>                 pa = p1
> 
> -        ### calculate phase

Nit: I'd leave this comment in.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list