mercurial/scmutil.py
changeset 17821 361ab1e2086f
parent 17817 b17be267b59c
child 17845 408ded42c5ec
--- a/mercurial/scmutil.py	Wed Oct 17 21:39:07 2012 -0500
+++ b/mercurial/scmutil.py	Wed Oct 17 21:42:06 2012 -0500
@@ -27,9 +27,13 @@
     else:
         ui.status(_("no changes found\n"))
 
-def checknewlabel(repo, lbl):
+def checknewlabel(repo, lbl, kind):
     if lbl in ['tip', '.', 'null']:
         raise util.Abort(_("the name '%s' is reserved") % lbl)
+    for c in (':', '\0', '\n', '\r'):
+        if c in lbl:
+            raise util.Abort(_("%r cannot be used in a %s name") %
+                               (c, kind))
 
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked file'''