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
1=== modified file 'loggerhead/controllers/revision_ui.py'
2--- loggerhead/controllers/revision_ui.py 2020-07-08 17:14:19 +0000
3+++ loggerhead/controllers/revision_ui.py 2020-07-10 09:58:00 +0000
4@@ -128,7 +128,7 @@
5 except (KeyError, ValueError):
6 context_lines = None
7 diff_chunks = diff_chunks_for_file(
8- self._history._branch.repository, item.file_id,
9+ self._history._branch.repository, path,
10 item.old_revision, item.new_revision,
11 context_lines=context_lines)
12 else:
13
14=== modified file 'loggerhead/tests/test_controllers.py'
15--- loggerhead/tests/test_controllers.py 2020-07-08 16:29:40 +0000
16+++ loggerhead/tests/test_controllers.py 2020-07-10 09:58:00 +0000
17@@ -148,6 +148,22 @@
18 revision_ui.add_template_values(values)
19 self.assertIs(values['diff_chunks'], None)
20
21+ def test_add_template_values_with_changes(self):
22+ branch_app = self.make_branch_app_for_revision_ui(
23+ [('file', b'content\n')], [('file', b'new content\n')])
24+ env = {'SCRIPT_NAME': '/',
25+ 'PATH_INFO': '/revision/1/file',
26+ 'QUERY_STRING':'start_revid=1',
27+ 'REQUEST_METHOD': 'GET',
28+ 'wsgi.url_scheme': 'http',
29+ 'SERVER_NAME': 'localhost',
30+ 'SERVER_PORT': '80'}
31+ revision_ui = branch_app.lookup_app(env)
32+ path = revision_ui.parse_args(env)
33+ values = revision_ui.get_values(path, revision_ui.kwargs, {})
34+ revision_ui.add_template_values(values)
35+ self.assertEqual(len(values['diff_chunks']), 1)
36+
37 def test_get_values_smoke(self):
38 branch_app = self.make_branch_app_for_revision_ui(
39 [('file', b'content\n'), ('other-file', b'other\n')],

Subscribers

People subscribed via source and target branches