~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_join.py

  • Committer: Patch Queue Manager
  • Date: 2013-05-27 10:52:24 UTC
  • mfrom: (6576.1.5 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20130527105224-3k2yibl2xrvnh6rf
(vila) Handle empty quoted strings in command lines and various
 cleanups (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2010 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
import os
19
19
 
20
 
from bzrlib import bzrdir, repository, tests, workingtree
 
20
from bzrlib import (
 
21
    osutils,
 
22
    tests,
 
23
    workingtree,
 
24
    )
21
25
 
22
26
 
23
27
class TestJoin(tests.TestCaseWithTransport):
24
28
 
25
29
    def make_trees(self):
26
30
        base_tree = self.make_branch_and_tree('tree',
27
 
            format='dirstate-with-subtree')
 
31
            format='development-subtree')
28
32
        base_tree.commit('empty commit')
29
33
        self.build_tree(['tree/subtree/', 'tree/subtree/file1'])
30
34
        sub_tree = self.make_branch_and_tree('tree/subtree')
50
54
    def test_join_error(self):
51
55
        base_tree, sub_tree = self.make_trees()
52
56
        os.mkdir('tree/subtree2')
53
 
        os.rename('tree/subtree', 'tree/subtree2/subtree')
 
57
        osutils.rename('tree/subtree', 'tree/subtree2/subtree')
54
58
        self.run_bzr_error(
55
59
            ('Cannot join .*subtree.  Parent directory is not versioned',),
56
60
             'join tree/subtree2/subtree')
68
72
        sub_tree.lock_read()
69
73
        self.addCleanup(sub_tree.unlock)
70
74
        self.assertEqual('file1-id', sub_tree.path2id('file1'))
71
 
        self.assertTrue('file1-id' in sub_tree)
 
75
        self.assertTrue(sub_tree.has_id('file1-id'))
72
76
        self.assertEqual('subtree-root-id', sub_tree.path2id(''))
73
77
        self.assertEqual('', sub_tree.id2path('subtree-root-id'))
74
78
        self.assertIs(None, base_tree.path2id('subtree/file1'))
75
79
        base_tree.lock_read()
76
80
        self.addCleanup(base_tree.unlock)
77
 
        self.assertTrue('file1-id' not in base_tree)
 
81
        self.assertFalse(base_tree.has_id('file1-id'))
78
82
        self.assertEqual('subtree-root-id', base_tree.path2id('subtree'))
79
83
        self.assertEqual('subtree', base_tree.id2path('subtree-root-id'))
80
84
 
81
85
    def test_references_check_repository_support(self):
82
86
        """Users are stopped from adding a reference that can't be committed."""
83
87
        # in 0.15 the default format has a dirstate workingtree, that can
84
 
        # support tree references, but the default repository format 
 
88
        # support tree references, but the default repository format
85
89
        # cannot.
86
90
        tree = self.make_branch_and_tree('tree', format='dirstate')
87
91
        tree2 = self.make_branch_and_tree('tree/subtree')
89
93
                                retcode=3)
90
94
        self.assertContainsRe(err, r"Can't join trees")
91
95
        self.assertContainsRe(err, r"use bzr upgrade")
92
 
 
93