Merge lp:~naesten/bzr-fastimport/400960-heredocs into lp:~bzr/bzr-fastimport/fastimport.dev

Proposed by Samuel Bronson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~naesten/bzr-fastimport/400960-heredocs
Merge into: lp:~bzr/bzr-fastimport/fastimport.dev
Diff against target: None lines
To merge this branch: bzr merge lp:~naesten/bzr-fastimport/400960-heredocs
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Oxyd Pending
Bazaar Developers Pending
Review via email: mp+9015@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Samuel Bronson (naesten) wrote :

Apologies to Onyx, I got wires crossed when trying to request Ian Clatworthy to review this :-(

Revision history for this message
Samuel Bronson (naesten) wrote :

> Apologies to Onyx, I got wires crossed when trying to request Ian Clatworthy
> to review this :-(

Er. S/Onyx/Oxyd/. (If you're wondering how I got the wires crossed, Ian's IRC nick is Oxyd's launchpad username.)

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Thanks. Merged into trunk rev 183.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'parser.py'
2--- parser.py 2009-04-14 03:47:51 +0000
3+++ parser.py 2009-07-18 23:09:23 +0000
4@@ -88,7 +88,8 @@
5
6 # note: delim may be any string but must not contain lf.
7 # data_line may contain any data but must not be exactly
8- # delim.
9+ # delim. The lf after the final data_line is included in
10+ # the data.
11 delimited_data ::= 'data' sp '<<' delim lf
12 (data_line lf)*
13 delim lf;
14@@ -234,7 +235,16 @@
15
16 :return: the bytes read up to but excluding the terminator.
17 """
18- raise NotImplementedError(self.read_until)
19+
20+ lines = []
21+ term = terminator + '\n'
22+ while True:
23+ line = self.input.readline()
24+ if line == term:
25+ break
26+ else:
27+ lines.append(line)
28+ return ''.join(lines)
29
30
31 # Regular expression used for parsing. (Note: The spec states that the name
32
33=== modified file 'tests/test_parser.py'
34--- tests/test_parser.py 2009-04-06 20:56:27 +0000
35+++ tests/test_parser.py 2009-07-18 23:07:37 +0000
36@@ -101,6 +101,14 @@
37 committer <bugs@bunny.org> now
38 data 20
39 first commit, empty
40+# Test a commit with a heredoc-style (delimited_data) messsage (bug #400960)
41+commit refs/heads/master
42+mark :4
43+author <bugs@bunny.org> now
44+committer <bugs@bunny.org> now
45+data <<EOF
46+Commit with heredoc-style message
47+EOF
48 """
49
50
51@@ -115,7 +123,7 @@
52 if cmd.name == 'commit':
53 for fc in cmd.file_iter():
54 result.append(fc)
55- self.assertEqual(len(result), 10)
56+ self.assertEqual(len(result), 11)
57 cmd1 = result.pop(0)
58 self.assertEqual('progress', cmd1.name)
59 self.assertEqual('completed', cmd1.message)
60@@ -178,6 +186,10 @@
61 self.assertEqual('commit', cmd.name)
62 self.assertEqual('3', cmd.mark)
63 self.assertEqual(None, cmd.from_)
64+ cmd = result.pop(0)
65+ self.assertEqual('commit', cmd.name)
66+ self.assertEqual('4', cmd.mark)
67+ self.assertEqual('Commit with heredoc-style message\n', cmd.message)
68
69
70 class TestStringParsing(tests.TestCase):

Subscribers

People subscribed via source and target branches

to all changes: