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

Matt Mackall mpm at selenic.com
Sun Oct 21 17:04:39 CDT 2012


On Sun, 2012-10-21 at 15:52 +0200, Adrian Buehlmann wrote:
> 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.

I think the terminology we should use for the set {bookmark, branch,
tag} is 'label' (note the function name). But I agree that we don't need
to expose a term here, as the kind of label is implicit.

I also don't think we should take the 'kind' out of the argument list
because we'll very likely add some type-specific checks, exceptions, or
warnings here.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list