~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_subsume.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil, Patch Queue Manager, Jelmer Vernooij
  • Date: 2017-01-17 16:20:41 UTC
  • mfrom: (6619.1.2 trunk)
  • Revision ID: tarmac-20170117162041-oo62uk1qsmgc9j31
Merge 2.7 into trunk including fixes for bugs #1622039, #1644003, #1579093 and #1645017. [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2009, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from bzrlib import bzrdir, errors, repository, workingtree, tests
 
17
from bzrlib import errors, workingtree, tests
18
18
 
19
19
 
20
20
class TestWorkingTree(tests.TestCaseWithTransport):
21
21
 
22
22
    def make_branch_and_tree(self, relpath, format=None):
23
23
        if format is None:
24
 
            format = 'dirstate-with-subtree'
 
24
            format = 'development-subtree'
25
25
        return tests.TestCaseWithTransport.make_branch_and_tree(self, relpath,
26
26
                                                                format)
27
27
 
34
34
        base_tree.add('file', 'file-id')
35
35
        base_tree.commit('first commit', rev_id='tree-1')
36
36
        sub_tree = self.make_branch_and_tree('tree/subtree',
37
 
            format='dirstate-with-subtree')
 
37
            format='development-subtree')
38
38
        if same_root is True:
39
39
            sub_tree.set_root_id(base_tree.get_root_id())
40
40
        sub_tree.add('file2', 'file2-id')
64
64
        # this test checks the subdir is removed, so it needs to know the
65
65
        # control directory; that changes rarely so just hardcode (and check)
66
66
        # it is correct.
67
 
        self.failUnlessExists('tree/subtree/.bzr')
 
67
        self.assertPathExists('tree/subtree/.bzr')
68
68
        base_tree.subsume(sub_tree)
69
69
        self.assertEqual(['tree-1', 'subtree-1'], base_tree.get_parent_ids())
70
70
        self.assertEqual(sub_root_id, base_tree.path2id('subtree'))
71
71
        self.assertEqual('file2-id', base_tree.path2id('subtree/file2'))
72
72
        # subsuming the tree removes the control directory, so you can't open
73
73
        # it.
74
 
        self.failIfExists('tree/subtree/.bzr')
 
74
        self.assertPathDoesNotExist('tree/subtree/.bzr')
75
75
        file2 = open('tree/subtree/file2', 'rb')
76
76
        try:
77
77
            file2_contents = file2.read()
91
91
        self.assertEqualDiff(file2_contents,
92
92
                             basis_tree.get_file_text('file2-id'))
93
93
        self.assertEqual('subtree-1',
94
 
                         basis_tree.inventory['file2-id'].revision)
 
94
                         basis_tree.get_file_revision('file2-id'))
95
95
        self.assertEqual('combined-1',
96
 
                         basis_tree.inventory[sub_root_id].revision)
 
96
                         basis_tree.get_file_revision(sub_root_id))
97
97
 
98
98
    def test_subsume_failure(self):
99
99
        base_tree, sub_tree = self.make_trees()