Rev 2449: [BROKEN] Many updates to stop using experimental formats in tests. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Tue Mar 6 00:30:27 GMT 2007


At http://bazaar.launchpad.net/~bzr/bzr/dirstate

------------------------------------------------------------
revno: 2449
revision-id: robertc at robertcollins.net-20070306002836-59i29dpv57h6i8a3
parent: robertc at robertcollins.net-20070306002528-zkvfpjt0dwzwz85l
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate.dogfood
timestamp: Tue 2007-03-06 11:28:36 +1100
message:
  [BROKEN] Many updates to stop using experimental formats in tests.
modified:
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
  bzrlib/tests/test_extract.py   test_extract.py-20061002214140-qdnnm67q1ov6x6pd-1
  bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
  bzrlib/tests/test_subsume.py   test_subsume.py-20060927040024-tsvh4pchajoayymg-1
  bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
  bzrlib/tests/test_testament.py testtestament.py-20051011100429-5df1657310caa929
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-03-02 09:44:41 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-03-06 00:28:36 +0000
@@ -481,7 +481,7 @@
     support_tree_reference = True
 
     def _get_matching_bzrdir(self):
-        return bzrdir.format_registry.make_bzrdir('experimental-reference-dirstate')
+        return bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
 
     def _ignore_setting_bzrdir(self, format):
         pass

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-03-05 06:30:46 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-03-06 00:28:36 +0000
@@ -719,33 +719,32 @@
         subtree2 = self.make_to_branch_and_tree('2/sub')
         subtree2.set_root_id('subtree-id')
         tree2.add_reference(subtree2)
+        tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
         tree1.lock_read()
+        self.addCleanup(tree1.unlock)
         tree2.lock_read()
-        try:
-            self.assertEqual([], list(tree2._iter_changes(tree1)))
-            subtree1.commit('commit', rev_id='commit-a')
-            self.assertEqual([
-                ('root-id',
-                 (u'', u''),
-                 False,
-                 (True, True),
-                 (None, None),
-                 (u'', u''),
-                 ('directory', 'directory'),
-                 (False, False)),
-                ('subtree-id',
-                 ('sub', 'sub',),
-                 False,
-                 (True, True),
-                 ('root-id', 'root-id'),
-                 ('sub', 'sub'),
-                 ('tree-reference', 'tree-reference'),
-                 (False, False))],
-                             list(tree2._iter_changes(tree1,
-                                 include_unchanged=True)))
-        finally:
-            tree1.unlock()
-            tree2.unlock()
+        self.addCleanup(tree2.unlock)
+        self.assertEqual([], list(tree2._iter_changes(tree1)))
+        subtree1.commit('commit', rev_id='commit-a')
+        self.assertEqual([
+            ('root-id',
+             (u'', u''),
+             False,
+             (True, True),
+             (None, None),
+             (u'', u''),
+             ('directory', 'directory'),
+             (False, False)),
+            ('subtree-id',
+             ('sub', 'sub',),
+             False,
+             (True, True),
+             ('root-id', 'root-id'),
+             ('sub', 'sub'),
+             ('tree-reference', 'tree-reference'),
+             (False, False))],
+                         list(tree2._iter_changes(tree1,
+                             include_unchanged=True)))
 
     def test_default_ignores_unversioned_files(self):
         tree1 = self.make_branch_and_tree('tree1')

=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2007-03-05 04:55:34 +0000
+++ b/bzrlib/tests/test_branch.py	2007-03-06 00:28:36 +0000
@@ -190,19 +190,19 @@
         format.set_branch_format(_mod_branch.BzrBranchFormat6())
         branch = self.make_branch('a', format=format)
         self.assertIsInstance(branch, _mod_branch.BzrBranch6)
