[PATCH 6 of 9] bookmarks: use scmutil.checknewlabel

dsp at php.net dsp at php.net
Thu Oct 18 08:25:06 CDT 2012


On 10/18/2012 05:31 AM, Kevin Bullock wrote:
> # HG changeset patch
> # User Kevin Bullock <kbullock at ringworld.org>
> # Date 1350512619 18000
> # Node ID e4083c2811721ad7f408b9540c325e4b97d38ecf
> # Parent  614653e8d2896effe42c94c196f2de9a1b333a5f
> bookmarks: use scmutil.checknewlabel

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -794,6 +794,11 @@ def bookmark(ui, repo, mark=None, rev=No
>          if not mark:
>              raise util.Abort(_("bookmark names cannot consist entirely of "
>                                 "whitespace"))
> +        for c in (':', '\0', '\n', '\r'):
> +            if c in mark:
> +                raise util.Abort(_("bookmark '%s' contains illegal "
> +                    "character" % mark))
> +        scmutil.checknewlabel(repo, mark)Just as a remark:

moving this check to the bookmark command will allow users to push
invalid bookmarks to a remote repository. I am not sure if we really
want that. But then, the same goes for tags already, you can create a
tag manually in the .hgtags file and happily push (afaik).

ps.: resend as the first mail went just to kevin


More information about the Mercurial-devel mailing list