Skip to content

Commit ee93afc

Browse files
committed
Decode received mboxes
Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #47
1 parent 679d0c0 commit ee93afc

File tree

7 files changed

+15
-6
lines changed

7 files changed

+15
-6
lines changed

git_pw/bundle.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def download_cmd(bundle_id, output):
7272
bundle = _get_bundle(bundle_id)
7373

7474
if output:
75-
output.write(api.get(bundle['mbox']).text)
75+
content = api.get(bundle['mbox']).content
76+
77+
output.write(content)
7678

7779
if output != sys.stdout:
7880
path = output.name

git_pw/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def download_cmd(patch_id, output, fmt):
7272
if fmt == 'diff':
7373
content = patch['diff']
7474
else:
75-
content = api.get(patch['mbox']).text
75+
content = api.get(patch['mbox']).content
7676

7777
output.write(content)
7878

git_pw/series.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def download_cmd(series_id, output):
5252
series = api.detail('series', series_id)
5353

5454
if output:
55-
output.write(api.get(series['mbox']).text)
55+
content = api.get(series['mbox']).content
56+
57+
output.write(content)
5658

5759
if output != sys.stdout:
5860
path = output.name
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Resolved an issue that prevented viewing patch diffs/mboxes in stdout on
5+
Python 3.

tests/test_bundle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_download_to_file(self, mock_get, mock_download, mock_get_bundle):
117117

118118
class MockResponse(object):
119119
@property
120-
def text(self):
120+
def content(self):
121121
return b'alpha-beta'
122122

123123
rsp = {'mbox': 'http://example.com/api/patches/123/mbox/'}

tests/test_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_download_to_file(self, mock_get, mock_log, mock_download,
115115

116116
class MockResponse(object):
117117
@property
118-
def text(self):
118+
def content(self):
119119
return b'alpha-beta'
120120

121121
rsp = {'mbox': 'hello, world', 'diff': 'test'}

tests/test_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_download_to_file(self, mock_get, mock_download, mock_detail):
6868

6969
class MockResponse(object):
7070
@property
71-
def text(self):
71+
def content(self):
7272
return b'alpha-beta'
7373

7474
rsp = {'mbox': 'http://example.com/api/patches/123/mbox/'}

0 commit comments

Comments
 (0)