Merge lp:~rosslagerwall/bzr/cmdline-empty-quotes into lp:bzr

Proposed by Ross Lagerwall
Status: Merged
Merged at revision: 6578
Proposed branch: lp:~rosslagerwall/bzr/cmdline-empty-quotes
Merge into: lp:bzr
Diff against target: 26 lines (+5/-0)
2 files modified
bzrlib/cmdline.py (+1/-0)
bzrlib/tests/test_cmdline.py (+4/-0)
To merge this branch: bzr merge lp:~rosslagerwall/bzr/cmdline-empty-quotes
Reviewer Review Type Date Requested Status
Richard Wilbur Approve
Review via email: mp+138995@code.launchpad.net

Description of the change

This branch fixes up parsing of command lines like EDITOR='emacsclient -a "" -t' which are currently handled incorrectly.

To post a comment you must log in.
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Looks good. Is this written up as a bug? If so please add a reference to the bug number.
+1

review: Approve
Revision history for this message
Ross Lagerwall (rosslagerwall) wrote :

No, I didn't open a bug for it (I haven't searched for one though).

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

I looked for bugs with "empty string", "empty quotes" and didn't find this problem. Would you like to open a bug for it? I don't know your context in order to fill in the bug info.

Revision history for this message
Ross Lagerwall (rosslagerwall) wrote :

Ok, I wrote a bug and linked it to this branch.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Landing with an added news entry on both 2.5 and trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/cmdline.py'
--- bzrlib/cmdline.py 2011-12-19 13:23:58 +0000
+++ bzrlib/cmdline.py 2012-12-10 14:57:21 +0000
@@ -72,6 +72,7 @@
72 if next_char == u'\\':72 if next_char == u'\\':
73 return _Backslash(self)73 return _Backslash(self)
74 elif next_char == self.quote_char:74 elif next_char == self.quote_char:
75 context.token.append(u'')
75 return self.exit_state76 return self.exit_state
76 else:77 else:
77 context.token.append(next_char)78 context.token.append(next_char)
7879
=== modified file 'bzrlib/tests/test_cmdline.py'
--- bzrlib/tests/test_cmdline.py 2010-12-06 14:01:44 +0000
+++ bzrlib/tests/test_cmdline.py 2012-12-10 14:57:21 +0000
@@ -66,6 +66,10 @@
66 self.assertAsTokens([(True, '')], u'""')66 self.assertAsTokens([(True, '')], u'""')
67 self.assertAsTokens([(False, u"''")], u"''")67 self.assertAsTokens([(False, u"''")], u"''")
68 self.assertAsTokens([(True, '')], u"''", single_quotes_allowed=True)68 self.assertAsTokens([(True, '')], u"''", single_quotes_allowed=True)
69 self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
70 u'a "" c')
71 self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
72 u"a '' c", single_quotes_allowed=True)
6973
70 def test_unicode_chars(self):74 def test_unicode_chars(self):
71 self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],75 self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],