Patchwork discovery: if a push would create a new head, mention the bookmark name if any

login
register
mail settings
Submitter Stephen Lee
Date May 20, 2014, 11:52 a.m.
Message ID <d3e97c6056914731d9cb.1400586778@slee-desktop>
Download mbox | patch
Permalink /patch/4845/
State Accepted
Commit 32601b0b74c0bb0ad294c100f0675745c048453d
Headers show

Comments

Stephen Lee - May 20, 2014, 11:52 a.m.
# HG changeset patch
# User Stephen Lee <sphen.lee@gmail.com>
# Date 1394265759 -39600
#      Sat Mar 08 19:02:39 2014 +1100
# Node ID d3e97c6056914731d9cb4c3b2a863b8c5f734711
# Parent  d19164a018a175cda640066a1f32651834e4f011
discovery: if a push would create a new head, mention the bookmark name if any
Augie Fackler - May 26, 2014, 4:20 p.m.
On Tue, May 20, 2014 at 09:52:58PM +1000, Stephen Lee wrote:
> # HG changeset patch
> # User Stephen Lee <sphen.lee@gmail.com>
> # Date 1394265759 -39600
> #      Sat Mar 08 19:02:39 2014 +1100
> # Node ID d3e97c6056914731d9cb4c3b2a863b8c5f734711
> # Parent  d19164a018a175cda640066a1f32651834e4f011
> discovery: if a push would create a new head, mention the bookmark name if any

I like this. Anyone else want to comment?

(I've flagged this, and if I see no further comments after a couple
days I'll just queue it.)

>
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -341,6 +341,10 @@
>                  if branch not in ('default', None):
>                      error = _("push creates new remote head %s "
>                                "on branch '%s'!") % (short(dhs[0]), branch)
> +                elif repo[dhs[0]].bookmarks():
> +                    error = _("push creates new remote head %s "
> +                              "with bookmark '%s'!") % (
> +                              short(dhs[0]), repo[dhs[0]].bookmarks()[0])
>                  else:
>                      error = _("push creates new remote head %s!"
>                                ) % short(dhs[0])
> diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
> --- a/tests/test-bookmarks-pushpull.t
> +++ b/tests/test-bookmarks-pushpull.t
> @@ -274,7 +274,7 @@
>    $ hg push http://localhost:$HGPORT2/
>    pushing to http://localhost:$HGPORT2/
>    searching for changes
> -  abort: push creates new remote head c922c0139ca0!
> +  abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
>    (merge or see "hg help push" for details about pushing new heads)
>    [255]
>    $ hg -R ../a book
> @@ -290,7 +290,7 @@
>    $ hg push http://localhost:$HGPORT2/
>    pushing to http://localhost:$HGPORT2/
>    searching for changes
> -  abort: push creates new remote head c922c0139ca0!
> +  abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
>    (merge or see "hg help push" for details about pushing new heads)
>    [255]
>    $ hg -R ../a book
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - May 27, 2014, 10:49 p.m.
On Tue, 2014-05-20 at 21:52 +1000, Stephen Lee wrote:
> # HG changeset patch
> # User Stephen Lee <sphen.lee@gmail.com>
> # Date 1394265759 -39600
> #      Sat Mar 08 19:02:39 2014 +1100
> # Node ID d3e97c6056914731d9cb4c3b2a863b8c5f734711
> # Parent  d19164a018a175cda640066a1f32651834e4f011
> discovery: if a push would create a new head, mention the bookmark name if any

Queued for default, thanks.

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -341,6 +341,10 @@ 
                 if branch not in ('default', None):
                     error = _("push creates new remote head %s "
                               "on branch '%s'!") % (short(dhs[0]), branch)
+                elif repo[dhs[0]].bookmarks():
+                    error = _("push creates new remote head %s "
+                              "with bookmark '%s'!") % (
+                              short(dhs[0]), repo[dhs[0]].bookmarks()[0])
                 else:
                     error = _("push creates new remote head %s!"
                               ) % short(dhs[0])
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -274,7 +274,7 @@ 
   $ hg push http://localhost:$HGPORT2/
   pushing to http://localhost:$HGPORT2/
   searching for changes
-  abort: push creates new remote head c922c0139ca0!
+  abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
   (merge or see "hg help push" for details about pushing new heads)
   [255]
   $ hg -R ../a book
@@ -290,7 +290,7 @@ 
   $ hg push http://localhost:$HGPORT2/
   pushing to http://localhost:$HGPORT2/
   searching for changes
-  abort: push creates new remote head c922c0139ca0!
+  abort: push creates new remote head c922c0139ca0 with bookmark 'Y'!
   (merge or see "hg help push" for details about pushing new heads)
   [255]
   $ hg -R ../a book