Rev 2982: (John Arbash Meinel) Consolidate all calls to get the root id of a tree to use Tree.get_root_id() in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 13 17:48:53 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2982
revision-id: pqm at pqm.ubuntu.com-20071113174849-2zsajpakcs8uy1bo
parent: pqm at pqm.ubuntu.com-20071113005140-mp4owdlrd1ccnqc9
parent: john at arbash-meinel.com-20071113164256-yvnccvwwwpkxgef0
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-11-13 17:48:49 +0000
message:
  (John Arbash Meinel) Consolidate all calls to get the root id of a tree to use Tree.get_root_id()
added:
  bzrlib/tests/tree_implementations/test_get_root_id.py test_get_root_id.py-20071026191509-a4conhr43f194avv-1
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
  bzrlib/memorytree.py           memorytree.py-20060906023413-4wlkalbdpsxi2r4y-1
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
  bzrlib/tests/repository_implementations/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
  bzrlib/tests/repository_implementations/test_fileid_involved.py test_file_involved.py-20051215205901-728a172d1014daaa
  bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
  bzrlib/tests/test_memorytree.py test_memorytree.py-20060906023413-4wlkalbdpsxi2r4y-3
  bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
  bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
  bzrlib/tests/workingtree_implementations/test_unversion.py test_unversion.py-20060907074408-bygh2y28jz8u0cg7-1
  bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
    ------------------------------------------------------------
    revno: 2946.3.5
    merged: 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.
    ------------------------------------------------------------
    revno: 2946.3.4
    merged: john at arbash-meinel.com-20071113160520-k3govxcdlfursew8
    parent: john at arbash-meinel.com-20071026191848-kn2zemp87fo5cavb
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: tree_root_id
    timestamp: Tue 2007-11-13 10:05:20 -0600
    message:
      Comment from Martin: Use 'make_tree_*' not 'get_tree_*'
    ------------------------------------------------------------
    revno: 2946.3.3
    merged: john at arbash-meinel.com-20071026191848-kn2zemp87fo5cavb
    parent: john at arbash-meinel.com-20071026191529-st3fn58l61g24017
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: tree_root_id
    timestamp: Fri 2007-10-26 14:18:48 -0500
    message:
      Prefer tree.get_root_id() as more explicit than tree.path2id('')
      Besides, it turns out that all trees had that implemented anyway.
      And WT4 already had an implementation that did not require loading the full inventory.
    ------------------------------------------------------------
    revno: 2946.3.2
    merged: john at arbash-meinel.com-20071026191529-st3fn58l61g24017
    parent: john at arbash-meinel.com-20071026190821-ol840ac6hknunpqd
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: tree_root_id
    timestamp: Fri 2007-10-26 14:15:29 -0500
    message:
      Add tree implementation tests for Tree.get_root_id()
    ------------------------------------------------------------
    revno: 2946.3.1
    merged: john at arbash-meinel.com-20071026190821-ol840ac6hknunpqd
    parent: pqm at pqm.ubuntu.com-20071026085609-c3r8skfrmjj21j0m
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: tree_root_id
    timestamp: Fri 2007-10-26 14:08:21 -0500
    message:
      Switch from using Tree.inventory.root.file_id() to using Tree.path2id('')
