/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

  • Committer: John Arbash Meinel
  • Date: 2011-04-20 09:46:28 UTC
  • mfrom: (5609.33.4 2.3)
  • mto: (5609.33.5 2.3)
  • mto: This revision was merged to the branch mainline in revision 5811.
  • Revision ID: john@arbash-meinel.com-20110420094628-l0bafq1lwb6ib1v2
Merge lp:bzr/2.3 @ 5640 so we can update the release notes (aka NEWS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
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):
 
19
 
 
20
from bzrlib import tests
 
21
from bzrlib.tests import per_workingtree
 
22
 
 
23
 
 
24
class TestPull(per_workingtree.TestCaseWithWorkingTree):
30
25
 
31
26
    def get_pullable_trees(self):
32
27
        self.build_tree(['from/', 'from/file', 'to/'])
68
63
        tree.commit('second')
69
64
        to_tree.pull(tree.branch)
70
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')