-        branch = self.make_branch('b', format='experimental-branch6')
+        branch = self.make_branch('b', format='dirstate-with-subtree')
         self.assertIsInstance(branch, _mod_branch.BzrBranch6)
         branch = _mod_branch.Branch.open('a')
         self.assertIsInstance(branch, _mod_branch.BzrBranch6)
 
     def test_layout(self):
-        branch = self.make_branch('a', format='experimental-branch6')
+        branch = self.make_branch('a', format='dirstate-with-subtree')
         self.failUnlessExists('a/.bzr/branch/last-revision')
         self.failIfExists('a/.bzr/branch/revision-history')
 
     def test_config(self):
         """Ensure that all configuration data is stored in the branch"""
-        branch = self.make_branch('a', format='experimental-branch6')
+        branch = self.make_branch('a', format='dirstate-with-subtree')
         branch.set_parent('http://bazaar-vcs.org')
         self.failIfExists('a/.bzr/branch/parent')
         self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
@@ -216,7 +216,7 @@
 
     def test_set_revision_history(self):
         tree = self.make_branch_and_memory_tree('.',
-            format='experimental-branch6')
+            format='dirstate-with-subtree')
         tree.lock_write()
         try:
             tree.add('.')
@@ -231,7 +231,7 @@
 
     def test_append_revision(self):
         tree = self.make_branch_and_tree('branch1',
-            format='experimental-branch6')
+            format='dirstate-with-subtree')
         tree.lock_write()
         try:
             tree.add('.')
@@ -257,11 +257,11 @@
             tree.unlock()
 
     def do_checkout_test(self, lightweight=False):
