mercurial/commands.py
changeset 1561 9c6d0abdb94e
parent 1560 6efad1cc07de
child 1565 4bcbc126b80b
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2002,8 +2002,10 @@ def tag(ui, repo, name, rev=None, **opts
     else:
         r = hex(repo.changelog.tip())
 
-    if name.find(revrangesep) >= 0:
-        raise util.Abort(_("'%s' cannot be used in a tag name") % revrangesep)
+    disallowed = (revrangesep, '\r', '\n')
+    for c in disallowed:
+        if name.find(c) >= 0:
+            raise util.Abort(_("%s cannot be used in a tag name") % repr(c))
 
     if opts['local']:
         repo.opener("localtags", "a").write("%s %s\n" % (r, name))