Merge lp:~maxb/bzr/deref-in-set-stacking into lp:bzr/2.3

Proposed by Max Bowsher
Status: Work in progress
Proposed branch: lp:~maxb/bzr/deref-in-set-stacking
Merge into: lp:bzr/2.3
Prerequisite: lp:~maxb/bzr/normalize-lp
Diff against target: 36 lines (+8/-0)
2 files modified
bzrlib/builtins.py (+3/-0)
bzrlib/reconfigure.py (+5/-0)
To merge this branch: bzr merge lp:~maxb/bzr/deref-in-set-stacking
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+61730@code.launchpad.net

Description of the change

This branch adds directory service dereferencing of the URLs passed to --stacked-on=...

One aim of this was in the hope of making --stacked-on=lp... work. It doesn't yet - ironically it would work if we still resolved lp: via XMLRPC - but now that we use the /+branch/... syntax to trigger server side lookup, we run into the problem that Launchpad does not *currently* allow /+branch/ for stacking locations. I hope to fix this in Launchpad.

Another benefit is that if users have custom plugins implementing shortcut URLs, this will ensure that we do not leak these custom shortcuts into the branch stacking location, potentially breaking things for users without the same set of custom plugins.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/20/2011 12:06 PM, Max Bowsher wrote:
> Max Bowsher has proposed merging lp:~maxb/bzr/deref-in-set-stacking into lp:bzr/2.3 with lp:~maxb/bzr/normalize-lp as a prerequisite.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> For more details, see:
> https://code.launchpad.net/~maxb/bzr/deref-in-set-stacking/+merge/61730
>
> This branch adds directory service dereferencing of the URLs passed to --stacked-on=...
>
> One aim of this was in the hope of making --stacked-on=lp... work. It doesn't yet - ironically it would work if we still resolved lp: via XMLRPC - but now that we use the /+branch/... syntax to trigger server side lookup, we run into the problem that Launchpad does not *currently* allow /+branch/ for stacking locations. I hope to fix this in Launchpad.
>
> Another benefit is that if users have custom plugins implementing shortcut URLs, this will ensure that we do not leak these custom shortcuts into the branch stacking location, potentially breaking things for users without the same set of custom plugins.

I don't think this is appropriate for 2.3. Or at least, we should land
it in 2.4 first, and then make sure there isn't extra fallout.

What if, instead of using directory_service.directories, we just used

normalized_url = get_transport(stacked_on_url).base

transport was also meant as a URL service, so maybe that would work for
what we need here.

Also, XMLRPC now returns +branch/foo style URLs as well. So it still
wouldn't work.

AFAIK there isn't a way to expand a lp:foo to ~user/bar/baz anymore... :(

Maybe via code.launchpad.net

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3WSQQACgkQJdeBCYSNAAPEZACgvqt6yuOi8kqQhpEmNwVD76Ys
/dQAoMe0/4pRDOHI6xOn6Sh6+P6YYL5T
=XBoM
-----END PGP SIGNATURE-----

Revision history for this message
Max Bowsher (maxb) wrote :

OK, I'll investigate the use of transport instead of directory service, and retarget for 2.4.

Status => WIP meanwhile

Unmerged revisions

5651. By Max Bowsher

Dereference via directory service the argument to --stacked-on (push &
reconfigure) so that stacked-on locations are not dependent on the directory
service plugins installed in a particular instance of Bazaar.

Unfortunately this does not _yet_ let us use lp: URLs in --stacked-on, as
Launchpad currently does not consider /+branch/... to be a valid stacking
location.

5650. By Max Bowsher

Fix bzrlib.urlutils.normalize_url when processing URLs with a scheme, but no
slash in the path - before this, lp:bzr was 'normalized' to lp:bzrlp:bzr (sic).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2011-05-15 07:21:24 +0000
3+++ bzrlib/builtins.py 2011-05-20 10:06:34 +0000
4@@ -1098,6 +1098,9 @@
5 more_warning='Uncommitted changes will not be pushed.')
6 # Get the stacked_on branch, if any
7 if stacked_on is not None:
8+ # We cannot rely on all users of the branch having the same
9+ # directory services installed, so dereference the stacking base:
10+ stacked_on = directory_service.directories.dereference(stacked_on)
11 stacked_on = urlutils.normalize_url(stacked_on)
12 elif stacked:
13 parent_url = br_from.get_parent()
14
15=== modified file 'bzrlib/reconfigure.py'
16--- bzrlib/reconfigure.py 2010-04-23 00:44:15 +0000
17+++ bzrlib/reconfigure.py 2011-05-20 10:06:34 +0000
18@@ -24,6 +24,7 @@
19 from bzrlib import (
20 branch,
21 bzrdir,
22+ directory_service,
23 errors,
24 trace,
25 ui,
26@@ -40,6 +41,10 @@
27
28 def apply(self, bzrdir, stacked_on_url):
29 branch = bzrdir.open_branch()
30+ # We cannot rely on all users of the branch having the same
31+ # directory services installed, so dereference the stacking base:
32+ stacked_on_url = directory_service.directories.dereference(
33+ stacked_on_url)
34 # it may be a path relative to the cwd or a url; the branch wants
35 # a path relative to itself...
36 on_url = urlutils.relative_url(branch.base,

Subscribers

People subscribed via source and target branches