Show More
@@ -25,8 +25,6 b' Original author and date, and relevant c' | |||||
25 | :license: GPLv3, see LICENSE.md for more details. |
|
25 | :license: GPLv3, see LICENSE.md for more details. | |
26 | """ |
|
26 | """ | |
27 |
|
27 | |||
28 | import StringIO |
|
|||
29 |
|
||||
30 | from pygments import highlight |
|
28 | from pygments import highlight | |
31 | from pygments.formatters import HtmlFormatter |
|
29 | from pygments.formatters import HtmlFormatter | |
32 |
|
30 | |||
@@ -111,12 +109,12 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
111 | return ''.join((changeset.id, '\n')) |
|
109 | return ''.join((changeset.id, '\n')) | |
112 |
|
110 | |||
113 | def _wrap_tablelinenos(self, inner): |
|
111 | def _wrap_tablelinenos(self, inner): | |
114 | dummyoutfile = StringIO.StringIO() |
|
112 | inner_lines = [] | |
115 | lncount = 0 |
|
113 | lncount = 0 | |
116 | for t, line in inner: |
|
114 | for t, line in inner: | |
117 | if t: |
|
115 | if t: | |
118 | lncount += 1 |
|
116 | lncount += 1 | |
119 | dummyoutfile.write(line) |
|
117 | inner_lines.append(line) | |
120 |
|
118 | |||
121 | fl = self.linenostart |
|
119 | fl = self.linenostart | |
122 | mw = len(str(lncount + fl - 1)) |
|
120 | mw = len(str(lncount + fl - 1)) | |
@@ -176,7 +174,7 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
176 | '<tr><td class="linenos"><div class="linenodiv"><pre>' + |
|
174 | '<tr><td class="linenos"><div class="linenodiv"><pre>' + | |
177 | ls + '</pre></div></td>' + |
|
175 | ls + '</pre></div></td>' + | |
178 | '<td class="code">') |
|
176 | '<td class="code">') | |
179 | yield 0, dummyoutfile.getvalue() |
|
177 | yield 0, ''.join(inner_lines) | |
180 | yield 0, '</td></tr></table>' |
|
178 | yield 0, '</td></tr></table>' | |
181 |
|
179 | |||
182 | ''' |
|
180 | ''' | |
@@ -204,5 +202,5 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
204 | ''.join(headers_row) + |
|
202 | ''.join(headers_row) + | |
205 | ''.join(body_row_start) |
|
203 | ''.join(body_row_start) | |
206 | ) |
|
204 | ) | |
207 | yield 0, dummyoutfile.getvalue() |
|
205 | yield 0, ''.join(inner_lines) | |
208 | yield 0, '</td></tr></table>' |
|
206 | yield 0, '</td></tr></table>' |
@@ -22,7 +22,6 b' import json' | |||||
22 | import logging |
|
22 | import logging | |
23 | import random |
|
23 | import random | |
24 | import re |
|
24 | import re | |
25 | import StringIO |
|
|||
26 | import textwrap |
|
25 | import textwrap | |
27 | import urlparse |
|
26 | import urlparse | |
28 |
|
27 | |||
@@ -246,12 +245,12 b' class CodeHtmlFormatter(HtmlFormatter):' | |||||
246 | yield i, t |
|
245 | yield i, t | |
247 |
|
246 | |||
248 | def _wrap_tablelinenos(self, inner): |
|
247 | def _wrap_tablelinenos(self, inner): | |
249 | dummyoutfile = StringIO.StringIO() |
|
248 | inner_lines = [] | |
250 | lncount = 0 |
|
249 | lncount = 0 | |
251 | for t, line in inner: |
|
250 | for t, line in inner: | |
252 | if t: |
|
251 | if t: | |
253 | lncount += 1 |
|
252 | lncount += 1 | |
254 | dummyoutfile.write(line) |
|
253 | inner_lines.append(line) | |
255 |
|
254 | |||
256 | fl = self.linenostart |
|
255 | fl = self.linenostart | |
257 | mw = len(str(lncount + fl - 1)) |
|
256 | mw = len(str(lncount + fl - 1)) | |
@@ -304,7 +303,7 b' class CodeHtmlFormatter(HtmlFormatter):' | |||||
304 | '<tr><td class="linenos"><div class="linenodiv">' |
|
303 | '<tr><td class="linenos"><div class="linenodiv">' | |
305 | '<pre>' + ls + '</pre></div></td>' |
|
304 | '<pre>' + ls + '</pre></div></td>' | |
306 | '<td id="hlcode" class="code">') |
|
305 | '<td id="hlcode" class="code">') | |
307 | yield 0, dummyoutfile.getvalue() |
|
306 | yield 0, ''.join(inner_lines) | |
308 | yield 0, '</td></tr></table>' |
|
307 | yield 0, '</td></tr></table>' | |
309 |
|
308 | |||
310 |
|
309 |
@@ -1,5 +1,3 b'' | |||||
1 | import StringIO |
|
|||
2 |
|
||||
3 |
|
|
1 | from pygments import highlight | |
4 | from pygments.formatters import HtmlFormatter |
|
2 | from pygments.formatters import HtmlFormatter | |
5 |
|
3 | |||
@@ -83,12 +81,12 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
83 | return ''.join((changeset.id, '\n')) |
|
81 | return ''.join((changeset.id, '\n')) | |
84 |
|
82 | |||
85 | def _wrap_tablelinenos(self, inner): |
|
83 | def _wrap_tablelinenos(self, inner): | |
86 | dummyoutfile = StringIO.StringIO() |
|
84 | inner_lines = [] | |
87 | lncount = 0 |
|
85 | lncount = 0 | |
88 | for t, line in inner: |
|
86 | for t, line in inner: | |
89 | if t: |
|
87 | if t: | |
90 | lncount += 1 |
|
88 | lncount += 1 | |
91 | dummyoutfile.write(line) |
|
89 | inner_lines.append(line) | |
92 |
|
90 | |||
93 | fl = self.linenostart |
|
91 | fl = self.linenostart | |
94 | mw = len(str(lncount + fl - 1)) |
|
92 | mw = len(str(lncount + fl - 1)) | |
@@ -147,7 +145,7 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
147 | '<tr><td class="linenos"><div class="linenodiv"><pre>' + |
|
145 | '<tr><td class="linenos"><div class="linenodiv"><pre>' + | |
148 | ls + '</pre></div></td>' + |
|
146 | ls + '</pre></div></td>' + | |
149 | '<td class="code">') |
|
147 | '<td class="code">') | |
150 | yield 0, dummyoutfile.getvalue() |
|
148 | yield 0, ''.join(inner_lines) | |
151 | yield 0, '</td></tr></table>' |
|
149 | yield 0, '</td></tr></table>' | |
152 |
|
150 | |||
153 | ''' |
|
151 | ''' | |
@@ -175,5 +173,5 b' class AnnotateHtmlFormatter(HtmlFormatte' | |||||
175 | ''.join(headers_row) + |
|
173 | ''.join(headers_row) + | |
176 | ''.join(body_row_start) |
|
174 | ''.join(body_row_start) | |
177 | ) |
|
175 | ) | |
178 | yield 0, dummyoutfile.getvalue() |
|
176 | yield 0, ''.join(inner_lines) | |
179 | yield 0, '</td></tr></table>' |
|
177 | yield 0, '</td></tr></table>' |
@@ -25,7 +25,6 b' Original author and date, and relevant c' | |||||
25 | :license: GPLv3, see LICENSE.md for more details. |
|
25 | :license: GPLv3, see LICENSE.md for more details. | |
26 | """ |
|
26 | """ | |
27 |
|
27 | |||
28 | import cStringIO |
|
|||
29 | import logging |
|
28 | import logging | |
30 | import os |
|
29 | import os | |
31 | import posixpath |
|
30 | import posixpath | |
@@ -485,12 +484,8 b' class ScmModel(object):' | |||||
485 | # in any other case this will throw exceptions and deny commit |
|
484 | # in any other case this will throw exceptions and deny commit | |
486 | if isinstance(content, (basestring,)): |
|
485 | if isinstance(content, (basestring,)): | |
487 | content = safe_str(content) |
|
486 | content = safe_str(content) | |
488 | elif isinstance(content, (file, cStringIO.OutputType,)): |
|
487 | else: | |
489 | content = content.read() |
|
488 | content = content.read() | |
490 | else: |
|
|||
491 | raise Exception('Content is of unrecognized type %s' % ( |
|
|||
492 | type(content) |
|
|||
493 | )) |
|
|||
494 | processed_nodes.append((f_path, content)) |
|
489 | processed_nodes.append((f_path, content)) | |
495 |
|
490 | |||
496 | message = safe_unicode(message) |
|
491 | message = safe_unicode(message) |
@@ -37,9 +37,8 b' class ArchivesTestCaseMixin(_BackendTest' | |||||
37 |
|
37 | |||
38 | for x in xrange(5): |
|
38 | for x in xrange(5): | |
39 | node_path = '%d/file_%d.txt' % (x, x) |
|
39 | node_path = '%d/file_%d.txt' % (x, x) | |
40 |
decompressed = |
|
40 | decompressed = out.read('repo/' + node_path) | |
41 | decompressed.write(out.read('repo/' + node_path)) |
|
41 | assert decompressed == self.tip.get_node(node_path).content | |
42 | assert decompressed.getvalue() == self.tip.get_node(node_path).content |
|
|||
43 |
|
42 | |||
44 | def test_archive_tgz(self): |
|
43 | def test_archive_tgz(self): | |
45 | path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_tgz-')[1] |
|
44 | path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_tgz-')[1] |
General Comments 0
You need to be logged in to leave comments.
Login now