~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_parent.py

[merge] fix \t in commit messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import os
19
19
from bzrlib.selftest import TestCaseInTempDir
20
 
from bzrlib.branch import Branch, copy_branch
 
20
from bzrlib.branch import Branch
 
21
from bzrlib.clone import copy_branch
21
22
 
22
23
 
23
24
"""Tests for Branch parent URL"""
26
27
class TestParent(TestCaseInTempDir):
27
28
    def test_no_default_parent(self):
28
29
        """Branches should have no parent by default"""
29
 
        b = Branch('.', init=True)
 
30
        b = Branch.initialize('.')
30
31
        self.assertEquals(b.get_parent(), None)
31
32
        
32
33
    
33
34
    def test_set_get_parent(self):
34
35
        """Set and then re-get the parent"""
35
 
        b = Branch('.', init=True)
 
36
        b = Branch.initialize('.')
36
37
        url = 'http://bazaar-ng.org/bzr/bzr.dev'
37
38
        b.set_parent(url)
38
39
        self.assertEquals(b.get_parent(), url)
42
43
        from bzrlib.commands import run_bzr
43
44
 
44
45
        os.mkdir('from')
45
 
        branch_from = Branch('from', init=True)
 
46
        branch_from = Branch.initialize('from')
46
47
        file('from/foo', 'wt').write('contents of foo')
47
48
        branch_from.add('foo')
48
 
        branch_from.commit('initial commit')
 
49
        branch_from.working_tree().commit('initial commit')
49
50
        
50
51
        os.mkdir('to')
51
52
        copy_branch(branch_from, 'to', None)
52
53
 
53
 
        branch_to = Branch('to')
 
54
        branch_to = Branch.open('to')
54
55
        abspath = os.path.abspath('from')
55
56
        self.assertEquals(branch_to.get_parent(), abspath)
56
57