Merge lp:~jugmac00/loggerhead/fix-viewing-large-files into lp:loggerhead

Proposed by Jürgen Gmach
Status: Merged
Approved by: Colin Watson
Approved revision: 522
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~jugmac00/loggerhead/fix-viewing-large-files
Merge into: lp:loggerhead
Diff against target: 86 lines (+42/-1)
5 files modified
NEWS (+5/-0)
loggerhead/highlight.py (+1/-1)
loggerhead/tests/__init__.py (+1/-0)
loggerhead/tests/test_highlight.py (+33/-0)
requirements.txt (+2/-0)
To merge this branch: bzr merge lp:~jugmac00/loggerhead/fix-viewing-large-files
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Jelmer Vernooij Approve
Review via email: mp+418309@code.launchpad.net

Commit message

Fix highlighting for large files

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Still LGTM, thanks!

review: Approve
Revision history for this message
Jürgen Gmach (jugmac00) wrote (last edit ):

Thanks Jelmer!

So, now I am stuck. How do I get this merged now?

Is there buildbot involved so it would be enough to mark this MP as "approved"?

If not, I'd appreciate detailed instructions.

My current status - I have committed and pushed from the local `fix-viewing-large-files` directory/branch:

```
~/bzr/loggerhead via 🐍 v3.8.10 (venv)
❯ brz status
unknown:
  fix-viewing-large-files
```

Revision history for this message
Colin Watson (cjwatson) wrote :

There's a Jenkins job that should deal with merges. I'll try top-approving this and see whether it works.

Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2020-07-08 17:14:19 +0000
3+++ NEWS 2022-04-03 12:48:33 +0000
4@@ -1,6 +1,11 @@
5 What's changed in loggerhead?
6 =============================
7
8+unreleased
9+----------
10+
11+ - Fix highlighting for large files. (Jürgen Gmach, #1966702)
12+
13 1.20.0
14 ----
15
16
17=== modified file 'loggerhead/highlight.py'
18--- loggerhead/highlight.py 2021-11-15 14:40:11 +0000
19+++ loggerhead/highlight.py 2022-04-03 12:48:33 +0000
20@@ -37,7 +37,7 @@
21 """
22
23 if len(text) > MAX_HIGHLIGHT_SIZE:
24- return map(escape, breezy.osutils.split_lines(text))
25+ return list(map(escape, breezy.osutils.split_lines(text)))
26
27 formatter = HtmlFormatter(style=style, nowrap=True, classprefix='pyg-')
28
29
30=== modified file 'loggerhead/tests/__init__.py'
31--- loggerhead/tests/__init__.py 2018-10-20 15:28:43 +0000
32+++ loggerhead/tests/__init__.py 2022-04-03 12:48:33 +0000
33@@ -32,4 +32,5 @@
34 'test_revision_ui',
35 'test_templating',
36 'test_util',
37+ 'test_highlight',
38 ]])
39
40=== added file 'loggerhead/tests/test_highlight.py'
41--- loggerhead/tests/test_highlight.py 1970-01-01 00:00:00 +0000
42+++ loggerhead/tests/test_highlight.py 2022-04-03 12:48:33 +0000
43@@ -0,0 +1,33 @@
44+# Copyright 2022 Canonical Ltd
45+#
46+# This program is free software; you can redistribute it and/or modify
47+# it under the terms of the GNU General Public License as published by
48+# the Free Software Foundation; either version 2 of the License, or
49+# (at your option) any later version.
50+#
51+# This program is distributed in the hope that it will be useful,
52+# but WITHOUT ANY WARRANTY; without even the implied warranty of
53+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54+# GNU General Public License for more details.
55+#
56+# You should have received a copy of the GNU General Public License
57+# along with this program; if not, write to the Free Software
58+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
59+
60+from breezy import tests
61+
62+from ..highlight import highlight
63+
64+
65+class TestHighLight(tests.TestCase):
66+ def test_no_highlighting_for_big_texts(self):
67+ rv = highlight(
68+ path="",
69+ text="text\n" * 102401, # bigger than MAX_HIGHLIGHT_SIZE
70+ encoding="utf-8",
71+ )
72+ self.assertIsInstance(rv, list)
73+ self.assertLength(102401, rv)
74+ # no highlighting applied
75+ for item in rv:
76+ self.assertEqual("text\n", item)
77
78=== modified file 'requirements.txt'
79--- requirements.txt 2022-02-23 19:28:51 +0000
80+++ requirements.txt 2022-04-03 12:48:33 +0000
81@@ -9,3 +9,5 @@
82 bleach < 4.0.0; python_version <= "3.5"
83 packaging < 21.0; python_version <= "3.5"
84 https://www.owlfish.com/software/simpleTAL/downloads/SimpleTAL-5.2.tar.gz
85+Pygments < 2.6; python_version < "3"
86+Pygments; python_version >= "3"

Subscribers

People subscribed via source and target branches