Patchwork [stable] tag: clarify warning about making a tag on a branch head

login
register
mail settings
Submitter Nathan Goldbaum
Date Oct. 31, 2016, 10:15 p.m.
Message ID <ec11aa398c707b524b7e.1477952158@rous.ncsa.illinois.edu>
Download mbox | patch
Permalink /patch/17231/
State Accepted
Headers show

Comments

Nathan Goldbaum - Oct. 31, 2016, 10:15 p.m.
# HG changeset patch
# User Nathan Goldbaum <ngoldbau@illinois.edu>
# Date 1477951952 18000
#      Mon Oct 31 17:12:32 2016 -0500
# Branch stable
# Node ID ec11aa398c707b524b7e15994b5bf74bba6bc119
# Parent  69ffbbe73dd03df0d1a00bdb2bc083fdb73ede09
tag: clarify warning about making a tag on a branch head

Currently the warning is ambiguous about whether the new tag (possibly specified
via --rev) is being added on a branch head or whether the working directory is
based on a branch head. Clarify the error message to eliminate this ambiguity.
Jun Wu - Nov. 1, 2016, 3:41 p.m.
This looks good to me.

Excerpts from Nathan Goldbaum's message of 2016-10-31 17:15:58 -0500:
> # HG changeset patch
> # User Nathan Goldbaum <ngoldbau@illinois.edu>
> # Date 1477951952 18000
> #      Mon Oct 31 17:12:32 2016 -0500
> # Branch stable
> # Node ID ec11aa398c707b524b7e15994b5bf74bba6bc119
> # Parent  69ffbbe73dd03df0d1a00bdb2bc083fdb73ede09
> tag: clarify warning about making a tag on a branch head
> 
> Currently the warning is ambiguous about whether the new tag (possibly specified
> via --rev) is being added on a branch head or whether the working directory is
> based on a branch head. Clarify the error message to eliminate this ambiguity.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -7077,7 +7077,8 @@ def tag(ui, repo, name1, *names, **opts)
>                  raise error.Abort(_('uncommitted merge'))
>              bheads = repo.branchheads()
>              if not opts.get('force') and bheads and p1 not in bheads:
> -                raise error.Abort(_('not at a branch head (use -f to force)'))
> +                raise error.Abort(_('working directory is not at a branch head '
> +                                    '(use -f to force)'))
>          r = scmutil.revsingle(repo, rev_).node()
>  
>          if not message:
> diff --git a/tests/test-tag.t b/tests/test-tag.t
> --- a/tests/test-tag.t
> +++ b/tests/test-tag.t
> @@ -109,7 +109,7 @@ tagging on a non-head revision
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    $ hg tag -l localblah
>    $ hg tag "foobar"
> -  abort: not at a branch head (use -f to force)
> +  abort: working directory is not at a branch head (use -f to force)
>    [255]
>    $ hg tag -f "foobar"
>    $ cat .hgtags
> @@ -339,7 +339,7 @@ tagging on null rev
>    $ hg up null
>    0 files updated, 0 files merged, 2 files removed, 0 files unresolved
>    $ hg tag nullrev
> -  abort: not at a branch head (use -f to force)
> +  abort: working directory is not at a branch head (use -f to force)
>    [255]
>  
>    $ hg init empty
Pierre-Yves David - Nov. 1, 2016, 4:02 p.m.
On 11/01/2016 04:41 PM, Jun Wu wrote:
> This looks good to me.

Pushed thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7077,7 +7077,8 @@  def tag(ui, repo, name1, *names, **opts)
                 raise error.Abort(_('uncommitted merge'))
             bheads = repo.branchheads()
             if not opts.get('force') and bheads and p1 not in bheads:
-                raise error.Abort(_('not at a branch head (use -f to force)'))
+                raise error.Abort(_('working directory is not at a branch head '
+                                    '(use -f to force)'))
         r = scmutil.revsingle(repo, rev_).node()
 
         if not message:
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -109,7 +109,7 @@  tagging on a non-head revision
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg tag -l localblah
   $ hg tag "foobar"
-  abort: not at a branch head (use -f to force)
+  abort: working directory is not at a branch head (use -f to force)
   [255]
   $ hg tag -f "foobar"
   $ cat .hgtags
@@ -339,7 +339,7 @@  tagging on null rev
   $ hg up null
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg tag nullrev
-  abort: not at a branch head (use -f to force)
+  abort: working directory is not at a branch head (use -f to force)
   [255]
 
   $ hg init empty