mq: use %r to format illegal characters instead of manually quoting
authorAugie Fackler <augie@google.com>
Fri, 05 Jun 2015 14:31:52 -0400
changeset 25453 d3a00fc3680f
parent 25452 43906060a3f4
child 25454 b5a8bc09b0db
mq: use %r to format illegal characters instead of manually quoting This will make it easier to ban \r and \n in the next patch and still have a sensible error message.
hgext/mq.py
tests/test-mq-qnew.t
--- a/hgext/mq.py	Fri Jun 05 15:20:33 2015 -0400
+++ b/hgext/mq.py	Fri Jun 05 14:31:52 2015 -0400
@@ -1104,7 +1104,7 @@
                                  % prefix)
         for c in ('#', ':'):
             if c in name:
-                raise util.Abort(_('"%s" cannot be used in the name of a patch')
+                raise util.Abort(_('%r cannot be used in the name of a patch')
                                  % c)
 
     def checkpatchname(self, name, force=False):
--- a/tests/test-mq-qnew.t	Fri Jun 05 15:20:33 2015 -0400
+++ b/tests/test-mq-qnew.t	Fri Jun 05 14:31:52 2015 -0400
@@ -108,8 +108,8 @@
   abort: ".." cannot be used as the name of a patch
   abort: patch name cannot begin with ".hg"
   abort: patch name cannot begin with ".mq"
-  abort: "#" cannot be used in the name of a patch
-  abort: ":" cannot be used in the name of a patch
+  abort: '#' cannot be used in the name of a patch
+  abort: ':' cannot be used in the name of a patch
   % qnew with name containing slash
   abort: path ends in directory separator: foo/ (glob)
   abort: "foo" already exists as a directory
@@ -176,8 +176,8 @@
   abort: ".." cannot be used as the name of a patch
   abort: patch name cannot begin with ".hg"
   abort: patch name cannot begin with ".mq"
-  abort: "#" cannot be used in the name of a patch
-  abort: ":" cannot be used in the name of a patch
+  abort: '#' cannot be used in the name of a patch
+  abort: ':' cannot be used in the name of a patch
   % qnew with name containing slash
   abort: path ends in directory separator: foo/ (glob)
   abort: "foo" already exists as a directory