Merge lp:~vila/bzr/609186-shortcuts into lp:bzr

Proposed by Vincent Ladeuil on 2010-10-11
Status: Merged
Approved by: Vincent Ladeuil on 2010-10-11
Approved revision: 5468
Merged at revision: 5486
Proposed branch: lp:~vila/bzr/609186-shortcuts
Merge into: lp:bzr
Prerequisite: lp:~barry/bzr/609186-shortcuts
Diff against target: 260 lines (+50/-99)
3 files modified
NEWS (+7/-7)
bzrlib/plugins/launchpad/lp_directory.py (+7/-7)
bzrlib/plugins/launchpad/test_lp_directory.py (+36/-85)
To merge this branch: bzr merge lp:~vila/bzr/609186-shortcuts
Reviewer Review Type Date Requested Status
bzr-core 2010-10-11 Pending
Review via email: mp+38098@code.launchpad.net

Commit message

Add ubuntu: and debianlp: shortcuts

Description of the change

Adding a test helper on top of Barry's proposal.

To post a comment you must log in.
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Vincent Ladeuil (vila) wrote :

sent to pqm by email

lp:~vila/bzr/609186-shortcuts updated on 2010-10-11
5469. By Vincent Ladeuil on 2010-10-11

Merge bzr.dev

5470. By Vincent Ladeuil on 2010-10-11

Fix NEWS entry

John A Meinel (jameinel) wrote :

sent to pqm by email

lp:~vila/bzr/609186-shortcuts updated on 2010-10-11
5471. By Vincent Ladeuil on 2010-10-11

Merge bzr.dev again

Vincent Ladeuil (vila) wrote :

Help needed !
It seems that pqm fails some tests (I briefly saw in a summary ~36 failures mentioned) but the email can't reach me. Investigating with a losa seem to point at my ISP marking it as spam :(

I can reproduce the failures even on the hardy babune slave, so I need someone else to feed-pqm this and forward me the pqm email on my canonical address (<my nick> at canonical <dot> com).

Thanks in advance !

If you get a 'Conflict in NEWS' error, that's not the one I'm after, it just means someone landed some more stuff. I just remerge against trunk though so it shouldn't occur again.

Martin Pool (mbp) wrote :

sent to pqm by email

Martin Pool (mbp) wrote :

I resolved the conflicts in
https://code.edge.launchpad.net/~mbp/bzr/integration/+merge/38166 and
I'll let you know if there are any errors.

Martin Pool (mbp) wrote :

There are multiple failures like this:

Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/testtools/runtest.py", line 128, in _run_user
   return fn(*args)
 File "/usr/lib/python2.4/site-packages/testtools/testcase.py", line 368, in _run_test_method
   testMethod()
 File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/plugins/launchpad/test_lp_directory.py", line 466, in test_ubuntu_d_distroseries_expansion
   self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
 File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/plugins/launchpad/test_lp_directory.py", line 383, in assertURL
   self.directory._resolve(shortcut, factory))
 File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/plugins/launchpad/lp_directory.py", line 77, in _resolve
   if result.scheme in ('ubuntu', 'debianlp'):
AttributeError: 'tuple' object has no attribute 'scheme'

lp:~vila/bzr/609186-shortcuts updated on 2010-10-12
5472. By Vincent Ladeuil on 2010-10-12

Fix python2.4 compatibility.

Vincent Ladeuil (vila) wrote :

Bah, the babune slave doesn't force the use of python2.4 so I was on the wrong track.

