Merge lp:~jameinel/bzr/2.2-is-up-to-date into lp:bzr
Status: | Merged |
---|---|
Merged at revision: | 6033 |
Proposed branch: | lp:~jameinel/bzr/2.2-is-up-to-date |
Merge into: | lp:bzr |
Diff against target: |
532 lines (+487/-2) (has conflicts) 3 files modified
bzrlib/plugins/launchpad/__init__.py (+55/-2) bzrlib/plugins/launchpad/lp_api_lite.py (+170/-0) bzrlib/plugins/launchpad/test_lp_api_lite.py (+262/-0) Text conflict in bzrlib/plugins/launchpad/__init__.py |
To merge this branch: | bzr merge lp:~jameinel/bzr/2.2-is-up-to-date |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
bzr-core | Pending | ||
Review via email: mp+67836@code.launchpad.net |
Commit message
Bug #609187: warn the user if a package-import branch doesn't have the most recent source package.
Description of the change
This adds a Branch.open hook for the Launchpad plugin. Thanks to Maxb for the nice reference code for querying Launchpad's getPublishedSou
I wrote this against bzr/2.2 just to give us the maximum opportunity, in case we want to get it backported into something like Lucid or Natty. I don't know whether we will, so certainly I'm proposing this against 2.5 to start.
Points for discussion:
1) This seems to add very little overhead. I added some timing mutters, and it looks like it adds 100-200ms for the getPublishedSeries call (obviously heavily dependent on latency), and about that much again for the get_tag_dict call.
Unfortunately, I don't think the tags are going to end up cached, because at the point Branch.open is hooked we haven't locked the Branch. But we don't (yet) have a good hook point for "I'm fetching from this branch".
Anyway, the ssh handshake time is multiple seconds, so I felt this was reasonable to be on-by-default. Especially since it should only encounter any overhead when we believe the branch is a package-importer branch.
2) Is my search regex reasonable:
r'bazaar.
r'(
It actually matches based on the expanded URL (not lp:ubuntu/bzr but bazaar.
lp:ubuntu/bzr
lp:ubuntu/natty/bzr
lp:~ubuntu-branches/ubuntu/natty/bzr/natty
The one thing I'm not sure about, is that you might want to not get the message if someone is working on a personal branch. However, maybe they *would* like to be informed that their personal branch doesn't have the latest published source.
3) I think it would make more sense to trigger when you are fetching from a branch. This will also trigger when pushing to a branch (maybe you are pushing up the very revision that is missing). However, that would require defining a new hook point, which seemed a lot more invasive if we ever did want to backport this.
4) Wording and information reporting. We may want a flag so that we only tell the users something if it is out of date. However, I thought in the short term, telling them it was up-to-date is reasonable, because it starts letting them know that we're checking for them.
We could enable this in bzr.dev, however I don't know how many people use bzr.dev + work with packaging branches, such that we'd get real feedback about it.
Martin mentioned that some of the wording could be confusing. I'm certainly not attached to any of it. The current output is:
$ bzr info lp:~ubuntu-branches/ubuntu/natty/bzr/natty
Branch not up-to-date. The most recent published version is 2.3.3-0ubuntu1,
but it is not in the branch tags for:
bzr+ssh:
...
$ bzr info lp:ubuntu/bzr
Found most recent published version: 2.4.0~beta4-
in bzr+ssh:
...
$ bzr info lp:ubuntu/natty/bzr # With an intentionally buggy query
Could not find a published version for:
bzr+ssh:
...
I think Martin had a good point that the first case could be clearer about the package import being out of date.
5) I have pretty good test coverage of the LatestPublication class. I have 3 tests that are slow, which I commented out. One testing a failed connection (by attempting to connect to the loopback). For some reason it takes 1s to timeout here, and I didn't want to inflict that in the general case. 2 tests would connect to Launchpad itself. I don't think we want to run them by default, though having them run somehow would be a good way to alert us if Launchpad changes the api somehow.
6) I don't have test coverage of the branch hook. It isn't clear to me what would make a reliable, useful automated test.
Superseded by: https:/ /code.launchpad .net/~jameinel/ bzr/2.5- up-to-date- 609187/ +merge/ 67844
Can't actually mark superseded, so I'll set this one back to WIP.