~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_pull.py

Merge bzr.dev to resolve news conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from cStringIO import StringIO
19
19
 
 
20
from bzrlib import tests
20
21
from bzrlib.tests import per_workingtree
21
22
 
22
23
 
62
63
        tree.commit('second')
63
64
        to_tree.pull(tree.branch)
64
65
        self.assertEqual('second_root_id', to_tree.get_root_id())
 
66
 
 
67
 
 
68
class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree):
 
69
 
 
70
    def make_branch_deleting_dir(self, relpath=None):
 
71
        if relpath is None:
 
72
            relpath = 'trunk'
 
73
        builder = self.make_branch_builder(relpath)
 
74
        builder.start_series()
 
75
 
 
76
        # Create an empty trunk
 
77
        builder.build_snapshot('1', None, [
 
78
                ('add', ('', 'root-id', 'directory', ''))])
 
79
        builder.build_snapshot('2', ['1'], [
 
80
                ('add', ('dir', 'dir-id', 'directory', '')),
 
81
                ('add', ('file', 'file-id', 'file', 'trunk content\n')),])
 
82
        builder.build_snapshot('3', ['2'], [
 
83
                ('unversion', 'dir-id'),])
 
84
        builder.finish_series()
 
85
        return builder.get_branch()
 
86
 
 
87
    def test_pull_orphans(self):
 
88
        from bzrlib import workingtree
 
89
        if isinstance(self.workingtree_format, workingtree.WorkingTreeFormat2):
 
90
            raise tests.TestSkipped(
 
91
                'WorkingTreeFormat2 does not support missing parent conflicts')
 
92
        trunk = self.make_branch_deleting_dir('trunk')
 
93
        work = trunk.bzrdir.sprout('work', revision_id='2').open_workingtree()
 
94
        work.branch.get_config().set_user_option(
 
95
            'bzr.transform.orphan_policy', 'move')
 
96
        # Add some unversioned files in dir
 
97
        self.build_tree(['work/dir/foo',
 
98
                         'work/dir/subdir/',
 
99
                         'work/dir/subdir/foo'])
 
100
        work.pull(trunk)
 
101
        self.assertLength(0, work.conflicts())
 
102
        # The directory removal should succeed
 
103
        self.failIfExists('work/dir')