changeset 36145:4f3e989536c3

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.
author Boris Feld <boris.feld@octobus.net>
date Mon, 12 Feb 2018 16:09:31 +0100
parents e84438846c27
children 29dd37a418aa
files mercurial/scmutil.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Feb 13 00:05:45 2018 +0100
+++ b/mercurial/scmutil.py	Mon Feb 12 16:09:31 2018 +0100
@@ -267,6 +267,8 @@
         raise error.Abort(_("cannot use an integer as a name"))
     except ValueError:
         pass
+    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 file'''