[PATCH 3 of 4] merge: get the default update destination from the function

Augie Fackler raf at durin42.com
Thu Oct 8 12:33:44 CDT 2015


On Wed, Oct 07, 2015 at 12:02:23PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1443503483 25200
> #      Mon Sep 28 22:11:23 2015 -0700
> # Node ID 224f781d36bdfa50e8db7a3e02d5398848a88b20
> # Parent  cb49c9ec614d20e21bc5affae1439a8abe727f5e
> merge: get the default update destination from the function
>
> There is no value in using the revset instead of the extracted function.
>

it seems there was: you just introduced an import cycle that you're
kludging around. Is it that important?

>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -992,13 +992,12 @@ def update(repo, node, branchmerge, forc
>          pas = [None]
>          if ancestor is not None:
>              pas = [repo[ancestor]]
>
>          if node is None:
> -            nodes = list(repo.set('_updatedefaultdest()'))
> -            if nodes:
> -                node = nodes[0].node()
> +            from .scmutil import destupdate # avoid cycle
> +            node = repo[destupdate(repo)].node()
>
>          overwrite = force and not branchmerge
>
>          p2 = repo[node]
>          if pas[0] is None:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list