Rev 2469: Get _iter_changes on dirstate passing the subtree tests. in http://bazaar.launchpad.net/~bzr/bzr/dirstate
Robert Collins
robertc at robertcollins.net
Tue Mar 6 08:42:42 GMT 2007
At http://bazaar.launchpad.net/~bzr/bzr/dirstate
------------------------------------------------------------
revno: 2469
revision-id: robertc at robertcollins.net-20070306084140-10rlo4bozpfvuebh
parent: robertc at robertcollins.net-20070306072420-xfvlsmm6hw0rrqe9
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate.dogfood
timestamp: Tue 2007-03-06 19:41:40 +1100
message:
Get _iter_changes on dirstate passing the subtree tests.
modified:
bzrlib/tests/test_subsume.py test_subsume.py-20060927040024-tsvh4pchajoayymg-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/test_subsume.py'
--- a/bzrlib/tests/test_subsume.py 2007-03-06 05:05:46 +0000
+++ b/bzrlib/tests/test_subsume.py 2007-03-06 08:41:40 +0000
@@ -61,16 +61,16 @@
base_tree, sub_tree = self.make_trees()
assert base_tree.get_root_id() != sub_tree.get_root_id()
sub_root_id = sub_tree.get_root_id()
+ # this test checks the subdir is removed, so it needs to know the
+ # control directory; that changes rarely so just hardcode (and check)
+ # it is correct.
+ self.failUnlessExists('tree/subtree/.bzr')
base_tree.subsume(sub_tree)
self.assertEqual(['tree-1', 'subtree-1'], base_tree.get_parent_ids())
self.assertEqual(sub_root_id, base_tree.path2id('subtree'))
self.assertEqual('file2-id', base_tree.path2id('subtree/file2'))
- sub_bzrdir = bzrdir.BzrDir.open('tree/subtree')
# subsuming the tree removes the control directory, so you can't open
- # the workingtree or branch
- import pdb;pdb.set_trace()
- self.assertRaises(errors.NoWorkingTree, sub_bzrdir.open_workingtree)
- self.assertRaises(errors.NotBranchError, sub_bzrdir.open_branch)
+ # it.
self.failIfExists('tree/subtree/.bzr')
file2 = open('tree/subtree/file2', 'rb')
try:
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-03-06 05:05:46 +0000
+++ b/bzrlib/workingtree.py 2007-03-06 08:41:40 +0000
@@ -931,7 +931,7 @@
self.add_parent_tree_id(parent_id)
finally:
other_tree.unlock()
- other_tree.bzrdir.destroy_workingtree_metadata()
+ other_tree.bzrdir.retire_bzrdir()
@needs_tree_write_lock
def extract(self, file_id, format=None):
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-03-06 03:36:44 +0000
+++ b/bzrlib/workingtree_4.py 2007-03-06 08:41:40 +0000
@@ -1809,6 +1809,7 @@
content_change = True
else:
content_change = False
+ target_exec = False
else:
raise Exception, "unknown kind %s" % path_info[2]
# parent id is the entry for the path in the target tree
@@ -1933,6 +1934,11 @@
root_dir_info = ('', current_root,
osutils.file_kind_from_stat_mode(root_stat.st_mode), root_stat,
root_abspath)
+ if root_dir_info[2] == 'directory':
+ if self.target._directory_is_tree_reference(current_root):
+ root_dir_info = root_dir_info[:2] + \
+ ('tree-reference',) + root_dir_info[3:]
+
if not root_entries and not root_dir_info:
# this specified path is not present at all, skip it.
continue
@@ -1999,8 +2005,6 @@
if (current_dir_info and current_block
and current_dir_info[0][0] != current_block[0]):
if current_dir_info[0][0] < current_block[0] :
- # import pdb; pdb.set_trace()
- # print 'unversioned dir'
# filesystem data refers to paths not covered by the dirblock.
# this has two possibilities:
# A) it is versioned but empty, so there is no block for it
@@ -2058,6 +2062,11 @@
path_index = 0
if current_dir_info and path_index < len(current_dir_info[1]):
current_path_info = current_dir_info[1][path_index]
+ if current_path_info[2] == 'directory':
+ if self.target._directory_is_tree_reference(
+ current_path_info[0]):
+ current_path_info = current_path_info[:2] + \
+ ('tree-reference',) + current_path_info[3:]
else:
current_path_info = None
advance_path = True
@@ -2157,12 +2166,18 @@
(None, new_executable))
# dont descend into this unversioned path if it is
# a dir
- if current_path_info[2] == 'directory':
+ if current_path_info[2] in (
+ 'directory', 'tree-referene'):
del current_dir_info[1][path_index]
path_index -= 1
path_index += 1
if path_index < len(current_dir_info[1]):
current_path_info = current_dir_info[1][path_index]
+ if current_path_info[2] == 'directory':
+ if self.target._directory_is_tree_reference(
+ current_path_info[0]):
+ current_path_info = current_path_info[:2] + \
+ ('tree-reference',) + current_path_info[3:]
else:
current_path_info = None
path_handled = False
More information about the bazaar-commits
mailing list