/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
17
17
 
18
 
from cStringIO import StringIO
19
 
import os
20
 
 
21
 
from bzrlib import errors
22
 
from bzrlib.errors import NotBranchError, NotVersionedError
23
 
from bzrlib.osutils import basename
24
 
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
25
 
from bzrlib.trace import mutter
26
 
from bzrlib.transport import get_transport
27
 
 
28
 
 
29
 
class TestPull(TestCaseWithWorkingTree):
 
18
 
 
19
from bzrlib import tests
 
20
from bzrlib.tests import per_workingtree
 
21
 
 
22
 
 
23
class TestPull(per_workingtree.TestCaseWithWorkingTree):
30
24
 
31
25
    def get_pullable_trees(self):
32
26
        self.build_tree(['from/', 'from/file', 'to/'])
68
62
        tree.commit('second')
69
63
        to_tree.pull(tree.branch)
70
64
        self.assertEqual('second_root_id', to_tree.get_root_id())
 
65
 
 
66
 
 
67
class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree):
 
68
 
 
69
    def make_branch_deleting_dir(self, relpath=None):
 
70
        if relpath is None:
 
71
            relpath = 'trunk'
 
72
        builder = self.make_branch_builder(relpath)
 
73
        builder.start_series()
 
74
 
 
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()
 
85
 
 
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',
 
97
                         'work/dir/subdir/',
 
98
                         'work/dir/subdir/foo'])
 
99
        work.pull(trunk)
 
100
        self.assertLength(0, work.conflicts())
 
101
        # The directory removal should succeed
 
102
        self.failIfExists('work/dir')