[PATCH] branch and tag subcommands don't accept colons in labels/names

Sune Foldager cryo at cyanite.org
Thu Nov 24 06:57:22 CST 2011


On 24-11-2011 13:29, Fabian Kreutz wrote:
> Added tests and longer commit message to the patch:
>
> # HG changeset patch
> # User fabian.kreutz at qvantel.com
> # Date 1322137649 -7200
> # Node ID d321f12b39293f766f1416cdc399ab0a0ee6e491
> # Parent  3e13ade423f08031045c2d5a2ef2a87a863a2614
> Disallow colon in tag or branch name
> Branch and tag names containing a colon (":") are not allowed as they would
> be confused with revision intervals.
> Subcommands branch and tag do not allow the creation of such labels anymore.

There is already some branch name verification going on in 
dirstate.setbranch():

     def setbranch(self, branch):
         if branch in ['tip', '.', 'null']:
             raise util.Abort(_('the name \'%s\' is reserved') % branch)
         self._branch = encoding.fromlocal(branch)
         self._opener.write("branch", self._branch + '\n')

...so maybe it should be put there instead. Also, I think we generally 
put an empty line between the summary and the rest of the commit 
message, and keep the summary lower-case.

Oh, and maybe:
 > # User Fabian Kreutz <fabian.kreutz at qvantel.com>

:p. Well, it's not important.

In general, I think we should be careful with adding new limitations to 
these things, since existing repos could already use them. We use '/' in 
branch names (where I work), for instance. Of course, if it's 
documented, it's another matter I guess.

/Sune


More information about the Mercurial-devel mailing list