Patchwork [1,of,5] scmutil: list kind in abort

login
register
mail settings
Submitter timeless@mozdev.org
Date Jan. 10, 2016, 6:57 p.m.
Message ID <81f7508339fc28775b31.1452452268@waste.org>
Download mbox | patch
Permalink /patch/12631/
State Changes Requested
Headers show

Comments

timeless@mozdev.org - Jan. 10, 2016, 6:57 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1451184347 0
#      Sun Dec 27 02:45:47 2015 +0000
# Node ID 81f7508339fc28775b31ab1724c88eda6d11e85e
# Parent  76fc5ac23473a25216f9cba2f977d1f56aa9df92
scmutil: list kind in abort
Yuya Nishihara - Jan. 11, 2016, 3:18 p.m.
On Sun, 10 Jan 2016 12:57:48 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1451184347 0
> #      Sun Dec 27 02:45:47 2015 +0000
> # Node ID 81f7508339fc28775b31ab1724c88eda6d11e85e
> # Parent  76fc5ac23473a25216f9cba2f977d1f56aa9df92
> scmutil: list kind in abort
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -143,10 +143,10 @@
>          raise error.Abort(_("the name '%s' is reserved") % lbl)
>      for c in (':', '\0', '\n', '\r'):
>          if c in lbl:
> -            raise error.Abort(_("%r cannot be used in a name") % c)
> +            raise error.Abort(_("%r cannot be used in a %s name") % (c, kind))
>      try:
>          int(lbl)
> -        raise error.Abort(_("cannot use an integer as a name"))
> +        raise error.Abort(_("cannot use an integer as a %s name") % kind)
>      except ValueError:
>          pass

It appears that someone already tried it and found an i18n issue.

    # Do not use the "kind" parameter in ui output.
    # It makes strings difficult to translate.

(I didn't read the other patches yet.)
timeless - Jan. 11, 2016, 3:29 p.m.
Yuya Nishihara wrote:
>> scmutil: list kind in abort
>> +        raise error.Abort(_("cannot use an integer as a %s name") % kind)
> It appears that someone already tried it and found an i18n issue.
>     # Do not use the "kind" parameter in ui output.
>     # It makes strings difficult to translate.

Sigh.
_(...) % _(kind) would have been more correct, except for
Gender and other fun stuff I suppose.

ok, I guess drop this one. It isn't worth chasing :(

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -143,10 +143,10 @@ 
         raise error.Abort(_("the name '%s' is reserved") % lbl)
     for c in (':', '\0', '\n', '\r'):
         if c in lbl:
-            raise error.Abort(_("%r cannot be used in a name") % c)
+            raise error.Abort(_("%r cannot be used in a %s name") % (c, kind))
     try:
         int(lbl)
-        raise error.Abort(_("cannot use an integer as a name"))
+        raise error.Abort(_("cannot use an integer as a %s name") % kind)
     except ValueError:
         pass
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -307,7 +307,7 @@ 
 bookmark with integer name
 
   $ hg bookmark 10
-  abort: cannot use an integer as a name
+  abort: cannot use an integer as a bookmark name
   [255]
 
 incompatible options
@@ -369,12 +369,12 @@ 
 invalid bookmark
 
   $ hg bookmark 'foo:bar'
-  abort: ':' cannot be used in a name
+  abort: ':' cannot be used in a bookmark name
   [255]
 
   $ hg bookmark 'foo
   > bar'
-  abort: '\n' cannot be used in a name
+  abort: '\n' cannot be used in a bookmark name
   [255]
 
 the bookmark extension should be ignored now that it is part of core
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -57,12 +57,12 @@ 
 invalid characters
 
   $ hg branch 'foo:bar'
-  abort: ':' cannot be used in a name
+  abort: ':' cannot be used in a branch name
   [255]
 
   $ hg branch 'foo
   > bar'
-  abort: '\n' cannot be used in a name
+  abort: '\n' cannot be used in a branch name
   [255]
 
 trailing or leading spaces should be stripped before testing duplicates
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -120,10 +120,10 @@ 
 
   $ hg tag -l 'xx
   > newline'
-  abort: '\n' cannot be used in a name
+  abort: '\n' cannot be used in a tag name
   [255]
   $ hg tag -l 'xx:xx'
-  abort: ':' cannot be used in a name
+  abort: ':' cannot be used in a tag name
   [255]
 
 cloning local tags