~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2005-12-25 00:38:48 UTC
  • mto: (1185.67.11 bzr.revision-storage)
  • mto: This revision was merged to the branch mainline in revision 1550.
  • Revision ID: aaron.bentley@utoronto.ca-20051225003848-111ac71170cb2605
Renamed Branch.storage to Branch.repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        eq(f.count_copied, 1)
59
59
        eq(f.last_revision, 'revision-1')
60
60
 
61
 
        rev = b2.storage.get_revision('revision-1')
62
 
        tree = b2.storage.revision_tree('revision-1')
 
61
        rev = b2.repository.get_revision('revision-1')
 
62
        tree = b2.repository.revision_tree('revision-1')
63
63
        eq(tree.get_file_text('foo-id'), 'hello')
64
64
 
65
65
    def test_revision_tree(self):
66
66
        b1 = Branch.initialize(u'.')
67
67
        b1.working_tree().commit('lala!', rev_id='revision-1', allow_pointless=True)
68
 
        tree = b1.storage.revision_tree('revision-1')
69
 
        tree = b1.storage.revision_tree(None)
 
68
        tree = b1.repository.revision_tree('revision-1')
 
69
        tree = b1.repository.revision_tree(None)
70
70
        self.assertEqual(len(tree.list_files()), 0)
71
 
        tree = b1.storage.revision_tree(NULL_REVISION)
 
71
        tree = b1.repository.revision_tree(NULL_REVISION)
72
72
        self.assertEqual(len(tree.list_files()), 0)
73
73
 
74
74
    def get_unbalanced_branch_pair(self):
92
92
        """Copy the stores from one branch to another"""
93
93
        br_a, br_b = self.get_unbalanced_branch_pair()
94
94
        # ensure the revision is missing.
95
 
        self.assertRaises(NoSuchRevision, br_b.storage.get_revision, 
 
95
        self.assertRaises(NoSuchRevision, br_b.repository.get_revision, 
96
96
                          br_a.revision_history()[0])
97
97
        br_a.push_stores(br_b)
98
98
        # check that b now has all the data from a's first commit.
99
 
        rev = br_b.storage.get_revision(br_a.revision_history()[0])
100
 
        tree = br_b.storage.revision_tree(br_a.revision_history()[0])
 
99
        rev = br_b.repository.get_revision(br_a.revision_history()[0])
 
100
        tree = br_b.repository.revision_tree(br_a.revision_history()[0])
101
101
        for file_id in tree:
102
102
            if tree.inventory[file_id].kind == "file":
103
103
                tree.get_file(file_id).read()
130
130
        branch = Branch.initialize(u'.')
131
131
        branch.working_tree().add_pending_merge('non:existent@rev--ision--0--2')
132
132
        branch.working_tree().commit('pretend to merge nonexistent-revision', rev_id='first')
133
 
        rev = branch.storage.get_revision(branch.last_revision())
 
133
        rev = branch.repository.get_revision(branch.last_revision())
134
134
        self.assertEqual(len(rev.parent_ids), 1)
135
135
        # parent_sha1s is not populated now, WTF. rbc 20051003
136
136
        self.assertEqual(len(rev.parent_sha1s), 0)
139
139
    def test_bad_revision(self):
140
140
        branch = Branch.initialize('.')
141
141
        self.assertRaises(errors.InvalidRevisionId, 
142
 
                          branch.storage.get_revision, None)
 
142
                          branch.repository.get_revision, None)
143
143
 
144
144
# TODO 20051003 RBC:
145
145
# compare the gpg-to-sign info for a commit with a ghost and 
160
160
                          ['foo@azkhazan-123123-abcabc',
161
161
                           'wibble@fofof--20050401--1928390812'])
162
162
        b.working_tree().commit("commit from base with two merges")
163
 
        rev = b.storage.get_revision(b.revision_history()[0])
 
163
        rev = b.repository.get_revision(b.revision_history()[0])
164
164
        self.assertEquals(len(rev.parent_ids), 2)
165
165
        self.assertEquals(rev.parent_ids[0],
166
166
                          'foo@azkhazan-123123-abcabc')
173
173
        branch = Branch.initialize(u'.')
174
174
        branch.working_tree().commit("base", allow_pointless=True, rev_id='A')
175
175
        from bzrlib.testament import Testament
176
 
        branch.storage.sign_revision('A', bzrlib.gpg.LoopbackGPGStrategy(None))
177
 
        self.assertEqual(Testament.from_revision(branch.storage, 
 
176
        strategy = bzrlib.gpg.LoopbackGPGStrategy(None)
 
177
        branch.repository.sign_revision('A', strategy)
 
178
        self.assertEqual(Testament.from_revision(branch.repository, 
178
179
                         'A').as_short_text(),
179
 
                         branch.storage.revision_store.get('A', 'sig').read())
 
180
                         branch.repository.revision_store.get('A', 
 
181
                         'sig').read())
180
182
 
181
183
    def test_store_signature(self):
182
184
        branch = Branch.initialize('.')
183
 
        branch.storage.store_revision_signature(
 
185
        branch.repository.store_revision_signature(
184
186
            bzrlib.gpg.LoopbackGPGStrategy(None), 'FOO', 'A')
185
187
        self.assertEqual('FOO', 
186
 
                         branch.storage.revision_store.get('A', 'sig').read())
 
188
                         branch.repository.revision_store.get('A', 
 
189
                         'sig').read())
187
190
 
188
191
    def test__relcontrolfilename(self):
189
192
        branch = Branch.initialize('.')
217
220
        branch = Branch.initialize('bzr.dev')
218
221
        branch.nick = "My happy branch"
219
222
        branch.working_tree().commit('My commit respect da nick.')
220
 
        committed = branch.storage.get_revision(branch.last_revision())
 
223
        committed = branch.repository.get_revision(branch.last_revision())
221
224
        self.assertEqual(committed.properties["branch-nick"], 
222
225
                         "My happy branch")
223
226