Rev 6275: (jelmer) Use colocated branch name when determining the name of a new in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Nov 17 19:00:47 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6275 [merge]
revision-id: pqm at pqm.ubuntu.com-20111117190047-e2773128biccz770
parent: pqm at pqm.ubuntu.com-20111117180646-k4mtsuzgseulh81c
parent: jelmer at samba.org-20111113032240-aadj493l3h5iqzfd
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-11-17 19:00:47 +0000
message:
  (jelmer) Use colocated branch name when determining the name of a new
   branch. (Jelmer Vernooij)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-11-17 00:12:43 +0000
+++ b/bzrlib/builtins.py	2011-11-17 19:00:47 +0000
@@ -1312,7 +1312,9 @@
             # RBC 20060209
             revision_id = br_from.last_revision()
         if to_location is None:
-            to_location = urlutils.derive_to_location(from_location)
+            to_location = getattr(br_from, "name", None)
+            if to_location is None:
+                to_location = urlutils.derive_to_location(from_location)
         to_transport = transport.get_transport(to_location)
         try:
             to_transport.mkdir('.')

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2011-11-17 18:06:46 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2011-11-17 19:00:47 +0000
@@ -44,14 +44,15 @@
 
 class TestBranch(TestCaseWithTransport):
 
-    def example_branch(self, path='.'):
-        tree = self.make_branch_and_tree(path)
+    def example_branch(self, path='.', format=None):
+        tree = self.make_branch_and_tree(path, format=format)
         self.build_tree_contents([(path + '/hello', 'foo')])
         tree.add('hello')
         tree.commit(message='setup')
         self.build_tree_contents([(path + '/goodbye', 'baz')])
         tree.add('goodbye')
         tree.commit(message='setup')
+        return tree
 
     def test_branch(self):
         """Branch from one branch to another."""
@@ -83,6 +84,16 @@
         self.assertEqual('', out)
         self.assertEqual('bzr: ERROR: Already a branch: "file:b,branch=orig".\n', err)
 
+    def test_from_colocated(self):
+        """Branch from a colocated branch into a regular branch."""
+        tree = self.example_branch('a', format='development-colo')
+        tree.bzrdir.create_branch(name='somecolo')
+        out, err = self.run_bzr('branch %s,branch=somecolo' %
+            local_path_to_url('a'))
+        self.assertEqual('', out)
+        self.assertEqual('Branched 0 revisions.\n', err)
+        self.assertPathExists("somecolo")
+
     def test_branch_broken_pack(self):
         """branching with a corrupted pack file."""
         self.example_branch('a')




More information about the bazaar-commits mailing list