Rev 6462: (jelmer) Force lightweight checkouts for colocated branches. (Jelmer in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jan 27 14:56:07 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

------------------------------------------------------------
revno: 6462 [merge]
revision-id: pqm at pqm.ubuntu.com-20120127145606-1t08tdt2ozzv4re5
parent: pqm at pqm.ubuntu.com-20120127140125-211qctcknarkf9w8
parent: jelmer at samba.org-20120120213324-vqwr36azyqzlswwn
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.5
timestamp: Fri 2012-01-27 14:56:06 +0000
message:
  (jelmer) Force lightweight checkouts for colocated branches. (Jelmer
   Vernooij)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2012-01-27 13:33:53 +0000
+++ b/bzrlib/branch.py	2012-01-27 14:56:06 +0000
@@ -1469,6 +1469,10 @@
                 pass
             else:
                 raise errors.AlreadyControlDirError(t.base)
+            if checkout.control_transport.base == self.bzrdir.control_transport.base:
+                # When checking out to the same control directory,
+                # always create a lightweight checkout
+                lightweight = True
 
         if lightweight:
             from_branch = checkout.set_branch_reference(target_branch=self)

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2012-01-18 20:27:41 +0000
+++ b/bzrlib/bzrdir.py	2012-01-20 21:33:24 +0000
@@ -355,6 +355,7 @@
             location of this control directory.
         :param create_tree_if_local: If true, a working-tree will be created
             when working locally.
+        :return: The created control directory
         """
         operation = cleanup.OperationWithCleanups(self._sprout)
         return operation.run(url, revision_id=revision_id,

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2012-01-18 20:35:41 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2012-01-20 21:33:24 +0000
@@ -176,6 +176,21 @@
         target_stat = os.stat('target/file1')
         self.assertEqual(second_stat, target_stat)
 
+    def test_colo_checkout(self):
+        source = self.make_branch_and_tree('source', format='development-colo')
+        self.build_tree(['source/file1'])
+        source.add('file1')
+        source.commit('added file')
+        target = source.bzrdir.sprout('file:second,branch=somebranch',
+            create_tree_if_local=False)
+        out, err = self.run_bzr('checkout file:,branch=somebranch .',
+            working_dir='second')
+        # We should always be creating a lighweight checkout for colocated
+        # branches.
+        self.assertEquals(
+            target.open_branch(name='somebranch').base,
+            target.get_branch_reference(name=""))
+
 
 class TestSmartServerCheckout(TestCaseWithTransport):
 

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-01-27 14:01:25 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-01-27 14:56:06 +0000
@@ -38,6 +38,9 @@
 
 * New HPSS call for ``BzrDir.get_branches``. (Jelmer Vernooij, #894460)
 
+* Checkouts of colocated branches are now always lightweight.
+  (Jelmer Vernooij, #918828)
+
 Bug Fixes
 *********
 




More information about the bazaar-commits mailing list