[PATCH stable] branch: strip whitespace before testing known branch name
yuya at tcha.org
Fri May 10 11:07:40 CDT 2013
On Thu, 9 May 2013 14:58:43 -0500, Kevin Bullock wrote:
> On 7 May 2013, at 5:45 PM, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1367938143 -32400
> > # Tue May 07 23:49:03 2013 +0900
> > # Branch stable
> > # Node ID f42a6337cac2c3920fb7587797ada022c1141182
> > # Parent 0a12e5f3a979ee302dc10647483200df00a105ab
> > branch: strip whitespace before testing known branch name
> > Because dirstate._branch() strips leading/trailing spaces from .hg/branch,
> > "hg branch ' foo '" should abort if branch "foo" exists in another head.
> This should be done in scmutil.checknewlabel() if possible. It's already done
> for tags, and should apply to bookmarks as well.
It seems checknewlabel() is a bit different. checknewlabel() tests invalid
label, which is mandatory check. But in this case, it's valid to have multiple
branch heads of the same name.
This patch tries to address the following problem:
- "hg branch ' foo '" creates the branch "foo" on next commit.
- but it bypasses "label in repo.branchmap()", and thus doesn't abort even
if there exists the branch "foo" in another head.
More information about the Mercurial-devel