Merge lp:~rpadovani/launchpad/link-revision-merged-mp into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 17681 | ||||
| Proposed branch: | lp:~rpadovani/launchpad/link-revision-merged-mp | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
208 lines (+66/-1) 11 files modified
lib/lp/code/browser/branchmergeproposal.py (+6/-0) lib/lp/code/browser/tests/test_branchmergeproposal.py (+14/-0) lib/lp/code/interfaces/branch.py (+3/-0) lib/lp/code/interfaces/gitref.py (+3/-0) lib/lp/code/interfaces/gitrepository.py (+3/-0) lib/lp/code/model/branch.py (+5/-0) lib/lp/code/model/gitref.py (+4/-0) lib/lp/code/model/gitrepository.py (+5/-0) lib/lp/code/model/tests/test_branch.py (+10/-0) lib/lp/code/model/tests/test_gitrepository.py (+9/-0) lib/lp/code/templates/branchmergeproposal-link-summary.pt (+4/-1) |
||||
| To merge this branch: | bzr merge lp:~rpadovani/launchpad/link-revision-merged-mp | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Colin Watson | Approve on 2015-08-06 | ||
| Kit Randel | 2015-07-13 | Needs Fixing on 2015-07-13 | |
|
Review via email:
|
|||
Commit Message
Add link to the merged revision in the summary of merge proposal pages.
Description of the Change
Summary
Fix bug #892259
"Merged into lp:pkgme at revision 86". "Merged" is a link; "lp:pkgme" is a link, but "revision 86" is not.
Proposed fix
Add link to the revision
Pre-implementation notes
My first patch to lp itself :-)
Implementation details
Create a new method in IGitRepository and IBranchRepository to create url to a commit/revision in the branch.
Use it to create the property for the template
Tests
1 test to check the html and 2 tests to check the new method
Demo and Q/A
Just run it locally and go on a summary of a branch merged in another branch
| Kit Randel (blr) wrote : | # |
You might find lib/lp/
| Colin Watson (cjwatson) wrote : | # |
You should definitely write a test, and the process of doing so would probably have exposed the problem Kit points out. By way of "bzr grep 'at revision'", it looks as though lib/lp/
Getting the link right for both Bazaar and Git may be a bit fiddly to do in the page template (.pt) alone. Page templates have an associated view class, which you can look up in the relevant browser/
| Riccardo Padovani (rpadovani) wrote : | # |
Thanks for your feedbacks :-)
I followed Colin's suggestions and I created a new attribute for the template, now I think it should work.
Then (actually, before) I started to write the test, but I'm stuck trying to creating the link. Any hint?
| Colin Watson (cjwatson) wrote : | # |
Certainly making progress, thanks. I think this advice should disentangle you a bit.
| Riccardo Padovani (rpadovani) wrote : | # |
Thanks for the awesome feedback Colin :-) Sorry for not replying before, I was busy at uni.
So, I started to work on your suggestions, and all seems to work now, but the test fails (only for bzr), with this error:
Error in test lp.code.
Traceback (most recent call last):
_StringException: Traceback (most recent call last):
File "/home/
revision_link = bmp.merge_
AttributeError: 'thread._local' object has no attribute 'interaction'
I tried to looking on the internet for this error, but I found nothingu useful. Also because in the file there is no reference to a thread, so I think is something more complicated.
Also another question:
you said to use quote_plus(
I'm starting to work on other two tests
| Riccardo Padovani (rpadovani) wrote : | # |
Okay, I also created tests for getCodebrowseUr
| Colin Watson (cjwatson) wrote : | # |
getViewBrowser calls logout(), so it's probably simplest to just move the assignments to revision_link and revision_number up to before you call getViewBrowser.
| Colin Watson (cjwatson) wrote : | # |
Oh, and as far as quote_plus goes, I'd forgotten that that would be an int in the Bazaar case. You can just use revision rather than quote_plus(
| Riccardo Padovani (rpadovani) wrote : | # |
Thanks for the link, I fixed the test.
Anyway, I used self.getCodebro

Hi Riccardo, thanks for the patch!
This doesn't seem quite right however - currently this creates a link to code.launchpad. dev/project/ branch/ revno whereas I think we need (in the bazaar case), bazaar. launchpad. net/[project, ~user/project] /branch/ revision/ revno