=== added file 'bzrlib/tests/tree_implementations/test_get_root_id.py'
--- a/bzrlib/tests/tree_implementations/test_get_root_id.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/tree_implementations/test_get_root_id.py	2007-11-13 16:05:20 +0000
@@ -0,0 +1,44 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Tests for Tree.get_root_id()"""
+
+from bzrlib.tests.tree_implementations import TestCaseWithTree
+
+
+class TestGetRootID(TestCaseWithTree):
+
+    def make_tree_with_default_root_id(self):
+        tree = self.make_branch_and_tree('tree')
+        return self._convert_tree(tree)
+
+    def make_tree_with_fixed_root_id(self):
+        tree = self.make_branch_and_tree('tree')
+        tree.set_root_id('custom-tree-root-id')
+        return self._convert_tree(tree)
+
+    def test_get_root_id_default(self):
+        tree = self.make_tree_with_default_root_id()
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertIsNot(None, tree.get_root_id())
+
+    def test_get_root_id_fixed(self):
+        tree = self.make_tree_with_fixed_root_id()
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual('custom-tree-root-id', tree.get_root_id())
+

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2007-10-11 04:54:04 +0000
+++ b/bzrlib/branch.py	2007-10-26 19:18:48 +0000
@@ -1308,7 +1308,7 @@
     def get_root_id(self):
         """See Branch.get_root_id."""
         tree = self.repository.revision_tree(self.last_revision())
-        return tree.inventory.root.file_id
+        return tree.get_root_id()
 
     def is_locked(self):
         return self.control_files.is_locked()

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2007-10-17 09:39:41 +0000
+++ b/bzrlib/fetch.py	2007-10-26 19:18:48 +0000
@@ -347,7 +347,7 @@
         to_store = self.target.weave_store
         for tree in self.iter_rev_trees(revs):
             revision_id = tree.inventory.root.revision
-            root_id = tree.inventory.root.file_id
+            root_id = tree.get_root_id()
             parents = inventory_weave.get_parents(revision_id)
             if root_id not in versionedfile:
                 versionedfile[root_id] = to_store.get_weave_or_empty(root_id, 

=== 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/merge.py'
--- a/bzrlib/merge.py	2007-09-08 06:02:59 +0000
+++ b/bzrlib/merge.py	2007-10-26 19:18:48 +0000
@@ -550,7 +550,7 @@
                                  self.tt.root)
         if self.other_tree.inventory.root is None:
             return
-        other_root_file_id = self.other_tree.inventory.root.file_id
+        other_root_file_id = self.other_tree.get_root_id()
         other_root = self.tt.trans_id_file_id(other_root_file_id)
         if other_root == self.tt.root:
             return

=== modified file 'bzrlib/tests/repository_implementations/test_commit_builder.py'
--- a/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-10-22 01:23:51 +0000
+++ b/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-10-26 19:18:48 +0000
@@ -147,7 +147,7 @@
         builder = tree.branch.get_commit_builder([parent_tree.inventory])
         try:
             ie = inventory.make_entry('directory', '', None,
-                    tree.inventory.root.file_id)
+                    tree.get_root_id())
             delta, version_recorded = builder.record_entry_contents(
                 ie, [parent_tree.inventory], '', tree,
                 tree.path_content_summary(''))
@@ -367,7 +367,7 @@
             # root
             builder.record_entry_contents(
                 inventory.make_entry('directory', '', None,
-                    tree.inventory.root.file_id), parent_invs, '', tree,
+                    tree.get_root_id()), parent_invs, '', tree,
                     tree.path_content_summary(''))
             def commit_id(file_id):
                 old_ie = tree.inventory[file_id]
@@ -379,7 +379,7 @@
 
             file_id = tree.path2id(new_name)
             parent_id = tree.inventory[file_id].parent_id
-            if parent_id != tree.inventory.root.file_id:
+            if parent_id != tree.get_root_id():
                 commit_id(parent_id)
             # because a change of some sort is meant to have occurred,
             # recording the entry must return True.

=== modified file 'bzrlib/tests/repository_implementations/test_fetch.py'
--- a/bzrlib/tests/repository_implementations/test_fetch.py	2007-10-17 09:39:41 +0000
+++ b/bzrlib/tests/repository_implementations/test_fetch.py	2007-10-26 19:18:48 +0000
@@ -68,7 +68,7 @@
         # disk.
         knit3_repo = b_bzrdir.open_repository()
         rev1_tree = knit3_repo.revision_tree('rev1')
-        lines = rev1_tree.get_file_lines(rev1_tree.inventory.root.file_id)
+        lines = rev1_tree.get_file_lines(rev1_tree.get_root_id())
         self.assertEqual([], lines)
         b_branch = b_bzrdir.create_branch()
         b_branch.pull(tree_a.branch)

=== modified file 'bzrlib/tests/repository_implementations/test_fileid_involved.py'
--- a/bzrlib/tests/repository_implementations/test_fileid_involved.py	2007-10-17 09:39:41 +0000
+++ b/bzrlib/tests/repository_implementations/test_fileid_involved.py	2007-10-26 19:18:48 +0000
@@ -174,7 +174,7 @@
     def fileids_altered_by_revision_ids(self, revision_ids):
         """This is a wrapper to strip TREE_ROOT if it occurs"""
         repo = self.branch.repository
-        root_id = self.branch.basis_tree().inventory.root.file_id
+        root_id = self.branch.basis_tree().get_root_id()
         result = repo.fileids_altered_by_revision_ids(revision_ids)
         if root_id in result:
             del result[root_id]
@@ -245,7 +245,7 @@
         repo.lock_read()
         self.addCleanup(repo.unlock)
         file_ids = repo.fileids_altered_by_revision_ids([revision_id])
-        root_id = main_wt.basis_tree().path2id('')
+        root_id = main_wt.basis_tree().get_root_id()
         if root_id in file_ids:
             self.assertEqual({file_id:set([revision_id]),
                               root_id:set([revision_id])

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2007-11-05 19:40:28 +0000
+++ b/bzrlib/tests/test_dirstate.py	2007-11-13 17:48:49 +0000
@@ -359,7 +359,7 @@
         # There are no files on disk and no parents
         tree = self.make_branch_and_tree('tree')
         expected_result = ([], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
              ])])
         state = dirstate.DirState.from_tree(tree, 'dirstate')
@@ -372,7 +372,7 @@
         rev_id = tree.commit('first post').encode('utf8')
         root_stat_pack = dirstate.pack_stat(os.stat(tree.basedir))
         expected_result = ([rev_id], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
               ('d', '', 0, False, rev_id), # first parent details
              ])])
@@ -392,7 +392,7 @@
         rev_id2 = tree2.commit('second post', allow_pointless=True)
         tree.merge_from_branch(tree2.branch)
         expected_result = ([rev_id, rev_id2], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
               ('d', '', 0, False, rev_id), # first parent details
               ('d', '', 0, False, rev_id2), # second parent details
@@ -411,7 +411,7 @@
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/unknown'])
         expected_result = ([], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
              ])])
         state = dirstate.DirState.from_tree(tree, 'dirstate')
@@ -428,7 +428,7 @@
         # There are files on disk and no parents
         tree = self.get_tree_with_a_file()
         expected_result = ([], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
              ]),
             (('', 'a file', 'a file id'), # common
@@ -446,7 +446,7 @@
         # and length:
         self.build_tree_contents([('tree/a file', 'new content\n')])
         expected_result = ([rev_id], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
               ('d', '', 0, False, rev_id), # first parent details
              ]),
@@ -473,7 +473,7 @@
         # and length again, giving us three distinct values:
         self.build_tree_contents([('tree/a file', 'new content\n')])
         expected_result = ([rev_id, rev_id2], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree
               ('d', '', 0, False, rev_id), # first parent details
               ('d', '', 0, False, rev_id2), # second parent details
@@ -525,7 +525,7 @@
         # get a state object
         # no parents, default tree content
         expected_result = ([], [
-            (('', '', tree.path2id('')), # common details
+            (('', '', tree.get_root_id()), # common details
              # current tree details, but new from_tree skips statting, it
              # uses set_state_from_inventory, and thus depends on the
              # inventory state.
@@ -678,7 +678,7 @@
         try:
             tree1.add('')
             revid1 = tree1.commit('foo').encode('utf8')
-            root_id = tree1.inventory.root.file_id
+            root_id = tree1.get_root_id()
             inv = tree1.inventory
         finally:
             tree1.unlock()
@@ -892,7 +892,7 @@
         tree2.lock_write()
         try:
             revid2 = tree2.commit('foo')
-            root_id = tree2.inventory.root.file_id
+            root_id = tree2.get_root_id()
         finally:
             tree2.unlock()
         state = dirstate.DirState.initialize('dirstate')
@@ -962,7 +962,7 @@
         try:
             tree2.put_file_bytes_non_atomic('file-id', 'new file-content')
             revid2 = tree2.commit('foo')
-            root_id = tree2.inventory.root.file_id
+            root_id = tree2.get_root_id()
         finally:
             tree2.unlock()
         # check the layout in memory

=== 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')

=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py	2007-10-08 07:29:57 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py	2007-10-26 19:18:48 +0000
@@ -262,7 +262,7 @@
             self.build_tree(paths[1:])
         except UnicodeError:
             raise tests.TestSkipped('filesystem does not support unicode.')
-        if tree.path2id('') is None:
+        if tree.get_root_id() is None:
             # Some trees do not have a root yet.
             tree.add(paths, file_ids)
         else:
@@ -323,6 +323,7 @@
     result = TestSuite()
     test_tree_implementations = [
         'bzrlib.tests.tree_implementations.test_get_file_mtime',
+        'bzrlib.tests.tree_implementations.test_get_root_id',
         'bzrlib.tests.tree_implementations.test_get_symlink_target',
         'bzrlib.tests.tree_implementations.test_inv',
         'bzrlib.tests.tree_implementations.test_list_files',

=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py	2007-11-01 09:52:45 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py	2007-11-13 17:48:49 +0000
@@ -105,7 +105,7 @@
 
         tree_a.lock_read()
         try:
-            root_id = tree_a.inventory.root.file_id
+            root_id = tree_a.get_root_id()
             paths = [(path, ie.file_id)
                      for path, ie in tree_a.iter_entries_by_dir()]
         finally:
@@ -126,7 +126,7 @@
 
         tree_a.lock_read()
         try:
-            root_id = tree_a.inventory.root.file_id
+            root_id = tree_a.get_root_id()
             paths = [(path, ie.file_id)
                      for path, ie in tree_a.iter_entries_by_dir()]
         finally:
@@ -145,7 +145,7 @@
 
         tree_a.lock_read()
         try:
-            root_id = tree_a.inventory.root.file_id
+            root_id = tree_a.get_root_id()
         finally:
             tree_a.unlock()
 

=== modified file 'bzrlib/tests/workingtree_implementations/test_unversion.py'
--- a/bzrlib/tests/workingtree_implementations/test_unversion.py	2007-10-23 21:48:30 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_unversion.py	2007-10-26 19:18:48 +0000
@@ -118,7 +118,7 @@
 
         tree.lock_read()
         try:
-            root_id = tree.inventory.root.file_id
+            root_id = tree.get_root_id()
             paths = [(path, ie.file_id)
                      for path, ie in tree.iter_entries_by_dir()]
         finally:
@@ -149,7 +149,7 @@
 
         tree_a.lock_read()
         try:
-            root_id = tree_a.inventory.root.file_id
+            root_id = tree_a.get_root_id()
         finally:
             tree_a.unlock()
 

=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-11-01 09:52:45 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-11-13 17:48:49 +0000
@@ -745,7 +745,7 @@
         # if we write write an inventory then do a walkdirs we should get back
         # missing entries, and actual, and unknowns as appropriate.
         self.build_tree(['present', 'unknown'])
-        inventory = Inventory(tree.path2id(''))
+        inventory = Inventory(tree.get_root_id())
         inventory.add_path('missing', 'file', 'missing-id')
         inventory.add_path('present', 'file', 'present-id')
         # there is no point in being able to write an inventory to an unlocked
@@ -758,7 +758,7 @@
             present_stat = os.lstat('present')
             unknown_stat = os.lstat('unknown')
             expected_results = [
-                (('', tree.inventory.root.file_id),
+                (('', tree.get_root_id()),
                  [('missing', 'missing', 'unknown', None, 'missing-id', 'file'),
                   ('present', 'present', 'file', present_stat, 'present-id', 'file'),
                   ('unknown', 'unknown', 'file', unknown_stat, None, None),

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2007-08-29 05:30:05 +0000
+++ b/bzrlib/transform.py	2007-10-26 19:18:48 +0000
@@ -495,7 +495,7 @@
             return None
         # the file is old; the old id is still valid
         if self._new_root == trans_id:
-            return self._tree.inventory.root.file_id
+            return self._tree.get_root_id()
         return self._tree.inventory.path2id(path)
 
     def final_file_id(self, trans_id):
@@ -905,7 +905,7 @@
                         self.rename_count += 1
                 if trans_id in self._removed_id:
                     if trans_id == self._new_root:
-                        file_id = self._tree.inventory.root.file_id
+                        file_id = self._tree.get_root_id()
                     else:
                         file_id = self.tree_file_id(trans_id)
                     assert file_id is not None
@@ -1283,8 +1283,8 @@
         # 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)
+        if wt.get_root_id() != tree.get_root_id():
+            wt.set_root_id(tree.get_root_id())
             wt.flush()
     tt = TreeTransform(wt)
     divert = set()

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2007-10-11 04:54:04 +0000
+++ b/bzrlib/tree.py	2007-10-26 19:15:29 +0000
@@ -277,6 +277,10 @@
         """
         raise NotImplementedError(self.get_symlink_target)
 
