[MERGE] Command for opening Launchpad pages for Launchpad branches
John Arbash Meinel
john at arbash-meinel.com
Sat Jan 24 19:15:41 GMT 2009
-----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".
Otherwise this seems like a decent update to me.
BB:tweak
I wonder if we wouldn't want "bzr lp-open --project" or something along
those lines.
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?
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkl7aN0ACgkQJdeBCYSNAAOvZwCdGpwHPx/IGRel68yczmlfyYa9
Oy8Anjk/ZDbC/BzL/mRVvutu41riWNdD
=rG0k
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list