Patchwork [1,of,2,issue4711] mq: use %r to format illegal characters instead of manually quoting

login
register
mail settings
Submitter Augie Fackler
Date June 5, 2015, 6:44 p.m.
Message ID <382ae2f4b576568a1542.1433529880@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/9525/
State Accepted
Headers show

Comments

Augie Fackler - June 5, 2015, 6:44 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1433529112 14400
#      Fri Jun 05 14:31:52 2015 -0400
# Node ID 382ae2f4b576568a1542944565b1f3f3db9dae53
# Parent  a459d4e026c817bc0702470cd99bc06b40ac956e
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.

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1104,7 +1104,7 @@  class queue(object):
                                  % 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):
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -108,8 +108,8 @@  plain headers
   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 @@  hg headers
   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