[PATCH STABLE] only check for valid label on branch creation
Pierre-Yves David
pierre-yves.david at logilab.fr
Tue Nov 27 09:34:00 CST 2012
On Tue, Nov 27, 2012 at 10:26:02AM -0500, Tim Henigan wrote:
> # HG changeset patch
> # User Tim Henigan <tim.henigan at gmail.com>
> # Date 1354024055 18000
> # Branch stable
> # Node ID 571502912c98ed33ad70b153ad5a3b2f65eecdfa
> # Parent 54cedee86e5126188b0dcfbd7015bcdca7f6c2e2
> only check for valid label on branch creation
>
> Starting with 361ab1e2086f, users are no longer able to update a
> working copy to a branch named with a "bad" character (such as ':').
>
> Prior to v2.4, it was possible to create branch names using "bad"
> characters, so this breaks backwards compatibility.
>
> Mercurial must allow users to update to existing branches with bad
> names. However, it should continue to prevent the creation of new
> branches with bad names.
>
> The original problem was reported in (issue3710).
This description is pretty nice overall. But there is still a few "issue":
According http://mercurial.selenic.com/wiki/ContributingChanges#Patch_descriptions
You should add a topic to your first line. And the (issue3710) is usually put
in the summary line
The result would looks like this:
branch: allows update to legacy branch with invalide name (issue3710)
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -924,6 +924,7 @@
> ' exists'),
> # i18n: "it" refers to an existing branch
> hint=_("use 'hg update' to switch to it"))
> + scmutil.checknewlabel(None, label, 'branch')
> repo.dirstate.setbranch(label)
> ui.status(_('marked working directory as branch %s\n') % label)
> ui.status(_('(branches are permanent and global, '
> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
> --- a/mercurial/dirstate.py
> +++ b/mercurial/dirstate.py
> @@ -261,7 +261,6 @@
>
> def setbranch(self, branch):
> # no repo object here, just check for reserved names
> - scmutil.checknewlabel(None, branch, 'branch')
> self._branch = encoding.fromlocal(branch)
> f = self._opener('branch', 'w', atomictemp=True)
> try:
The patch looks good but you could maybe add a test that check this.
--
Pierre-Yves David
http://www.logilab.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121127/ba424f5a/attachment.pgp>
More information about the Mercurial-devel
mailing list