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
1=== modified file 'bzrlib/cmdline.py'
2--- bzrlib/cmdline.py 2011-12-19 13:23:58 +0000
3+++ bzrlib/cmdline.py 2012-12-10 14:57:21 +0000
4@@ -72,6 +72,7 @@
5 if next_char == u'\\':
6 return _Backslash(self)
7 elif next_char == self.quote_char:
8+ context.token.append(u'')
9 return self.exit_state
10 else:
11 context.token.append(next_char)
12
13=== modified file 'bzrlib/tests/test_cmdline.py'
14--- bzrlib/tests/test_cmdline.py 2010-12-06 14:01:44 +0000
15+++ bzrlib/tests/test_cmdline.py 2012-12-10 14:57:21 +0000
16@@ -66,6 +66,10 @@
17 self.assertAsTokens([(True, '')], u'""')
18 self.assertAsTokens([(False, u"''")], u"''")
19 self.assertAsTokens([(True, '')], u"''", single_quotes_allowed=True)
20+ self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
21+ u'a "" c')
22+ self.assertAsTokens([(False, u'a'), (True, u''), (False, u'c')],
23+ u"a '' c", single_quotes_allowed=True)
24
25 def test_unicode_chars(self):
26 self.assertAsTokens([(False, u'f\xb5\xee'), (False, u'\u1234\u3456')],