104
104
out, err = self.run_bzr('diff')
106
def _test_checkout_existing_dir(self, lightweight):
107
source = self.make_branch_and_tree('source')
108
self.build_tree_contents([('source/file1', 'content1'),
109
('source/file2', 'content2'),])
110
source.add(['file1', 'file2'])
111
source.commit('added files')
112
self.build_tree_contents([('target/', ''),
113
('target/file1', 'content1'),
114
('target/file2', 'content3'),])
115
cmd = ['checkout', 'source', 'target']
117
cmd.append('--lightweight')
118
self.run_bzr('checkout source target')
119
# files with unique content should be moved
120
self.failUnlessExists('target/file2.moved')
121
# files with content matching tree should not be moved
122
self.failIfExists('target/file1.moved')
124
def test_checkout_existing_dir_heavy(self):
125
self._test_checkout_existing_dir(False)
127
def test_checkout_existing_dir_lightweight(self):
128
self._test_checkout_existing_dir(True)
106
130
def test_checkout_in_branch_with_r(self):
107
131
branch = _mod_branch.Branch.open('branch')
108
132
branch.bzrdir.destroy_workingtree()
112
136
self.assertEqual('1', tree.last_revision())
113
137
branch.bzrdir.destroy_workingtree()
114
138
self.run_bzr('checkout -r 0')
115
self.assertIs(None, tree.last_revision())
139
self.assertEqual('null:', tree.last_revision())