# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1518448171 -3600
#      Mon Feb 12 16:09:31 2018 +0100
# Node ID f02fd7ca256d044c4a51c3f3fc0ecaf95d23e03d
# Parent  80e5210df25c330bd2a4e8f12385422545cb69bf
# EXP-Topic noname
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
label: enforce the lack of leading or trailing white space

In practice, all commands create label are currently striping external white
space. Let us enforce this logic at a lower level before starting to rely on
it elsewhere.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -267,6 +267,8 @@ def checknewlabel(repo, lbl, kind):
         raise error.Abort(_("cannot use an integer as a name"))
     except ValueError:
+    if lbl.strip() != lbl:
+        raise error.Abort(_("leading or trailing whitespace in name %r") % lbl)
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked 
Mercurial-devel mailing list

Reply via email to