[PATCH stable] scmutil: generalize message to make it more i18n-friendly

Adrian Buehlmann adrian at cadifra.com
Sun Oct 21 08:52:37 CDT 2012


On 2012-10-21 15:39, Wagner Bruna wrote:
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -27,13 +27,13 @@
>      else:
>          ui.status(_("no changes found\n"))
>  
> -def checknewlabel(repo, lbl, kind):
> +def checknewlabel(repo, lbl):
>      if lbl in ['tip', '.', 'null']:
>          raise util.Abort(_("the name '%s' is reserved") % lbl)
>      for c in (':', '\0', '\n', '\r'):
>          if c in lbl:
> -            raise util.Abort(_("%r cannot be used in a %s name") %
> -                               (c, kind))
> +            raise util.Abort(_("%r cannot be used in a tag, branch "
> +                               "or bookmark name") % c)
>  
>  def checkfilename(f):
>      '''Check that the filename f is an acceptable filename for a tracked file'''

I think I'd prefer it plain simple and 100% generic. Perhaps:

def checknewlabel(repo, lbl):
    if lbl in ['tip', '.', 'null']:
        raise util.Abort(_("the name '%s' is reserved") % lbl)
    for c in (':', '\0', '\n', '\r'):
        if c in lbl:
            raise util.Abort(_("%r cannot be used in name") % c)

Which would be consistent with the abort message about reserved names.


More information about the Mercurial-devel mailing list