Rev 3583: Use the new BranchBuilder api in a Branch test in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/use_branch_builder

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


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

------------------------------------------------------------
revno: 3583
revision-id: john at arbash-meinel.com-20080722194840-dqp3t6mc12f2s36n
parent: john at arbash-meinel.com-20080722194501-mmxs3jkr6wqm7lj6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: use_branch_builder
timestamp: Tue 2008-07-22 14:48:40 -0500
message:
  Use the new BranchBuilder api in a Branch test
-------------- next part --------------
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2008-07-16 07:30:18 +0000
+++ b/bzrlib/tests/test_branch.py	2008-07-22 19:48:40 +0000
@@ -243,19 +243,18 @@
         self.assertEqual('ftp://bazaar-vcs.org', branch.get_bound_location())
 
     def test_set_revision_history(self):
-        tree = self.make_branch_and_memory_tree('.',
-            format=self.get_format_name())
-        tree.lock_write()
-        try:
-            tree.add('.')
-            tree.commit('foo', rev_id='foo')
-            tree.commit('bar', rev_id='bar')
-            tree.branch.set_revision_history(['foo', 'bar'])
-            tree.branch.set_revision_history(['foo'])
-            self.assertRaises(errors.NotLefthandHistory,
-                              tree.branch.set_revision_history, ['bar'])
-        finally:
-            tree.unlock()
+        builder = self.make_branch_builder('.', format=self.get_format_name())
+        builder.build_snapshot('foo', None,
+            [('add', ('', None, 'directory', None))],
+            message='foo')
+        builder.build_snapshot('bar', None, [], message='bar')
+        branch = builder.get_branch()
+        branch.lock_write()
+        self.addCleanup(branch.unlock)
+        branch.set_revision_history(['foo', 'bar'])
+        branch.set_revision_history(['foo'])
+        self.assertRaises(errors.NotLefthandHistory,
+                          branch.set_revision_history, ['bar'])
 
     def do_checkout_test(self, lightweight=False):
         tree = self.make_branch_and_tree('source',



More information about the bazaar-commits mailing list