Merge lp:~twom/loggerhead/fix-per-file-revision-ui into lp:loggerhead

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 507
Merged at revision: 506
Proposed branch: lp:~twom/loggerhead/fix-per-file-revision-ui
Merge into: lp:loggerhead
Diff against target: 39 lines (+17/-1)
2 files modified
loggerhead/controllers/revision_ui.py (+1/-1)
loggerhead/tests/test_controllers.py (+16/-0)
To merge this branch: bzr merge lp:~twom/loggerhead/fix-per-file-revision-ui
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+387196@code.launchpad.net

Commit message

Use path instead of file_id in RevisionUI

Description of the change

The use of file_id has gone away, so use the path instead.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
507. By Tom Wardill

assertEqual, not assertIs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/controllers/revision_ui.py'
--- loggerhead/controllers/revision_ui.py 2020-07-08 17:14:19 +0000
+++ loggerhead/controllers/revision_ui.py 2020-07-10 09:58:00 +0000
@@ -128,7 +128,7 @@
128 except (KeyError, ValueError):128 except (KeyError, ValueError):
129 context_lines = None129 context_lines = None
130 diff_chunks = diff_chunks_for_file(130 diff_chunks = diff_chunks_for_file(
131 self._history._branch.repository, item.file_id,131 self._history._branch.repository, path,
132 item.old_revision, item.new_revision,132 item.old_revision, item.new_revision,
133 context_lines=context_lines)133 context_lines=context_lines)
134 else:134 else:
135135
=== modified file 'loggerhead/tests/test_controllers.py'
--- loggerhead/tests/test_controllers.py 2020-07-08 16:29:40 +0000
+++ loggerhead/tests/test_controllers.py 2020-07-10 09:58:00 +0000
@@ -148,6 +148,22 @@
148 revision_ui.add_template_values(values)148 revision_ui.add_template_values(values)
149 self.assertIs(values['diff_chunks'], None)149 self.assertIs(values['diff_chunks'], None)
150150
151 def test_add_template_values_with_changes(self):
152 branch_app = self.make_branch_app_for_revision_ui(
153 [('file', b'content\n')], [('file', b'new content\n')])
154 env = {'SCRIPT_NAME': '/',
155 'PATH_INFO': '/revision/1/file',
156 'QUERY_STRING':'start_revid=1',
157 'REQUEST_METHOD': 'GET',
158 'wsgi.url_scheme': 'http',
159 'SERVER_NAME': 'localhost',
160 'SERVER_PORT': '80'}
161 revision_ui = branch_app.lookup_app(env)
162 path = revision_ui.parse_args(env)
163 values = revision_ui.get_values(path, revision_ui.kwargs, {})
164 revision_ui.add_template_values(values)
165 self.assertEqual(len(values['diff_chunks']), 1)
166
151 def test_get_values_smoke(self):167 def test_get_values_smoke(self):
152 branch_app = self.make_branch_app_for_revision_ui(168 branch_app = self.make_branch_app_for_revision_ui(
153 [('file', b'content\n'), ('other-file', b'other\n')],169 [('file', b'content\n'), ('other-file', b'other\n')],

Subscribers

People subscribed via source and target branches