Rev 4916: (nmb) bug #495263, bzr switch -b lp:foo now properly looks up lp:foo in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Dec 21 21:58:40 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4916 [merge]
revision-id: pqm at pqm.ubuntu.com-20091221215837-thx3t4d1icq41ybx
parent: pqm at pqm.ubuntu.com-20091221205339-8d82e7621l5n8ya7
parent: john at arbash-meinel.com-20091221172506-8soy65j60p00soep
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-12-21 21:58:37 +0000
message:
  (nmb) bug #495263, bzr switch -b lp:foo now properly looks up lp:foo
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
=== modified file 'NEWS'
--- a/NEWS	2009-12-18 09:05:13 +0000
+++ b/NEWS	2009-12-21 17:25:06 +0000
@@ -26,6 +26,10 @@
 Bug Fixes
 *********
 
+* ``bzr switch -b`` can now create branches that are located using directory
+  services such as ``lp:``, even when the branch name doesn't contain a
+  '/'.  (Neil Martinsen-Burrell, #495263)
+
 * ``bzr unshelve`` has improved messages about what it is doing.
   (Neil Martinsen-Burrell, #496917)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-12-14 16:04:27 +0000
+++ b/bzrlib/builtins.py	2009-12-21 17:24:22 +0000
@@ -31,6 +31,7 @@
     bundle,
     btree_index,
     bzrdir,
+    directory_service,
     delta,
     config,
     errors,
@@ -5488,6 +5489,8 @@
             if branch is None:
                 raise errors.BzrCommandError('cannot create branch without'
                                              ' source branch')
+            to_location = directory_service.directories.dereference(
+                              to_location)
             if '/' not in to_location and '\\' not in to_location:
                 # This path is meant to be relative to the existing branch
                 this_url = self._get_branch_location(control_dir)

=== modified file 'bzrlib/tests/blackbox/test_switch.py'
--- a/bzrlib/tests/blackbox/test_switch.py	2009-07-09 15:18:57 +0000
+++ b/bzrlib/tests/blackbox/test_switch.py	2009-12-11 17:04:09 +0000
@@ -22,6 +22,7 @@
 
 from bzrlib.workingtree import WorkingTree
 from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.directory_service import directories
 
 
 class TestSwitch(ExternalBase):
@@ -183,3 +184,16 @@
         # The new branch should have been created at the same level as
         # 'branch', because we did not have a '/' segment
         self.assertEqual(branch.base[:-1] + '2/', tree.branch.base)
+
+    def test_create_branch_directory_services(self):
+        branch = self.make_branch('branch')
+        tree = branch.create_checkout('tree', lightweight=True)
+        class FooLookup(object):
+            def look_up(self, name, url):
+                return 'foo-'+name
+        directories.register('foo:', FooLookup, 'Create branches named foo-')
+        self.addCleanup(directories.remove, 'foo:')
+        self.run_bzr('switch -b foo:branch2', working_dir='tree')
+        tree = WorkingTree.open('tree')
+        self.assertEndsWith(tree.branch.base, 'foo-branch2/')
+




More information about the bazaar-commits mailing list