Rev 2947: Switch from using Tree.inventory.root.file_id() to using Tree.path2id('') in http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/tree_root_id
John Arbash Meinel
john at arbash-meinel.com
Fri Oct 26 20:09:04 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/tree_root_id
------------------------------------------------------------
revno: 2947
revision-id: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('')
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
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/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
bzrlib/tests/workingtree_implementations/test_unversion.py test_unversion.py-20060907074408-bygh2y28jz8u0cg7-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2007-10-11 04:54:04 +0000
+++ b/bzrlib/branch.py 2007-10-26 19:08:21 +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.path2id('')
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:08:21 +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.path2id('')
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/merge.py'
--- a/bzrlib/merge.py 2007-09-08 06:02:59 +0000
+++ b/bzrlib/merge.py 2007-10-26 19:08:21 +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.path2id('')
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:08:21 +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.path2id(''))
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.path2id('')), 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.path2id(''):
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:08:21 +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.path2id(''))
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:08:21 +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().path2id('')
result = repo.fileids_altered_by_revision_ids(revision_ids)
if root_id in result:
del result[root_id]
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2007-10-10 00:07:04 +0000
+++ b/bzrlib/tests/test_dirstate.py 2007-10-26 19:08:21 +0000
@@ -679,7 +679,7 @@
try:
tree1.add('')
revid1 = tree1.commit('foo').encode('utf8')
- root_id = tree1.inventory.root.file_id
+ root_id = tree1.path2id('')
inv = tree1.inventory
finally:
tree1.unlock()
@@ -893,7 +893,7 @@
tree2.lock_write()
try:
revid2 = tree2.commit('foo')
- root_id = tree2.inventory.root.file_id
+ root_id = tree2.path2id('')
finally:
tree2.unlock()
state = dirstate.DirState.initialize('dirstate')
@@ -963,7 +963,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.path2id('')
finally:
tree2.unlock()
# check the layout in memory
=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py 2007-10-23 21:10:52 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py 2007-10-26 19:08:21 +0000
@@ -105,7 +105,7 @@
tree_a.lock_read()
try:
- root_id = tree_a.inventory.root.file_id
+ root_id = tree_a.path2id('')
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.path2id('')
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.path2id('')
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:08:21 +0000
@@ -118,7 +118,7 @@
tree.lock_read()
try:
- root_id = tree.inventory.root.file_id
+ root_id = tree.path2id('')
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.path2id('')
finally:
tree_a.unlock()
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2007-08-29 05:30:05 +0000
+++ b/bzrlib/transform.py 2007-10-26 19:08:21 +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.path2id('')
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.path2id('')
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.path2id('') != tree.path2id(''):
+ wt.set_root_id(tree.path2id(''))
wt.flush()
tt = TreeTransform(wt)
divert = set()
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-10-22 01:23:51 +0000
+++ b/bzrlib/workingtree.py 2007-10-26 19:08:21 +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.path2id(''))
finally:
pb.finished()
basis_tree.unlock()
@@ -2139,7 +2139,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.path2id(''))
self.flush()
result += merge.merge_inner(
self.branch,
@@ -2715,7 +2715,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.path2id(''))
# set the parent list and cache the basis tree.
if _mod_revision.is_null(revision_id):
parent_trees = []
@@ -2817,7 +2817,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.path2id(''))
if revision_id == NULL_REVISION:
wt.set_parent_trees([])
else:
More information about the bazaar-commits
mailing list