/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_branch/test_parent.py

  • Committer: Andrew Bennetts
  • Date: 2010-04-13 04:33:55 UTC
  • mfrom: (5147 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5149.
  • Revision ID: andrew.bennetts@canonical.com-20100413043355-lg3id0uwtju0k3zs
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 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 sys
36
36
        """Branches should have no parent by default"""
37
37
        b = self.make_branch('.')
38
38
        self.assertEqual(None, b.get_parent())
39
 
        
 
39
 
40
40
    def test_set_get_parent(self):
41
41
        """Set, re-get and reset the parent"""
42
42
        b = self.make_branch('subdir')
71
71
            #       paths as well? Nobody has complained about it.
72
72
            pass
73
73
        else:
 
74
            b.lock_write()
74
75
            b._set_parent_location('/local/abs/path')
 
76
            b.unlock()
75
77
            self.assertEqual('file:///local/abs/path', b.get_parent())
76
78
 
77
79
    def test_get_invalid_parent(self):
83
85
        # Force the relative path to be something invalid
84
86
        # This should attempt to go outside the filesystem
85
87
        path = ('../'*(n_dirs+5)) + 'foo'
 
88
        b.lock_write()
86
89
        b._set_parent_location(path)
 
90
        b.unlock()
87
91
 
88
92
        # With an invalid branch parent, just return None
89
93
        self.assertRaises(bzrlib.errors.InaccessibleParent, b.get_parent)
92
96
        if sys.platform != 'win32':
93
97
            raise TestSkipped('windows-specific test')
94
98
        b = self.make_branch('.')
95
 
        base_url = b.abspath('.')
 
99
        base_url = b.bzrdir.transport.abspath('.')
96
100
        if not base_url.startswith('file:///'):
97
101
            raise TestNotApplicable('this test should be run with local base')
98
102
        base = urlutils.local_path_from_url(base_url)
99
 
        other = 'file:///B:/path'
 
103
        other = 'file:///D:/path'
100
104
        if base[0] != 'C':
101
105
            other = 'file:///C:/path'
102
106
        b.set_parent(other)