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

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
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 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.
Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
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.

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Revision history for this message
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.

Revision history for this message
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'

Revision history for this message
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 ;)

Revision history for this message
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
=== modified file 'NEWS'
--- NEWS 2010-10-12 07:24:49 +0000
+++ NEWS 2010-10-12 07:24:50 +0000
@@ -16,6 +16,13 @@
16New Features16New Features
17************17************
1818
19* New shortcut url schemes ``ubuntu:`` and ``debianlp:`` access source
20 branches on Launchpad. E.g. ``bzr branch ubuntu:foo`` gives you the source
21 branch for project ``foo`` in the current distroseries for Ubuntu while
22 ``bzr branch debianlp:lenny/foo`` gives you the source branch (on Launchpad)
23 for project ``foo`` in Debian Lenny.
24 (Barry Warsaw, #609186)
25
19* Provide a configuration option "default_format" that controls the26* Provide a configuration option "default_format" that controls the
20 default format for new branches created with ``bzr init``.27 default format for new branches created with ``bzr init``.
21 (Neil Martinsen-Burrell, #484101)28 (Neil Martinsen-Burrell, #484101)
@@ -66,13 +73,6 @@
66New Features73New Features
67************74************
6875
69* New shortcut url schemes ``ubuntu:`` and ``debianlp:`` access source
70 branches on Launchpad. E.g. ``bzr branch ubuntu:foo`` gives you the source
71 branch for project ``foo`` in the current distroseries for Ubuntu while
72 ``bzr branch debianlp:lenny/foo`` gives you the source branch (on Launchpad)
73 for project ``foo`` in Debian Lenny.
74 (Barry Warsaw, #609186)
75
76* Add ``mainline`` revision specifier, which selects the revision that76* Add ``mainline`` revision specifier, which selects the revision that
77 merged a specified revision into the mainline. (Aaron Bentley)77 merged a specified revision into the mainline. (Aaron Bentley)
7878
7979
=== modified file 'bzrlib/plugins/launchpad/lp_directory.py'
--- bzrlib/plugins/launchpad/lp_directory.py 2010-10-12 07:24:49 +0000
+++ bzrlib/plugins/launchpad/lp_directory.py 2010-10-12 07:24:50 +0000
@@ -73,12 +73,12 @@
73 _lp_login=None):73 _lp_login=None):
74 """Resolve the base URL for this transport."""74 """Resolve the base URL for this transport."""
75 # Do ubuntu: and debianlp: expansions.75 # Do ubuntu: and debianlp: expansions.
76 result = urlsplit(url)76 scheme, netloc, path, query, fragment = urlsplit(url)
77 if result.scheme in ('ubuntu', 'debianlp'):77 if scheme in ('ubuntu', 'debianlp'):
78 if result.scheme == 'ubuntu':78 if scheme == 'ubuntu':
79 distro = 'ubuntu'79 distro = 'ubuntu'
80 distro_series = _ubuntu_series_shortcuts80 distro_series = _ubuntu_series_shortcuts
81 elif result.scheme == 'debianlp':81 elif scheme == 'debianlp':
82 distro = 'debian'82 distro = 'debian'
83 # No shortcuts for Debian distroseries.83 # No shortcuts for Debian distroseries.
84 distro_series = {}84 distro_series = {}
@@ -87,7 +87,7 @@
87 # Split the path. It's either going to be 'project' or87 # Split the path. It's either going to be 'project' or
88 # 'series/project', but recognize that it may be a series we don't88 # 'series/project', but recognize that it may be a series we don't
89 # know about.89 # know about.
90 path_parts = result.path.split('/')90 path_parts = path.split('/')
91 if len(path_parts) == 1:91 if len(path_parts) == 1:
92 # It's just a project name.92 # It's just a project name.
93 lp_url_template = 'lp:%(distro)s/%(project)s'93 lp_url_template = 'lp:%(distro)s/%(project)s'
@@ -108,11 +108,11 @@
108 distro=distro,108 distro=distro,
109 series=series,109 series=series,
110 project=project)110 project=project)
111 result = urlsplit(url)111 scheme, netloc, path, query, fragment = urlsplit(url)
112 service = LaunchpadService.for_url(url)112 service = LaunchpadService.for_url(url)
113 if _lp_login is None:113 if _lp_login is None:
114 _lp_login = get_lp_login()114 _lp_login = get_lp_login()
115 path = result[2].strip('/')115 path = path.strip('/')
116 if path.startswith('~/'):116 if path.startswith('~/'):
117 if _lp_login is None:117 if _lp_login is None:
118 raise errors.InvalidURL(path=url,118 raise errors.InvalidURL(path=url,
119119
=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
--- bzrlib/plugins/launchpad/test_lp_directory.py 2010-10-12 07:24:49 +0000
+++ bzrlib/plugins/launchpad/test_lp_directory.py 2010-10-12 07:24:50 +0000
@@ -375,6 +375,13 @@
375 self, path, dict(urls=[375 self, path, dict(urls=[
376 'http://bazaar.launchpad.net/' + url_suffix]))376 'http://bazaar.launchpad.net/' + url_suffix]))
377377
378 def assertURL(self, expected_url, shortcut, package='foo', distro='ubuntu',
379 series=None):
380 factory = self._make_factory(package=package, distro=distro,
381 series=series)
382 self.assertEqual('http://bazaar.launchpad.net/~branch/' + expected_url,
383 self.directory._resolve(shortcut, factory))
384
378 # Bogus distro.385 # Bogus distro.
379386
380 def test_bogus_distro(self):387 def test_bogus_distro(self):
@@ -392,137 +399,81 @@
392 def test_missing_ubuntu_distroseries_without_project(self):399 def test_missing_ubuntu_distroseries_without_project(self):
393 # Launchpad does not hold source packages for Intrepid. Missing or400 # Launchpad does not hold source packages for Intrepid. Missing or
394 # bogus distroseries with no project name is treated like a project.401 # bogus distroseries with no project name is treated like a project.
395 factory = self._make_factory(package='intrepid')402 self.assertURL('ubuntu/intrepid', 'ubuntu:intrepid', package='intrepid')
396 self.assertEqual(
397 'http://bazaar.launchpad.net/~branch/ubuntu/intrepid',
398 self.directory._resolve('ubuntu:intrepid', factory))
399403
400 def test_missing_ubuntu_distroseries_with_project(self):404 def test_missing_ubuntu_distroseries_with_project(self):
401 # Launchpad does not hold source packages for Intrepid. Missing or405 # Launchpad does not hold source packages for Intrepid. Missing or
402 # bogus distroseries with a project name is treated like an unknown406 # bogus distroseries with a project name is treated like an unknown
403 # series (i.e. we keep it verbatim).407 # series (i.e. we keep it verbatim).
404 factory = self._make_factory(series='intrepid')408 self.assertURL('ubuntu/intrepid/foo',
405 self.assertEqual(409 'ubuntu:intrepid/foo', series='intrepid')
406 'http://bazaar.launchpad.net/~branch/ubuntu/intrepid/foo',
407 self.directory._resolve('ubuntu:intrepid/foo', factory))
408410
409 def test_missing_debian_distroseries(self):411 def test_missing_debian_distroseries(self):
410 # Launchpad does not hold source packages for unstable. Missing or412 # Launchpad does not hold source packages for unstable. Missing or
411 # bogus distroseries is treated like a project.413 # bogus distroseries is treated like a project.
412 factory = self._make_factory(package='sid', distro='debian')414 self.assertURL('debian/sid',
413 self.assertEqual(415 'debianlp:sid', package='sid', distro='debian')
414 'http://bazaar.launchpad.net/~branch/debian/sid',
415 self.directory._resolve('debianlp:sid', factory))
416416
417 # Ubuntu Default distro series.417 # Ubuntu Default distro series.
418418
419 def test_ubuntu_default_distroseries_expansion(self):419 def test_ubuntu_default_distroseries_expansion(self):
420 factory = self._make_factory(package='foo')420 self.assertURL('ubuntu/foo', 'ubuntu:foo')
421 self.assertEqual('http://bazaar.launchpad.net/~branch/ubuntu/foo',
422 self.directory._resolve('ubuntu:foo', factory)),
423421
424 def test_ubuntu_natty_distroseries_expansion(self):422 def test_ubuntu_natty_distroseries_expansion(self):
425 factory = self._make_factory(package='foo', series='natty')423 self.assertURL('ubuntu/natty/foo', 'ubuntu:natty/foo', series='natty')
426 self.assertEqual(
427 'http://bazaar.launchpad.net/~branch/ubuntu/natty/foo',
428 self.directory._resolve('ubuntu:natty/foo', factory)),
429424
430 def test_ubuntu_n_distroseries_expansion(self):425 def test_ubuntu_n_distroseries_expansion(self):
431 factory = self._make_factory(package='foo', series='natty')426 self.assertURL('ubuntu/natty/foo', 'ubuntu:n/foo', series='natty')
432 self.assertEqual(
433 'http://bazaar.launchpad.net/~branch/ubuntu/natty/foo',
434 self.directory._resolve('ubuntu:n/foo', factory)),
435427
436 def test_ubuntu_maverick_distroseries_expansion(self):428 def test_ubuntu_maverick_distroseries_expansion(self):
437 factory = self._make_factory(package='foo', series='maverick')429 self.assertURL('ubuntu/maverick/foo', 'ubuntu:maverick/foo',
438 self.assertEqual(430 series='maverick')
439 'http://bazaar.launchpad.net/~branch/ubuntu/maverick/foo',
440 self.directory._resolve('ubuntu:maverick/foo', factory)),
441431
442 def test_ubuntu_m_distroseries_expansion(self):432 def test_ubuntu_m_distroseries_expansion(self):
443 factory = self._make_factory(package='foo', series='maverick')433 self.assertURL('ubuntu/maverick/foo', 'ubuntu:m/foo', series='maverick')
444 self.assertEqual(
445 'http://bazaar.launchpad.net/~branch/ubuntu/maverick/foo',
446 self.directory._resolve('ubuntu:m/foo', factory)),
447434
448 def test_ubuntu_lucid_distroseries_expansion(self):435 def test_ubuntu_lucid_distroseries_expansion(self):
449 factory = self._make_factory(package='foo', series='lucid')436 self.assertURL('ubuntu/lucid/foo', 'ubuntu:lucid/foo', series='lucid')
450 self.assertEqual(
451 'http://bazaar.launchpad.net/~branch/ubuntu/lucid/foo',
452 self.directory._resolve('ubuntu:lucid/foo', factory)),
453437
454 def test_ubuntu_l_distroseries_expansion(self):438 def test_ubuntu_l_distroseries_expansion(self):
455 factory = self._make_factory(package='foo', series='lucid')439 self.assertURL('ubuntu/lucid/foo', 'ubuntu:l/foo', series='lucid')
456 self.assertEqual(
457 'http://bazaar.launchpad.net/~branch/ubuntu/lucid/foo',
458 self.directory._resolve('ubuntu:l/foo', factory)),
459440
460 def test_ubuntu_karmic_distroseries_expansion(self):441 def test_ubuntu_karmic_distroseries_expansion(self):
461 factory = self._make_factory(package='foo', series='karmic')442 self.assertURL('ubuntu/karmic/foo', 'ubuntu:karmic/foo',
462 self.assertEqual(443 series='karmic')
463 'http://bazaar.launchpad.net/~branch/ubuntu/karmic/foo',
464 self.directory._resolve('ubuntu:karmic/foo', factory)),
465444
466 def test_ubuntu_k_distroseries_expansion(self):445 def test_ubuntu_k_distroseries_expansion(self):
467 factory = self._make_factory(package='foo', series='karmic')446 self.assertURL('ubuntu/karmic/foo', 'ubuntu:k/foo', series='karmic')
468 self.assertEqual(
469 'http://bazaar.launchpad.net/~branch/ubuntu/karmic/foo',
470 self.directory._resolve('ubuntu:k/foo', factory)),
471447
472 def test_ubuntu_jaunty_distroseries_expansion(self):448 def test_ubuntu_jaunty_distroseries_expansion(self):
473 factory = self._make_factory(package='foo', series='jaunty')449 self.assertURL('ubuntu/jaunty/foo', 'ubuntu:jaunty/foo',
474 self.assertEqual(450 series='jaunty')
475 'http://bazaar.launchpad.net/~branch/ubuntu/jaunty/foo',
476 self.directory._resolve('ubuntu:jaunty/foo', factory)),
477451
478 def test_ubuntu_j_distroseries_expansion(self):452 def test_ubuntu_j_distroseries_expansion(self):
479 factory = self._make_factory(package='foo', series='jaunty')453 self.assertURL('ubuntu/jaunty/foo', 'ubuntu:j/foo', series='jaunty')
480 self.assertEqual(
481 'http://bazaar.launchpad.net/~branch/ubuntu/jaunty/foo',
482 self.directory._resolve('ubuntu:j/foo', factory)),
483454
484 def test_ubuntu_hardy_distroseries_expansion(self):455 def test_ubuntu_hardy_distroseries_expansion(self):
485 factory = self._make_factory(package='foo', series='hardy')456 self.assertURL('ubuntu/hardy/foo', 'ubuntu:hardy/foo', series='hardy')
486 self.assertEqual(
487 'http://bazaar.launchpad.net/~branch/ubuntu/hardy/foo',
488 self.directory._resolve('ubuntu:hardy/foo', factory)),
489457
490 def test_ubuntu_h_distroseries_expansion(self):458 def test_ubuntu_h_distroseries_expansion(self):
491 factory = self._make_factory(package='foo', series='hardy')459 self.assertURL('ubuntu/hardy/foo', 'ubuntu:h/foo', series='hardy')
492 self.assertEqual(
493 'http://bazaar.launchpad.net/~branch/ubuntu/hardy/foo',
494 self.directory._resolve('ubuntu:h/foo', factory)),
495460
496 def test_ubuntu_dapper_distroseries_expansion(self):461 def test_ubuntu_dapper_distroseries_expansion(self):
497 factory = self._make_factory(package='foo', series='dapper')462 self.assertURL('ubuntu/dapper/foo', 'ubuntu:dapper/foo',
498 self.assertEqual(463 series='dapper')
499 'http://bazaar.launchpad.net/~branch/ubuntu/dapper/foo',
500 self.directory._resolve('ubuntu:dapper/foo', factory)),
501464
502 def test_ubuntu_d_distroseries_expansion(self):465 def test_ubuntu_d_distroseries_expansion(self):
503 factory = self._make_factory(package='foo', series='dapper')466 self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
504 self.assertEqual(
505 'http://bazaar.launchpad.net/~branch/ubuntu/dapper/foo',
506 self.directory._resolve('ubuntu:d/foo', factory)),
507467
508 # Debian default distro series.468 # Debian default distro series.
509469
510 def test_debian_default_distroseries_expansion(self):470 def test_debian_default_distroseries_expansion(self):
511 factory = self._make_factory(package='foo', distro='debian')471 self.assertURL('debian/foo', 'debianlp:foo', distro='debian')
512 self.assertEqual(
513 'http://bazaar.launchpad.net/~branch/debian/foo',
514 self.directory._resolve('debianlp:foo', factory))
515472
516 def test_debian_squeeze_distroseries_expansion(self):473 def test_debian_squeeze_distroseries_expansion(self):
517 factory = self._make_factory(474 self.assertURL('debian/squeeze/foo', 'debianlp:squeeze/foo',
518 package='foo', distro='debian', series='squeeze')475 distro='debian', series='squeeze')
519 self.assertEqual(
520 'http://bazaar.launchpad.net/~branch/debian/squeeze/foo',
521 self.directory._resolve('debianlp:squeeze/foo', factory)),
522476
523 def test_debian_lenny_distroseries_expansion(self):477 def test_debian_lenny_distroseries_expansion(self):
524 factory = self._make_factory(478 self.assertURL('debian/lenny/foo', 'debianlp:lenny/foo',
525 package='foo', distro='debian', series='lenny')479 distro='debian', series='lenny')
526 self.assertEqual(
527 'http://bazaar.launchpad.net/~branch/debian/lenny/foo',
528 self.directory._resolve('debianlp:lenny/foo', factory)),