[MERGE] Command for opening Launchpad pages for Launchpad branches
Jonathan Lange
jml at mumak.net
Mon Jan 26 11:49:39 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, Jan 24, 2009 at 5:15 PM, John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jonathan Lange wrote:
>> Hello Bazaaros,
>>
>> A lot of the time, I want to open the Launchpad web page for a branch
>> that I'm working on. The way I normally do it is by opening up the
>> Code tab for whatever project I'm working on, then finding it in the
>> listing. This is a bit of a pain, so I decided to teach my computer
>> how to do it for me.
>>
>> I thought a bit about just opening the public location in the web
>> browser, since that might well work for non-Launchpad branches. I
>> decided not to for two reasons:
>> 1. Many of my branches have a bzr+ssh:// URL as their public location.
>> 2. That would take me to Launchpad's loggerhead page for that
>> branch. I actually want to go to the main branch page (e.g.
>> https://code.launchpad.net/~jml/testdoc/trunk).
>>
>> I still think that a command, similar to this one (perhaps called 'bzr
>> open'), that opened the public location would be a good idea. It's
>> just a good idea for another patch.
>>
>> The attached patch fiddles around with the LaunchpadService class so
>> that it also has a get_web_url_for_branch_url() method. This might be
>> pushing the class beyond it's original intent, but it seemed like the
>> least wrong thing to do given the constraints.
>>
>> cheers,
>> jml
>
> + def get_web_url_from_branch_url(self, branch_url):
> + """Get the Launchpad web URL for the given branch URL.
> +
> + :raise errors.InvalidURL: if 'branch_url' cannot be identified as a
> + Launchpad branch URL.
> + :return: The URL of the branch on Launchpad.
> + """
> + scheme, hostinfo, path = urlsplit(branch_url)[:3]
> + if scheme != 'lp':
> + domains = ('bazaar.%s' % domain
> + for domain in self.LAUNCHPAD_DOMAINS.itervalues())
> + if hostinfo not in domains:
> + raise NotLaunchpadBranch(branch_url)
> + return urlutils.join('https://code.%s' % self.domain, path)
>
>
> ^- Does this work for stuff like "lp:bzr" or "lp:bzr/1.11" ? I'm not
> sure about the specifics of code.launchpad.net, but I'm pretty sure it
> wouldn't work for "lp:bzr/1.11".
>
No it doesn't! Good catch. I've updated it to ask the Launchpad
directory service to expand the lp:// URL.
> Otherwise this seems like a decent update to me.
>
Thanks.
> BB:tweak
>
> I wonder if we wouldn't want "bzr lp-open --project" or something along
> those lines.
>
That's a good idea for a future patch.
> Also, for *my* branches, I think the public_location is ok, but the
> push_location is also an lp url. Would we want to support checking that?
>
Hmm. Good question. :)
> BB:tweak
>
Here's the updated patch.
jml
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.2)
iEYEARECAAYFAkl9o00ACgkQX+0xPtMTonx2sgCfd+owayOt4ZrSdoIEuKfdzJHu
xzkAoMNHVmjLGSIOs/cc4vU30B2sJK74
=wtcy
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: open-in-launchpad-2.diff
Type: text/x-diff
Size: 23905 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090126/9c6102ac/attachment-0001.bin
More information about the bazaar
mailing list