Rev 3580: Test that make_branch_builder works on a real filesystem. in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/branch_builder

John Arbash Meinel john at arbash-meinel.com
Tue Jul 22 20:27:40 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/branch_builder

------------------------------------------------------------
revno: 3580
revision-id: john at arbash-meinel.com-20080722192636-rv13r9es7hh3di4r
parent: john at arbash-meinel.com-20080722192052-vc2cqzcih8j0lbct
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: branch_builder
timestamp: Tue 2008-07-22 14:26:36 -0500
message:
  Test that make_branch_builder works on a real filesystem.
  
  Also test that we *don't* create a working tree on disk. Because we are going
  to be building things in memory anyway.
-------------- next part --------------
=== modified file 'bzrlib/branchbuilder.py'
--- a/bzrlib/branchbuilder.py	2008-07-22 19:20:52 +0000
+++ b/bzrlib/branchbuilder.py	2008-07-22 19:26:36 +0000
@@ -50,7 +50,7 @@
         if isinstance(format, str):
             format = bzrdir.format_registry.make_bzrdir(format)
         self._branch = bzrdir.BzrDir.create_branch_convenience(transport.base,
-            format=format)
+            format=format, force_new_tree=False)
 
     def build_commit(self):
         """Build a commit on the branch."""

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2008-07-22 19:20:52 +0000
+++ b/bzrlib/tests/test_selftest.py	2008-07-22 19:26:36 +0000
@@ -634,6 +634,18 @@
         self.assertRaises(AssertionError, self.assertIsDirectory, 'a_file', t)
         self.assertRaises(AssertionError, self.assertIsDirectory, 'not_here', t)
 
+    def test_make_branch_builder(self):
+        builder = self.make_branch_builder('dir')
+        rev_id = builder.build_commit()
+        self.failUnlessExists('dir')
+        a_dir = bzrdir.BzrDir.open('dir')
+        self.assertRaises(errors.NoWorkingTree, a_dir.open_workingtree)
+        a_branch = a_dir.open_branch()
+        builder_branch = builder.get_branch()
+        self.assertEqual(a_branch.base, builder_branch.base)
+        self.assertEqual((1, rev_id), builder_branch.last_revision_info())
+        self.assertEqual((1, rev_id), a_branch.last_revision_info())
+
 
 class TestTestCaseTransports(TestCaseWithTransport):
 



More information about the bazaar-commits mailing list