~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Robert Collins
  • Date: 2005-10-27 19:45:18 UTC
  • mfrom: (1185.16.130)
  • Revision ID: robertc@robertcollins.net-20051027194518-58afabc9ab280bb0
MergeĀ fromĀ Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.selftest.HTTPTestUtil import TestCaseWithWebserver
27
27
from bzrlib.trace import mutter
28
28
import bzrlib.transactions as transactions
 
29
from bzrlib.revision import NULL_REVISION
29
30
 
30
31
# TODO: Make a branch using basis branch, and check that it 
31
32
# doesn't request any files that could have been avoided, by 
62
63
        tree = b2.revision_tree('revision-1')
63
64
        eq(tree.get_file_text('foo-id'), 'hello')
64
65
 
 
66
    def test_revision_tree(self):
 
67
        b1 = Branch.initialize('.')
 
68
        b1.commit('lala!', rev_id='revision-1', allow_pointless=True)
 
69
        tree = b1.revision_tree('revision-1')
 
70
        tree = b1.revision_tree(None)
 
71
        self.assertEqual(len(tree.list_files()), 0)
 
72
        tree = b1.revision_tree(NULL_REVISION)
 
73
        self.assertEqual(len(tree.list_files()), 0)
 
74
 
65
75
    def get_unbalanced_branch_pair(self):
66
76
        """Return two branches, a and b, with one file in a."""
67
77
        os.mkdir('a')
127
137
        self.assertEqual(len(rev.parent_sha1s), 0)
128
138
        self.assertEqual(rev.parent_ids[0], 'non:existent@rev--ision--0--2')
129
139
 
 
140
    def test_bad_revision(self):
 
141
        branch = Branch.initialize('.')
 
142
        self.assertRaises(errors.InvalidRevisionId, branch.get_revision, None)
 
143
 
130
144
# TODO 20051003 RBC:
131
145
# compare the gpg-to-sign info for a commit with a ghost and 
132
146
#     an identical tree without a ghost