[PATCH 1 of 3 rfc] push: report all remote heads

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Oct 25 11:30:49 CDT 2015



On 10/25/2015 04:19 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1445787757 -3600
> #      Sun Oct 25 16:42:37 2015 +0100
> # Branch stable
> # Node ID 576a0c463bf4d500c3a477220f865386fba1cf59
> # Parent  39dbf495880b8a439d912091109427d27a7e616a
> push: report all remote heads

-All- remote heads have already been flagged as problematic when -all- 
is a lot. We need some restrains to a sensible number here.


>
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -370,8 +370,13 @@ def checkheads(repo, remote, outgoing, r
>           if dhs:
>               if errormsg is None:
>                   if branch not in ('default', None):
> -                    errormsg = _("push creates new remote head %s "
> -                                 "on branch '%s'!") % (short(dhs[0]), branch)
> +                    if len(dhs) > 1:
> +                        errormsg = (_("push creates new remote heads %s "
> +                            "on branch '%s'!") %
> +                             (' '.join(short(h) for h in dhs), branch))
> +                    else:
> +                        errormsg = _("push creates new remote head %s "
> +                            "on branch '%s'!") % (short(dhs[0]), branch)
>                   elif repo[dhs[0]].bookmarks():
>                       errormsg = _("push creates new remote head %s "
>                                    "with bookmark '%s'!") % (
> diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t
> --- a/tests/test-push-warn.t
> +++ b/tests/test-push-warn.t
> @@ -281,7 +281,7 @@ Fail on multiple head push:
>     $ hg push -r 4 -r 7 ../f
>     pushing to ../f
>     searching for changes
> -  abort: push creates new remote head 0b715ef6ff8f on branch 'a'!
> +  abort: push creates new remote heads 0b715ef6ff8f bc938fcc7e44 on branch 'a'!
>     (merge or see "hg help push" for details about pushing new heads)
>     [255]
>
> @@ -518,7 +518,7 @@ Prepush -r should not allow you to sneak
>     $ hg push ../l -b b
>     pushing to ../l
>     searching for changes
> -  abort: push creates new remote head 451211cc22b0 on branch 'a'!
> +  abort: push creates new remote heads 451211cc22b0 e7e31d71180f on branch 'a'!
>     (merge or see "hg help push" for details about pushing new heads)
>     [255]
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list