15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
from cStringIO import StringIO
19
from bzrlib import tests
20
20
from bzrlib.tests import per_workingtree
62
62
tree.commit('second')
63
63
to_tree.pull(tree.branch)
64
64
self.assertEqual('second_root_id', to_tree.get_root_id())
67
class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree):
69
def make_branch_deleting_dir(self, relpath=None):
72
builder = self.make_branch_builder(relpath)
73
builder.start_series()
75
# Create an empty trunk
76
builder.build_snapshot('1', None, [
77
('add', ('', 'root-id', 'directory', ''))])
78
builder.build_snapshot('2', ['1'], [
79
('add', ('dir', 'dir-id', 'directory', '')),
80
('add', ('file', 'file-id', 'file', 'trunk content\n')),])
81
builder.build_snapshot('3', ['2'], [
82
('unversion', 'dir-id'),])
83
builder.finish_series()
84
return builder.get_branch()
86
def test_pull_orphans(self):
87
if not self.workingtree_format.missing_parent_conflicts:
88
raise tests.TestSkipped(
89
'%r does not support missing parent conflicts' %
90
self.workingtree_format)
91
trunk = self.make_branch_deleting_dir('trunk')
92
work = trunk.bzrdir.sprout('work', revision_id='2').open_workingtree()
93
work.branch.get_config().set_user_option(
94
'bzr.transform.orphan_policy', 'move')
95
# Add some unversioned files in dir
96
self.build_tree(['work/dir/foo',
98
'work/dir/subdir/foo'])
100
self.assertLength(0, work.conflicts())
101
# The directory removal should succeed
102
self.failIfExists('work/dir')