-        tree = self.make_branch_and_tree('source', format='experimental-reference-dirstate')
-        subtree = self.make_branch_and_tree('source/subtree', 
-                                            format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('source', format='dirstate-with-subtree')
+        subtree = self.make_branch_and_tree('source/subtree',
+            format='dirstate-with-subtree')
         subsubtree = self.make_branch_and_tree('source/subtree/subsubtree',
-                                               format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         self.build_tree(['source/subtree/file',
                          'source/subtree/subsubtree/file'])
         subsubtree.add('file')

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2007-03-05 09:11:33 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2007-03-06 00:28:36 +0000
@@ -132,13 +132,13 @@
         default_factory = bzrdir.format_registry.get('default')
         old_default = [k for k, v in bzrdir.format_registry.iteritems()
                        if v == default_factory and k != 'default'][0]
-        bzrdir.format_registry.set_default_repository('experimental-knit2')
+        bzrdir.format_registry.set_default_repository('dirstate-with-subtree')
         try:
-            self.assertIs(bzrdir.format_registry.get('experimental-knit2'),
+            self.assertIs(bzrdir.format_registry.get('dirstate-with-subtree'),
                           bzrdir.format_registry.get('default'))
             self.assertIs(
                 repository.RepositoryFormat.get_default_format().__class__,
-                knitrepo.RepositoryFormatKnit2)
+                knitrepo.RepositoryFormatKnit3)
         finally:
             bzrdir.format_registry.set_default_repository(old_default)
 
@@ -478,9 +478,9 @@
                           transport)
 
     def test_sprout_recursive(self):
-        tree = self.make_branch_and_tree('tree1', format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('tree1', format='dirstate-with-subtree')
         sub_tree = self.make_branch_and_tree('tree1/subtree',
-                                             format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         tree.add_reference(sub_tree)
         self.build_tree(['tree1/subtree/file'])
         sub_tree.add('file')
@@ -498,16 +498,17 @@
             workingtree.WorkingTreeFormat3)
 
     def test_sprout_recursive_treeless(self):
-        tree = self.make_branch_and_tree('tree1', format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('tree1',
+            format='dirstate-with-subtree')
         sub_tree = self.make_branch_and_tree('tree1/subtree',
-                                             format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         tree.add_reference(sub_tree)
         self.build_tree(['tree1/subtree/file'])
         sub_tree.add('file')
         tree.commit('Initial commit')
         tree.bzrdir.destroy_workingtree()
         repo = self.make_repository('repo', shared=True,
-                                    format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         repo.set_make_working_trees(False)
         tree.bzrdir.sprout('repo/tree2')
         self.failUnlessExists('repo/tree2/subtree')
@@ -551,7 +552,7 @@
         otherdir = bzrdir.format_registry.make_bzrdir('knit')
         self.assertEqual(otherdir, mydir)
         self.assertFalse(otherdir != mydir)
-        otherdir2 = bzrdir.format_registry.make_bzrdir('experimental-knit2')
+        otherdir2 = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
         self.assertNotEqual(otherdir2, mydir)
         self.assertFalse(otherdir2 == mydir)
 
@@ -745,7 +746,7 @@
     def test_checkout_metadir(self):
         # checkout_metadir has reasonable working tree format even when no
         # working tree is present
-        self.make_branch('branch-knit2', format='experimental-knit2')
+        self.make_branch('branch-knit2', format='dirstate-with-subtree')
         my_bzrdir = bzrdir.BzrDir.open(self.get_url('branch-knit2'))
         checkout_format = my_bzrdir.checkout_metadir()
         self.assertIsInstance(checkout_format.workingtree_format,

=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py	2007-03-02 09:44:41 +0000
+++ b/bzrlib/tests/test_commit.py	2007-03-06 00:28:36 +0000
@@ -682,11 +682,12 @@
 
     def test_nested_commit(self):
         """Commit in multiply-nested trees"""
-        tree = self.make_branch_and_tree('.', format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('.',
+            format='dirstate-with-subtree')
         subtree = self.make_branch_and_tree('subtree',
-                                            format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         subsubtree = self.make_branch_and_tree('subtree/subtree',
-                                               format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         subtree.add_reference(subsubtree)
         tree.add_reference(subtree)
         tree.commit('added reference', allow_pointless=False)

=== modified file 'bzrlib/tests/test_extract.py'
--- a/bzrlib/tests/test_extract.py	2007-01-11 03:46:53 +0000
+++ b/bzrlib/tests/test_extract.py	2007-03-06 00:28:36 +0000
@@ -66,15 +66,15 @@
         self.assertEqual(b_branch.base, b_branch_ref.base)
 
     def test_bad_repo_format(self):
-        repo = self.make_repository('branch', shared=True, 
+        repo = self.make_repository('branch', shared=True,
                                     format='knit')
         a_branch = repo.bzrdir.create_branch()
-        self.assertRaises(errors.RootNotRich, self.extract_in_checkout, 
+        self.assertRaises(errors.RootNotRich, self.extract_in_checkout,
                           a_branch)
 
     def test_good_repo_format(self):
-        repo = self.make_repository('branch', shared=True, 
-                                    format='experimental-knit2')
+        repo = self.make_repository('branch', shared=True,
+            format='dirstate-with-subtree')
         a_branch = repo.bzrdir.create_branch()
         wt_b = self.extract_in_checkout(a_branch)
         self.assertEqual(wt_b.branch.repository.bzrdir.transport.base,

=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2007-03-05 04:20:53 +0000
+++ b/bzrlib/tests/test_merge.py	2007-03-06 00:28:36 +0000
@@ -182,9 +182,10 @@
             tree_a.conflicts())
 
     def test_nested_merge(self):
-        tree = self.make_branch_and_tree('tree', format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('tree',
+            format='dirstate-with-subtree')
         sub_tree = self.make_branch_and_tree('tree/sub-tree',
-                                             format='experimental-reference-dirstate')
+            format='dirstate-with-subtree')
         sub_tree.set_root_id('sub-tree-root')
         self.build_tree_contents([('tree/sub-tree/file', 'text1')])
         sub_tree.add('file')

=== modified file 'bzrlib/tests/test_subsume.py'
--- a/bzrlib/tests/test_subsume.py	2007-03-02 09:44:41 +0000
+++ b/bzrlib/tests/test_subsume.py	2007-03-06 00:28:36 +0000
@@ -21,20 +21,20 @@
 
     def make_branch_and_tree(self, relpath, format=None):
         if format is None:
-            format = 'experimental-reference-dirstate'
+            format = 'dirstate-with-subtree'
         return tests.TestCaseWithTransport.make_branch_and_tree(self, relpath, 
                                                                 format)
 
     def make_trees(self, format=None, same_root=False):
-        self.build_tree(['tree/', 
+        self.build_tree(['tree/',
                          'tree/file',
                          'tree/subtree/',
                          'tree/subtree/file2'])
         base_tree = self.make_branch_and_tree('tree', format=format)
         base_tree.add('file', 'file-id')
         base_tree.commit('first commit', rev_id='tree-1')
-        sub_tree = self.make_branch_and_tree('tree/subtree', 
-                                             format='experimental-reference-dirstate')
+        sub_tree = self.make_branch_and_tree('tree/subtree',
+            format='dirstate-with-subtree')
         if same_root is True:
             sub_tree.set_root_id(base_tree.get_root_id())
         sub_tree.add('file2', 'file2-id')
@@ -77,16 +77,18 @@
         base_tree.commit('combined', rev_id='combined-1')
         self.assertEqual('file2-id', base_tree.path2id('subtree/file2'))
         self.assertEqual('subtree/file2', base_tree.id2path('file2-id'))
-        self.assertEqualDiff(file2_contents, 
+        self.assertEqualDiff(file2_contents,
                              base_tree.get_file_text('file2-id'))
         basis_tree = base_tree.basis_tree()
-        self.assertEqualDiff(file2_contents, 
+        basis_tree.lock_read()
+        self.addCleanup(basis_tree.unlock)
+        self.assertEqualDiff(file2_contents,
                              base_tree.get_file_text('file2-id'))
-        self.assertEqualDiff(file2_contents, 
+        self.assertEqualDiff(file2_contents,
                              basis_tree.get_file_text('file2-id'))
-        self.assertEqual('subtree-1', 
+        self.assertEqual('subtree-1',
                          basis_tree.inventory['file2-id'].revision)
-        self.assertEqual('combined-1', 
+        self.assertEqual('combined-1',
                          basis_tree.inventory[sub_root_id].revision)
 
     def test_subsume_failure(self):

=== modified file 'bzrlib/tests/test_tag.py'
--- a/bzrlib/tests/test_tag.py	2007-02-22 04:52:06 +0000
+++ b/bzrlib/tests/test_tag.py	2007-03-06 00:28:36 +0000
@@ -27,7 +27,7 @@
     )
 from bzrlib.tests import (
     TestCase,
-    TestCaseInTempDir,
+    TestCaseWithTransport,
     )
 
 
@@ -48,15 +48,14 @@
         self.assertEqual(store._deserialize_tag_dict(packed), td)
 
 
-class TestTagMerging(TestCaseInTempDir):
+class TestTagMerging(TestCaseWithTransport):
 
     def make_knit_branch(self, relpath):
         old_bdf = bzrdir.format_registry.make_bzrdir('knit')
         return bzrdir.BzrDir.create_branch_convenience(relpath, format=old_bdf)
 
     def make_branch_supporting_tags(self, relpath):
-        new_bdf = bzrdir.format_registry.make_bzrdir('experimental-branch6')
-        return bzrdir.BzrDir.create_branch_convenience(relpath, format=new_bdf)
+        return self.make_branch(relpath, format='dirstate-with-subtree')
 
     def test_merge_not_possible(self):
         # test merging between branches which do and don't support tags

=== modified file 'bzrlib/tests/test_testament.py'
--- a/bzrlib/tests/test_testament.py	2007-02-09 20:35:15 +0000
+++ b/bzrlib/tests/test_testament.py	2007-03-06 00:28:36 +0000
@@ -31,7 +31,7 @@
 
     def setUp(self):
         super(TestamentSetup, self).setUp()
-        self.wt = self.make_branch_and_tree('.', format='experimental-knit2')
+        self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')
         self.wt.set_root_id('TREE_ROT')
         b = self.b = self.wt.branch
         b.nick = "test branch"

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2007-03-05 04:15:38 +0000
+++ b/bzrlib/tests/test_transform.py	2007-03-06 00:28:36 +0000
@@ -44,7 +44,7 @@
 
     def setUp(self):
         super(TestTreeTransform, self).setUp()
-        self.wt = self.make_branch_and_tree('.', format='experimental-reference-dirstate')
+        self.wt = self.make_branch_and_tree('.', format='dirstate-with-subtree')
         os.chdir('..')
 
     def get_transform(self):
@@ -127,7 +127,7 @@
         self.assertEqual(self.wt.path2id('oz/dorothy'), 'dorothy-id')
         self.assertEqual(self.wt.path2id('oz/dorothy/toto'), 'toto-id')
 
-        self.assertEqual('toto-contents', 
+        self.assertEqual('toto-contents',
                          self.wt.get_file_byname('oz/dorothy/toto').read())
         self.assertIs(self.wt.is_executable('toto-id'), False)
 
@@ -137,7 +137,9 @@
         trans_id = transform.new_directory('reference', root, 'subtree-id')
         transform.set_tree_reference('subtree-revision', trans_id)
         transform.apply()
-        self.assertEqual('subtree-revision', 
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual('subtree-revision',
                          tree.inventory['subtree-id'].reference_revision)
 
     def test_conflicts(self):
@@ -967,15 +969,19 @@
         a.add(['foo', 'foo/bar', 'foo/baz'])
         a.commit('initial commit')
         b = BzrDir.create_standalone_workingtree('b')
-        build_tree(a.basis_tree(), b)
+        basis = a.basis_tree()
+        basis.lock_read()
+        self.addCleanup(basis.unlock)
+        build_tree(basis, b)
         self.assertIs(os.path.isdir('b/foo'), True)
         self.assertEqual(file('b/foo/bar', 'rb').read(), "contents")
         self.assertEqual(os.readlink('b/foo/baz'), 'a/foo/bar')
 
     def test_build_with_references(self):
-        tree = self.make_branch_and_tree('source', format='experimental-reference-dirstate')
-        subtree = self.make_branch_and_tree('source/subtree', 
-                                            format='experimental-reference-dirstate')
+        tree = self.make_branch_and_tree('source',
+            format='dirstate-with-subtree')
+        subtree = self.make_branch_and_tree('source/subtree',
+            format='dirstate-with-subtree')
         tree.add_reference(subtree)
         tree.commit('a revision')
         tree.branch.create_checkout('target')

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2007-03-05 05:06:00 +0000
+++ b/bzrlib/transform.py	2007-03-06 00:28:36 +0000
@@ -1138,7 +1138,16 @@
     top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
     pp = ProgressPhase("Build phase", 2, top_pb)
     if tree.inventory.root is not None:
-        wt.set_root_id(tree.inventory.root.file_id)
+        # this is kindof a hack: we should be altering the root 
+        # as partof the regular tree shape diff logic.
+        # the conditional test hereis to avoid doing an
+        # expensive operation (flush) every time the root id
+        # is set within the tree, nor setting the root and thus
+        # marking the tree as dirty, because we use two different
+        # idioms here: tree interfaces and inventory interfaces.
+        if wt.path2id('') != tree.inventory.root.file_id:
+            wt.set_root_id(tree.inventory.root.file_id)
+            wt.flush()
     tt = TreeTransform(wt)
     divert = set()
     try:

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-03-05 04:55:34 +0000
+++ b/bzrlib/workingtree.py	2007-03-06 00:28:36 +0000
@@ -899,16 +899,16 @@
                 if child_entry.kind == 'directory':
                     add_children(inventory, child_entry)
         if other_tree.get_root_id() == self.get_root_id():
-            raise errors.BadSubsumeSource(self, other_tree, 
+            raise errors.BadSubsumeSource(self, other_tree,
                                           'Trees have the same root')
         try:
             other_tree_path = self.relpath(other_tree.basedir)
         except errors.PathNotChild:
-            raise errors.BadSubsumeSource(self, other_tree, 
+            raise errors.BadSubsumeSource(self, other_tree,
                 'Tree is not contained by the other')
         new_root_parent = self.path2id(osutils.dirname(other_tree_path))
         if new_root_parent is None:
-            raise errors.BadSubsumeSource(self, other_tree, 
+            raise errors.BadSubsumeSource(self, other_tree,
                 'Parent directory is not versioned.')
         # We need to ensure that the result of a fetch will have a
         # versionedfile for the other_tree root, and only fetching into
@@ -917,15 +917,16 @@
             raise errors.SubsumeTargetNeedsUpgrade(other_tree)
         other_tree.lock_tree_write()
         try:
-            for parent_id in other_tree.get_parent_ids():
-                self.branch.fetch(other_tree.branch, parent_id)
-                self.add_parent_tree_id(parent_id)
+            new_parents = other_tree.get_parent_ids()
             other_root = other_tree.inventory.root
             other_root.parent_id = new_root_parent
             other_root.name = osutils.basename(other_tree_path)
             self.inventory.add(other_root)
             add_children(self.inventory, other_root)
             self._write_inventory(self.inventory)
+            for parent_id in other_tree.get_parent_ids():
+                self.branch.fetch(other_tree.branch, parent_id)
+                self.add_parent_tree_id(parent_id)
         finally:
             other_tree.unlock()
         other_tree.bzrdir.destroy_workingtree_metadata()
@@ -950,7 +951,7 @@
         sub_path = self.id2path(file_id)
         branch_transport = mkdirs(sub_path)
         if format is None:
-            format = bzrdir.format_registry.make_bzrdir('experimental-knit2')
+            format = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
         try:
             branch_transport.mkdir('.')
         except errors.FileExists:

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-06 00:25:28 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-06 00:28:36 +0000
@@ -335,6 +335,10 @@
                 elif kind == 'directory':
                     # add this entry to the parent map.
                     parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
+                elif kind == 'tree-reference':
+                    inv_entry.reference_revision = fingerprint
+                else:
+                    assert 'unknown kind'
                 # These checks cost us around 40ms on a 55k entry tree
                 assert file_id not in inv_byid, ('file_id %s already in'
                     ' inventory as %s' % (file_id, inv_byid[file_id]))
@@ -997,7 +1001,6 @@
         state.set_path_id('', file_id)
         if state._dirblock_state == dirstate.DirState.IN_MEMORY_MODIFIED:
             self._make_dirty(reset_inventory=True)
-        state.save()
 
     def unlock(self):
         """Unlock in format 4 trees needs to write the entire dirstate."""
@@ -1205,7 +1208,7 @@
     def __get_matchingbzrdir(self):
         # please test against something that will let us do tree references
         return bzrdir.format_registry.make_bzrdir(
-            'experimental-reference-dirstate')
+            'dirstate-with-subtree')
 
     _matchingbzrdir = property(__get_matchingbzrdir)
 
@@ -2202,7 +2205,11 @@
         transport = tree.bzrdir.get_workingtree_transport(None)
         for path in ['basis-inventory-cache', 'inventory', 'last-revision',
             'pending-merges', 'stat-cache']:
-            transport.delete(path)
+            try:
+                transport.delete(path)
+            except errors.NoSuchFile:
+                # some files are optional - just deal.
+                pass
 
     def update_format(self, tree):
         """Change the format marker."""



More information about the bazaar-commits mailing list