Rev 4790: (bialix) Don't use ' as a quoting character in the new win32 parser. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sun Nov 8 01:16:26 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4790 [merge]
revision-id: pqm at pqm.ubuntu.com-20091108011625-5u4zuh77zbj10wz4
parent: pqm at pqm.ubuntu.com-20091106084512-t5ll6xywcd1bycfe
parent: bialix at ukr.net-20091106100010-f8zvmj0qkw7usqd4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2009-11-08 01:16:25 +0000
message:
(bialix) Don't use ' as a quoting character in the new win32 parser.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_win32utils.py test_win32utils.py-20070713181630-8xsrjymd3e8mgw23-108
bzrlib/win32utils.py win32console.py-20051021033308-123c6c929d04973d
=== modified file 'NEWS'
--- a/NEWS 2009-11-05 20:08:36 +0000
+++ b/NEWS 2009-11-06 10:00:10 +0000
@@ -28,8 +28,7 @@
done in bash, etc.) This means that *all* commands get glob expansion
(bzr status, bzr add, bzr mv, etc). It uses a custom command line
parser, which allows us to know if a given section was quoted. It means
- you can now do ``bzr ignore "*.py"``. It also means that single-quotes
- are now treated as quoted ``bzr ignore '*.py'``.
+ you can now do ``bzr ignore "*.py"``.
(John Arbash Meinel, #425510, #426410, #194450)
* Sanitize commit messages that come in from the '-m' flag. We translate
=== modified file 'bzrlib/tests/test_win32utils.py'
--- a/bzrlib/tests/test_win32utils.py 2009-11-04 22:12:46 +0000
+++ b/bzrlib/tests/test_win32utils.py 2009-11-06 10:00:10 +0000
@@ -288,13 +288,14 @@
def test_posix_quotations(self):
self.assertAsTokens([(True, u'foo bar')], u'"foo bar"')
- self.assertAsTokens([(True, u'foo bar')], u"'foo bar'")
- self.assertAsTokens([(True, u'foo bar')], u"'fo''o b''ar'")
+ self.assertAsTokens([(False, u"'fo''o"), (False, u"b''ar'")],
+ u"'fo''o b''ar'")
self.assertAsTokens([(True, u'foo bar')], u'"fo""o b""ar"')
- self.assertAsTokens([(True, u'foo bar')], u'"fo"\'o b\'"ar"')
+ self.assertAsTokens([(True, u"fo'o"), (True, u"b'ar")],
+ u'"fo"\'o b\'"ar"')
def test_nested_quotations(self):
- self.assertAsTokens([(True, u'foo"" bar')], u"'foo\"\" bar'")
+ self.assertAsTokens([(True, u'foo"" bar')], u"\"foo\\\"\\\" bar\"")
self.assertAsTokens([(True, u'foo\'\' bar')], u"\"foo'' bar\"")
def test_empty_result(self):
@@ -303,7 +304,7 @@
def test_quoted_empty(self):
self.assertAsTokens([(True, '')], u'""')
- self.assertAsTokens([(True, '')], u"''")
+ self.assertAsTokens([(False, u"''")], u"''")
def test_unicode_chars(self):
self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],
@@ -311,18 +312,15 @@
def test_newline_in_quoted_section(self):
self.assertAsTokens([(True, u'foo\nbar\nbaz\n')], u'"foo\nbar\nbaz\n"')
- self.assertAsTokens([(True, u'foo\nbar\nbaz\n')], u"'foo\nbar\nbaz\n'")
def test_escape_chars(self):
self.assertAsTokens([(False, u'foo\\bar')], u'foo\\bar')
def test_escape_quote(self):
self.assertAsTokens([(True, u'foo"bar')], u'"foo\\"bar"')
- self.assertAsTokens([(True, u'foo\\"bar')], u"'foo\\\"bar'")
def test_double_escape(self):
self.assertAsTokens([(True, u'foo\\bar')], u'"foo\\\\bar"')
- self.assertAsTokens([(True, u'foo\\\\bar')], u"'foo\\\\bar'")
self.assertAsTokens([(False, u'foo\\\\bar')], u"foo\\\\bar")
@@ -344,10 +342,14 @@
def test_quoted_globs(self):
self.build_tree(['a/', 'a/b.c', 'a/c.c', 'a/c.h'])
self.assertCommandLine([u'a/*.c'], '"a/*.c"')
- self.assertCommandLine([u'a/*.c'], "'a/*.c'")
+ self.assertCommandLine([u"'a/*.c'"], "'a/*.c'")
def test_slashes_changed(self):
self.assertCommandLine([u'a/*.c'], '"a\\*.c"')
# Expands the glob, but nothing matches
self.assertCommandLine([u'a/*.c'], 'a\\*.c')
self.assertCommandLine([u'a/foo.c'], 'a\\foo.c')
+
+ def test_no_single_quote_supported(self):
+ self.assertCommandLine(["add", "let's-do-it.txt"],
+ "add let's-do-it.txt")
=== modified file 'bzrlib/win32utils.py'
--- a/bzrlib/win32utils.py 2009-11-04 22:26:25 +0000
+++ b/bzrlib/win32utils.py 2009-11-06 10:00:10 +0000
@@ -535,7 +535,7 @@
self._input_iter = iter(self._input)
self._whitespace_match = re.compile(u'\s').match
self._word_match = re.compile(u'\S').match
- self._quote_chars = u'\'"'
+ self._quote_chars = u'"'
# self._quote_match = re.compile(u'[\'"]').match
self._escape_match = lambda x: None # Never matches
self._escape = '\\'
@@ -543,7 +543,6 @@
# ' ' - after whitespace, starting a new token
# 'a' - after text, currently working on a token
# '"' - after ", currently in a "-delimited quoted section
- # "'" - after ', currently in a '-delimited quotod section
# "\" - after '\', checking the next char
self._state = ' '
self._token = [] # Current token being parsed
More information about the bazaar-commits
mailing list