+    def get_root_id(self):
+        """Return the file_id for the root of this tree."""
+        raise NotImplementedError(self.get_root_id)
+
     def annotate_iter(self, file_id):
         """Return an iterator of revision_id, line tuples.
 

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2007-11-12 19:54:30 +0000
+++ b/bzrlib/workingtree.py	2007-11-13 17:48:49 +0000
@@ -1541,7 +1541,7 @@
                                 change_reporter=change_reporter)
                     if (basis_tree.inventory.root is None and
                         new_basis_tree.inventory.root is not None):
-                        self.set_root_id(new_basis_tree.inventory.root.file_id)
+                        self.set_root_id(new_basis_tree.get_root_id())
                 finally:
                     pb.finished()
                     basis_tree.unlock()
@@ -2154,7 +2154,7 @@
             try:
                 to_tree = self.branch.basis_tree()
                 if basis.inventory.root is None:
-                    self.set_root_id(to_tree.inventory.root.file_id)
+                    self.set_root_id(to_tree.get_root_id())
                     self.flush()
                 result += merge.merge_inner(
                                       self.branch,
@@ -2740,7 +2740,7 @@
                          _bzrdir=a_bzrdir)
         basis_tree = branch.repository.revision_tree(revision_id)
         if basis_tree.inventory.root is not None:
-            wt.set_root_id(basis_tree.inventory.root.file_id)
+            wt.set_root_id(basis_tree.get_root_id())
         # set the parent list and cache the basis tree.
         if _mod_revision.is_null(revision_id):
             parent_trees = []
@@ -2842,7 +2842,7 @@
             basis_tree = branch.repository.revision_tree(revision_id)
             # only set an explicit root id if there is one to set.
             if basis_tree.inventory.root is not None:
-                wt.set_root_id(basis_tree.inventory.root.file_id)
+                wt.set_root_id(basis_tree.get_root_id())
             if revision_id == NULL_REVISION:
                 wt.set_parent_trees([])
             else:




More information about the bazaar-commits mailing list