/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/blackbox/test_join.py

  • Committer: John Arbash Meinel
  • Date: 2007-05-31 20:29:04 UTC
  • mto: This revision was merged to the branch mainline in revision 2499.
  • Revision ID: john@arbash-meinel.com-20070531202904-34h7ygudo7qq9ha1
Update the code so that symlinks aren't cached at incorrect times
and fix the tests so that they don't assume files and symlinks
get cached even when the timestamp doesn't declare them 'safe'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2010 Canonical Ltd
 
1
# Copyright (C) 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
18
import os
19
19
 
20
 
from bzrlib import (
21
 
    bzrdir,
22
 
    osutils,
23
 
    repository,
24
 
    tests,
25
 
    workingtree,
26
 
    )
 
20
from bzrlib import bzrdir, repository, tests, workingtree
27
21
 
28
22
 
29
23
class TestJoin(tests.TestCaseWithTransport):
45
39
 
46
40
    def test_join(self):
47
41
        base_tree, sub_tree = self.make_trees()
48
 
        self.run_bzr('join tree/subtree')
 
42
        self.run_bzr('join', 'tree/subtree')
49
43
        self.check_success('tree')
50
44
 
51
45
    def test_join_dot(self):
52
46
        base_tree, sub_tree = self.make_trees()
53
 
        self.run_bzr('join .', working_dir='tree/subtree')
 
47
        self.run_bzr('join', '.', working_dir='tree/subtree')
54
48
        self.check_success('tree')
55
49
 
56
50
    def test_join_error(self):
57
51
        base_tree, sub_tree = self.make_trees()
58
52
        os.mkdir('tree/subtree2')
59
 
        osutils.rename('tree/subtree', 'tree/subtree2/subtree')
 
53
        os.rename('tree/subtree', 'tree/subtree2/subtree')
60
54
        self.run_bzr_error(
61
55
            ('Cannot join .*subtree.  Parent directory is not versioned',),
62
 
             'join tree/subtree2/subtree')
 
56
             'join', 'tree/subtree2/subtree')
63
57
        # disabled because this gives an ugly error at present -- mbp 20070306
64
58
        ## self.run_bzr_error(
65
59
        ##     ('Cannot join .*subtree.  Parent directory is not versioned',),
66
60
        ##      'join', '--reference', 'tree/subtree2/subtree')
67
 
        self.run_bzr_error(('Not a branch:.*subtree2',),
68
 
                           'join tree/subtree2')
 
61
        self.run_bzr_error(('Not a branch:.*subtree2',), 'join',
 
62
                            'tree/subtree2')
69
63
 
70
64
    def test_join_reference(self):
71
65
        """Join can add a reference if --reference is supplied"""
72
66
        base_tree, sub_tree = self.make_trees()
73
 
        self.run_bzr('join . --reference', working_dir='tree/subtree')
 
67
        self.run_bzr('join', '.', '--reference', working_dir='tree/subtree')
74
68
        sub_tree.lock_read()
75
69
        self.addCleanup(sub_tree.unlock)
76
70
        self.assertEqual('file1-id', sub_tree.path2id('file1'))
87
81
    def test_references_check_repository_support(self):
88
82
        """Users are stopped from adding a reference that can't be committed."""
89
83
        # in 0.15 the default format has a dirstate workingtree, that can
90
 
        # support tree references, but the default repository format
 
84
        # support tree references, but the default repository format 
91
85
        # cannot.
92
86
        tree = self.make_branch_and_tree('tree', format='dirstate')
93
87
        tree2 = self.make_branch_and_tree('tree/subtree')
94
 
        out, err = self.run_bzr('join --reference tree/subtree',
95
 
                                retcode=3)
96
 
        self.assertContainsRe(err, r"Can't join trees")
97
 
        self.assertContainsRe(err, r"use bzr upgrade")
 
88
        out, err = self.run_bzr('join', '--reference', 'tree/subtree',
 
89
            retcode=3)
 
90
        self.assertContainsRe(err,
 
91
            r"Can't join trees")
 
92
        self.assertContainsRe(err,
 
93
            r"use bzr upgrade")
98
94
 
99
95