~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_parent.py

  • Committer: Robert Collins
  • Date: 2005-10-06 22:15:52 UTC
  • mfrom: (1185.13.2)
  • mto: This revision was merged to the branch mainline in revision 1420.
  • Revision ID: robertc@robertcollins.net-20051006221552-9b15c96fa504e0ad
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

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