@barry: You will copy 100 times: bzr should remain compatible with python2.4 OR send me a beer ;)

Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-10-12 07:24:49 +0000
3+++ NEWS 2010-10-12 07:24:50 +0000
4@@ -16,6 +16,13 @@
5 New Features
6 ************
7
8+* New shortcut url schemes ``ubuntu:`` and ``debianlp:`` access source
9+ branches on Launchpad. E.g. ``bzr branch ubuntu:foo`` gives you the source
10+ branch for project ``foo`` in the current distroseries for Ubuntu while
11+ ``bzr branch debianlp:lenny/foo`` gives you the source branch (on Launchpad)
12+ for project ``foo`` in Debian Lenny.
13+ (Barry Warsaw, #609186)
14+
15 * Provide a configuration option "default_format" that controls the
16 default format for new branches created with ``bzr init``.
17 (Neil Martinsen-Burrell, #484101)
18@@ -66,13 +73,6 @@
19 New Features
20 ************
21
22-* New shortcut url schemes ``ubuntu:`` and ``debianlp:`` access source
23- branches on Launchpad. E.g. ``bzr branch ubuntu:foo`` gives you the source
24- branch for project ``foo`` in the current distroseries for Ubuntu while
25- ``bzr branch debianlp:lenny/foo`` gives you the source branch (on Launchpad)
26- for project ``foo`` in Debian Lenny.
27- (Barry Warsaw, #609186)
28-
29 * Add ``mainline`` revision specifier, which selects the revision that
30 merged a specified revision into the mainline. (Aaron Bentley)
31
32
33=== modified file 'bzrlib/plugins/launchpad/lp_directory.py'
34--- bzrlib/plugins/launchpad/lp_directory.py 2010-10-12 07:24:49 +0000
35+++ bzrlib/plugins/launchpad/lp_directory.py 2010-10-12 07:24:50 +0000
36@@ -73,12 +73,12 @@
37 _lp_login=None):
38 """Resolve the base URL for this transport."""
39 # Do ubuntu: and debianlp: expansions.
40- result = urlsplit(url)
41- if result.scheme in ('ubuntu', 'debianlp'):
42- if result.scheme == 'ubuntu':
43+ scheme, netloc, path, query, fragment = urlsplit(url)
44+ if scheme in ('ubuntu', 'debianlp'):
45+ if scheme == 'ubuntu':
46 distro = 'ubuntu'
47 distro_series = _ubuntu_series_shortcuts
48- elif result.scheme == 'debianlp':
49+ elif scheme == 'debianlp':
50 distro = 'debian'
51 # No shortcuts for Debian distroseries.
52 distro_series = {}
53@@ -87,7 +87,7 @@
54 # Split the path. It's either going to be 'project' or
55 # 'series/project', but recognize that it may be a series we don't
56 # know about.
57- path_parts = result.path.split('/')
58+ path_parts = path.split('/')
59 if len(path_parts) == 1:
60 # It's just a project name.
61 lp_url_template = 'lp:%(distro)s/%(project)s'
62@@ -108,11 +108,11 @@
63 distro=distro,
64 series=series,
65 project=project)
66- result = urlsplit(url)
67+ scheme, netloc, path, query, fragment = urlsplit(url)
68 service = LaunchpadService.for_url(url)
69 if _lp_login is None:
70 _lp_login = get_lp_login()
71- path = result[2].strip('/')
72+ path = path.strip('/')
73 if path.startswith('~/'):
74 if _lp_login is None:
75 raise errors.InvalidURL(path=url,
76
77=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
78--- bzrlib/plugins/launchpad/test_lp_directory.py 2010-10-12 07:24:49 +0000
79+++ bzrlib/plugins/launchpad/test_lp_directory.py 2010-10-12 07:24:50 +0000
80@@ -375,6 +375,13 @@
81 self, path, dict(urls=[
82 'http://bazaar.launchpad.net/' + url_suffix]))
83
84+ def assertURL(self, expected_url, shortcut, package='foo', distro='ubuntu',
85+ series=None):
86+ factory = self._make_factory(package=package, distro=distro,
87+ series=series)
88+ self.assertEqual('http://bazaar.launchpad.net/~branch/' + expected_url,
89+ self.directory._resolve(shortcut, factory))
90+
91 # Bogus distro.
92
93 def test_bogus_distro(self):
94@@ -392,137 +399,81 @@
95 def test_missing_ubuntu_distroseries_without_project(self):
96 # Launchpad does not hold source packages for Intrepid. Missing or
97 # bogus distroseries with no project name is treated like a project.
98- factory = self._make_factory(package='intrepid')
99- self.assertEqual(
100- 'http://bazaar.launchpad.net/~branch/ubuntu/intrepid',
101- self.directory._resolve('ubuntu:intrepid', factory))
102+ self.assertURL('ubuntu/intrepid', 'ubuntu:intrepid', package='intrepid')
103
104 def test_missing_ubuntu_distroseries_with_project(self):
105 # Launchpad does not hold source packages for Intrepid. Missing or
106 # bogus distroseries with a project name is treated like an unknown
107 # series (i.e. we keep it verbatim).
108- factory = self._make_factory(series='intrepid')
109- self.assertEqual(
110- 'http://bazaar.launchpad.net/~branch/ubuntu/intrepid/foo',
111- self.directory._resolve('ubuntu:intrepid/foo', factory))
112+ self.assertURL('ubuntu/intrepid/foo',
113+ 'ubuntu:intrepid/foo', series='intrepid')
114
115 def test_missing_debian_distroseries(self):
116 # Launchpad does not hold source packages for unstable. Missing or
117 # bogus distroseries is treated like a project.
118- factory = self._make_factory(package='sid', distro='debian')
119- self.assertEqual(
120- 'http://bazaar.launchpad.net/~branch/debian/sid',
121- self.directory._resolve('debianlp:sid', factory))
122+ self.assertURL('debian/sid',
123+ 'debianlp:sid', package='sid', distro='debian')
124
125 # Ubuntu Default distro series.
126
127 def test_ubuntu_default_distroseries_expansion(self):
128- factory = self._make_factory(package='foo')
129- self.assertEqual('http://bazaar.launchpad.net/~branch/ubuntu/foo',
130- self.directory._resolve('ubuntu:foo', factory)),
131+ self.assertURL('ubuntu/foo', 'ubuntu:foo')
132
133 def test_ubuntu_natty_distroseries_expansion(self):
134- factory = self._make_factory(package='foo', series='natty')
135- self.assertEqual(
136- 'http://bazaar.launchpad.net/~branch/ubuntu/natty/foo',
137- self.directory._resolve('ubuntu:natty/foo', factory)),
138+ self.assertURL('ubuntu/natty/foo', 'ubuntu:natty/foo', series='natty')
139
140 def test_ubuntu_n_distroseries_expansion(self):
141- factory = self._make_factory(package='foo', series='natty')
142- self.assertEqual(
143- 'http://bazaar.launchpad.net/~branch/ubuntu/natty/foo',
144- self.directory._resolve('ubuntu:n/foo', factory)),
145+ self.assertURL('ubuntu/natty/foo', 'ubuntu:n/foo', series='natty')
146
147 def test_ubuntu_maverick_distroseries_expansion(self):
148- factory = self._make_factory(package='foo', series='maverick')
149- self.assertEqual(
150- 'http://bazaar.launchpad.net/~branch/ubuntu/maverick/foo',
151- self.directory._resolve('ubuntu:maverick/foo', factory)),
152+ self.assertURL('ubuntu/maverick/foo', 'ubuntu:maverick/foo',
153+ series='maverick')
154
155 def test_ubuntu_m_distroseries_expansion(self):
156- factory = self._make_factory(package='foo', series='maverick')
157- self.assertEqual(
158- 'http://bazaar.launchpad.net/~branch/ubuntu/maverick/foo',
159- self.directory._resolve('ubuntu:m/foo', factory)),
160+ self.assertURL('ubuntu/maverick/foo', 'ubuntu:m/foo', series='maverick')
161
162 def test_ubuntu_lucid_distroseries_expansion(self):
163- factory = self._make_factory(package='foo', series='lucid')
164- self.assertEqual(
165- 'http://bazaar.launchpad.net/~branch/ubuntu/lucid/foo',
166- self.directory._resolve('ubuntu:lucid/foo', factory)),
167+ self.assertURL('ubuntu/lucid/foo', 'ubuntu:lucid/foo', series='lucid')
168
169 def test_ubuntu_l_distroseries_expansion(self):
170- factory = self._make_factory(package='foo', series='lucid')
171- self.assertEqual(
172- 'http://bazaar.launchpad.net/~branch/ubuntu/lucid/foo',
173- self.directory._resolve('ubuntu:l/foo', factory)),
174+ self.assertURL('ubuntu/lucid/foo', 'ubuntu:l/foo', series='lucid')
175
176 def test_ubuntu_karmic_distroseries_expansion(self):
177- factory = self._make_factory(package='foo', series='karmic')
178- self.assertEqual(
179- 'http://bazaar.launchpad.net/~branch/ubuntu/karmic/foo',
180- self.directory._resolve('ubuntu:karmic/foo', factory)),
181+ self.assertURL('ubuntu/karmic/foo', 'ubuntu:karmic/foo',
182+ series='karmic')
183
184 def test_ubuntu_k_distroseries_expansion(self):
185- factory = self._make_factory(package='foo', series='karmic')
186- self.assertEqual(
187- 'http://bazaar.launchpad.net/~branch/ubuntu/karmic/foo',
188- self.directory._resolve('ubuntu:k/foo', factory)),
189+ self.assertURL('ubuntu/karmic/foo', 'ubuntu:k/foo', series='karmic')
190
191 def test_ubuntu_jaunty_distroseries_expansion(self):
192- factory = self._make_factory(package='foo', series='jaunty')
193- self.assertEqual(
194- 'http://bazaar.launchpad.net/~branch/ubuntu/jaunty/foo',
195- self.directory._resolve('ubuntu:jaunty/foo', factory)),
196+ self.assertURL('ubuntu/jaunty/foo', 'ubuntu:jaunty/foo',
197+ series='jaunty')
198
199 def test_ubuntu_j_distroseries_expansion(self):
200- factory = self._make_factory(package='foo', series='jaunty')
201- self.assertEqual(
202- 'http://bazaar.launchpad.net/~branch/ubuntu/jaunty/foo',
203- self.directory._resolve('ubuntu:j/foo', factory)),
204+ self.assertURL('ubuntu/jaunty/foo', 'ubuntu:j/foo', series='jaunty')
205
206 def test_ubuntu_hardy_distroseries_expansion(self):
207- factory = self._make_factory(package='foo', series='hardy')
208- self.assertEqual(
209- 'http://bazaar.launchpad.net/~branch/ubuntu/hardy/foo',
210- self.directory._resolve('ubuntu:hardy/foo', factory)),
211+ self.assertURL('ubuntu/hardy/foo', 'ubuntu:hardy/foo', series='hardy')
212
213 def test_ubuntu_h_distroseries_expansion(self):
214- factory = self._make_factory(package='foo', series='hardy')
215- self.assertEqual(
216- 'http://bazaar.launchpad.net/~branch/ubuntu/hardy/foo',
217- self.directory._resolve('ubuntu:h/foo', factory)),
218+ self.assertURL('ubuntu/hardy/foo', 'ubuntu:h/foo', series='hardy')
219
220 def test_ubuntu_dapper_distroseries_expansion(self):
221- factory = self._make_factory(package='foo', series='dapper')
222- self.assertEqual(
223- 'http://bazaar.launchpad.net/~branch/ubuntu/dapper/foo',
224- self.directory._resolve('ubuntu:dapper/foo', factory)),
225+ self.assertURL('ubuntu/dapper/foo', 'ubuntu:dapper/foo',
226+ series='dapper')
227
228 def test_ubuntu_d_distroseries_expansion(self):
229- factory = self._make_factory(package='foo', series='dapper')
230- self.assertEqual(
231- 'http://bazaar.launchpad.net/~branch/ubuntu/dapper/foo',
232- self.directory._resolve('ubuntu:d/foo', factory)),
233+ self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
234
235 # Debian default distro series.
236
237 def test_debian_default_distroseries_expansion(self):
238- factory = self._make_factory(package='foo', distro='debian')
239- self.assertEqual(
240- 'http://bazaar.launchpad.net/~branch/debian/foo',
241- self.directory._resolve('debianlp:foo', factory))
242+ self.assertURL('debian/foo', 'debianlp:foo', distro='debian')
243
244 def test_debian_squeeze_distroseries_expansion(self):
245- factory = self._make_factory(
246- package='foo', distro='debian', series='squeeze')
247- self.assertEqual(
248- 'http://bazaar.launchpad.net/~branch/debian/squeeze/foo',
249- self.directory._resolve('debianlp:squeeze/foo', factory)),
250+ self.assertURL('debian/squeeze/foo', 'debianlp:squeeze/foo',
251+ distro='debian', series='squeeze')
252
253 def test_debian_lenny_distroseries_expansion(self):
254- factory = self._make_factory(
255- package='foo', distro='debian', series='lenny')
256- self.assertEqual(
257- 'http://bazaar.launchpad.net/~branch/debian/lenny/foo',
258- self.directory._resolve('debianlp:lenny/foo', factory)),
259+ self.assertURL('debian/lenny/foo', 'debianlp:lenny/foo',
260+ distro='debian', series='lenny')