Rev 2951: MemoryTree is not tested under the tree_implementations tests. in http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/tree_root_id

John Arbash Meinel john at arbash-meinel.com
Tue Nov 13 16:59:50 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/tree_root_id

------------------------------------------------------------
revno: 2951
revision-id:john at arbash-meinel.com-20071113164256-yvnccvwwwpkxgef0
parent: john at arbash-meinel.com-20071113160520-k3govxcdlfursew8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: tree_root_id
timestamp: Tue 2007-11-13 10:42:56 -0600
message:
  MemoryTree is not tested under the tree_implementations tests.
  So we need a specific test to make sure that it is properly handling
  the Tree.get_root_id() interface.
modified:
  bzrlib/memorytree.py           memorytree.py-20060906023413-4wlkalbdpsxi2r4y-1
  bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
-------------- next part --------------
=== modified file 'bzrlib/memorytree.py'
--- a/bzrlib/memorytree.py	2007-09-05 05:51:34 +0000
+++ b/bzrlib/memorytree.py	2007-11-13 16:42:56 +0000
@@ -92,6 +92,9 @@
         stream = self._file_transport.get(path)
         return sha_file(stream)
 
+    def get_root_id(self):
+        return self.path2id('')
+
     def _comparison_data(self, entry, path):
         """See Tree._comparison_data."""
         if entry is None:

=== modified file 'bzrlib/tests/test_memorytree.py'
--- a/bzrlib/tests/test_memorytree.py	2006-10-15 15:55:32 +0000
+++ b/bzrlib/tests/test_memorytree.py	2007-11-13 16:42:56 +0000
@@ -52,6 +52,16 @@
             tree.get_file(tree.path2id('foo')).read())
         tree.unlock()
 
+    def test_get_root_id(self):
+        branch = self.make_branch('branch')
+        tree = MemoryTree.create_on_branch(branch)
+        tree.lock_write()
+        try:
+            tree.add([''])
+            self.assertIsNot(None, tree.get_root_id())
+        finally:
+            tree.unlock()
+
     def test_lock_tree_write(self):
         """Check we can lock_tree_write and unlock MemoryTrees."""
         branch = self.make_branch('branch')



More information about the bazaar-commits mailing list