Rev 2434: enhanced set_path_id_with_parents test in file:///home/mbp/bzr/Work/subtree/
Martin Pool
mbp at sourcefrog.net
Mon Mar 5 03:58:50 GMT 2007
------------------------------------------------------------
revno: 2434
revision-id: mbp at sourcefrog.net-20070305035848-xs1fgcwovuthekyq
parent: mbp at sourcefrog.net-20070305005222-udndz0dnl2vorbpi
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: subtree
timestamp: Mon 2007-03-05 14:58:48 +1100
message:
enhanced set_path_id_with_parents test
modified:
bzrlib/tests/test_dirstate.py test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py 2007-03-05 00:52:22 +0000
+++ b/bzrlib/tests/test_dirstate.py 2007-03-05 03:58:48 +0000
@@ -477,6 +477,7 @@
('a', '', 0, False, ''),
]),
]
+ state._validate()
self.assertEqual(expected_rows, list(state._iter_entries()))
# should work across save too
state.save()
@@ -486,9 +487,19 @@
state = dirstate.DirState.on_file('dirstate')
state.lock_read()
try:
+ state._validate()
self.assertEqual(expected_rows, list(state._iter_entries()))
finally:
state.unlock()
+ # now change within an existing file-backed state
+ state.lock_write()
+ try:
+ state._validate()
+ state.set_path_id('', 'tree-root-2')
+ state._validate()
+ finally:
+ state.unlock()
+
def test_set_parent_trees_no_content(self):
# set_parent_trees is a slow but important api to support.
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-03-05 00:40:01 +0000
+++ b/bzrlib/workingtree_4.py 2007-03-05 03:58:48 +0000
@@ -1173,23 +1173,14 @@
wt._set_root_id(generate_ids.gen_root_id())
wt.flush()
wt.current_dirstate()._validate()
- return wt
- # TODO: Remove some of this validation once the problem is
- # fixed -- mbp 20070304
- wt.current_dirstate()._validate()
wt.set_last_revision(revision_id)
- wt.current_dirstate()._validate()
wt.flush()
- wt.current_dirstate()._validate()
basis = wt.basis_tree()
- wt.current_dirstate()._validate()
basis.lock_read()
- wt.current_dirstate()._validate()
# if the basis has a root id we have to use that; otherwise we use
# a new random one
basis_root_id = basis.get_root_id()
if basis_root_id is not None:
- state._validate()
wt._set_root_id(basis_root_id)
wt.flush()
transform.build_tree(basis, wt)
More information about the bazaar-commits
mailing list