~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_parent.py

  • Committer: Martin Pool
  • Date: 2005-10-06 10:53:12 UTC
  • mto: (1185.13.3)
  • mto: This revision was merged to the branch mainline in revision 1418.
  • Revision ID: mbp@sourcefrog.net-20051006105312-06320dbb986e4bb3
- test that we cannot join weaves with different ancestry

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