Merge lp:~twom/loggerhead/use-rev-not-file-rev into lp:loggerhead

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 505
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~twom/loggerhead/use-rev-not-file-rev
Merge into: lp:loggerhead
Diff against target: 14 lines (+1/-3)
1 file modified
loggerhead/controllers/view_ui.py (+1/-3)
To merge this branch: bzr merge lp:~twom/loggerhead/use-rev-not-file-rev
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+387105@code.launchpad.net

Commit message

Use current rev, not file rev

Description of the change

Looking up the file revision to get the tree doesn't work if the file is in a subdirectory that has moved.
Instead, use the revision that we've got from the URL to get the tree, then look up the file.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

I don't completely follow this, but I'm happy to give it a go and see if it works better in some of those corner cases.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'loggerhead/controllers/view_ui.py'
--- loggerhead/controllers/view_ui.py 2020-07-08 16:57:56 +0000
+++ loggerhead/controllers/view_ui.py 2020-07-09 08:53:02 +0000
@@ -54,9 +54,7 @@
54 raise TypeError(path)54 raise TypeError(path)
55 if not isinstance(revid, bytes):55 if not isinstance(revid, bytes):
56 raise TypeError(revid)56 raise TypeError(revid)
57 rev_tree = self._history.revision_tree(revid)57 return self._history._branch.repository.revision_tree(revid)
58 file_revid = rev_tree.get_file_revision(path)
59 return self._history._branch.repository.revision_tree(file_revid)
6058
61 def text_lines(self, path, revid):59 def text_lines(self, path, revid):
62 file_name = os.path.basename(path)60 file_name = os.path.basename(path)

Subscribers

People subscribed via source and target branches