~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionnamespaces.py

  • Committer: Robert Collins
  • Date: 2005-12-24 02:20:45 UTC
  • mto: (1185.50.57 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1550.
  • Revision ID: robertc@robertcollins.net-20051224022045-14efc8dfa0e1a4e9
Start tests for api usage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import time
19
19
 
20
20
from bzrlib.branch import Branch
21
 
from bzrlib.selftest import TestCaseInTempDir
 
21
from bzrlib.tests import TestCaseInTempDir
22
22
from bzrlib.errors import NoCommonAncestor, NoCommits
23
23
from bzrlib.errors import NoSuchRevision
24
24
from bzrlib.clone import copy_branch
32
32
 
33
33
        These identify revisions by date, etc."""
34
34
 
35
 
        b = Branch.initialize('.')
 
35
        b = Branch.initialize(u'.')
36
36
 
37
 
        b.commit('Commit one', rev_id='a@r-0-1', timestamp=time.time() - 60*60*24)
38
 
        b.commit('Commit two', rev_id='a@r-0-2')
39
 
        b.commit('Commit three', rev_id='a@r-0-3')
 
37
        b.working_tree().commit('Commit one', rev_id='a@r-0-1', timestamp=time.time() - 60*60*24)
 
38
        b.working_tree().commit('Commit two', rev_id='a@r-0-2')
 
39
        b.working_tree().commit('Commit three', rev_id='a@r-0-3')
40
40
 
41
41
        self.assertEquals(RevisionSpec(None).in_history(b), (0, None))
42
42
        self.assertEquals(RevisionSpec(1).in_history(b), (1, 'a@r-0-1'))
70
70
 
71
71
        os.mkdir('copy')
72
72
        b3 = copy_branch(b, 'copy')
73
 
        b3.commit('Commit four', rev_id='b@r-0-4')
 
73
        b3.working_tree().commit('Commit four', rev_id='b@r-0-4')
74
74
        self.assertEquals(RevisionSpec('ancestor:.').in_history(b3).rev_id,
75
75
                          'a@r-0-3')
76
76
        merge(['copy', -1], [None, None])
77
 
        b.commit('Commit five', rev_id='a@r-0-4')
 
77
        b.working_tree().commit('Commit five', rev_id='a@r-0-4')
78
78
        self.assertEquals(RevisionSpec('ancestor:copy').in_history(b).rev_id,
79
79
                          'b@r-0-4')
80
80
        self.assertEquals(RevisionSpec('ancestor:.').in_history(b3).rev_id,
84
84
        """Ensure that the branch namespace pulls in the requisite content."""
85
85
        self.build_tree(['branch1/', 'branch1/file', 'branch2/'])
86
86
        branch = Branch.initialize('branch1')
87
 
        branch.add(['file'])
88
 
        branch.commit('add file')
 
87
        branch.working_tree().add(['file'])
 
88
        branch.working_tree().commit('add file')
89
89
        copy_branch(branch, 'branch2')
90
90
        print >> open('branch2/file', 'w'), 'new content'
91
91
        branch2 = Branch.open('branch2')
92
 
        branch2.commit('update file', rev_id='A')
 
92
        branch2.working_tree().commit('update file', rev_id='A')
93
93
        spec = RevisionSpec('branch:./branch2/.bzr/../')
94
94
        rev_info = spec.in_history(branch)
95
95
        self.assertEqual(rev_info, (None, 'A'))