~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

  • Committer: Robey Pointer
  • Date: 2006-09-03 00:28:18 UTC
  • mfrom: (1981 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060903002818-71ca5c7bfea93a26
merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
        branch.set_submit_branch('sftp://example.net')
231
231
        self.assertEqual(branch.get_submit_branch(), 'sftp://example.net')
232
232
        
233
 
    def test_record_initial_ghost_merge(self):
234
 
        """A pending merge with no revision present is still a merge."""
 
233
    def test_record_initial_ghost(self):
 
234
        """Branches should support having ghosts."""
235
235
        wt = self.make_branch_and_tree('.')
236
 
        branch = wt.branch
237
 
        wt.add_pending_merge('non:existent@rev--ision--0--2')
238
 
        wt.commit('pretend to merge nonexistent-revision', rev_id='first')
239
 
        rev = branch.repository.get_revision(branch.last_revision())
240
 
        self.assertEqual(len(rev.parent_ids), 1)
 
236
        wt.set_parent_ids(['non:existent@rev--ision--0--2'],
 
237
            allow_leftmost_as_ghost=True)
 
238
        rev_id = wt.commit('commit against a ghost first parent.')
 
239
        rev = wt.branch.repository.get_revision(rev_id)
 
240
        self.assertEqual(rev.parent_ids, ['non:existent@rev--ision--0--2'])
241
241
        # parent_sha1s is not populated now, WTF. rbc 20051003
242
242
        self.assertEqual(len(rev.parent_sha1s), 0)
243
 
        self.assertEqual(rev.parent_ids[0], 'non:existent@rev--ision--0--2')
 
243
 
 
244
    def test_record_two_ghosts(self):
 
245
        """Recording with all ghosts works."""
 
246
        wt = self.make_branch_and_tree('.')
 
247
        wt.set_parent_ids([
 
248
                'foo@azkhazan-123123-abcabc',
 
249
                'wibble@fofof--20050401--1928390812',
 
250
            ],
 
251
            allow_leftmost_as_ghost=True)
 
252
        rev_id = wt.commit("commit from ghost base with one merge")
 
253
        # the revision should have been committed with two parents
 
254
        rev = wt.branch.repository.get_revision(rev_id)
 
255
        self.assertEqual(['foo@azkhazan-123123-abcabc',
 
256
            'wibble@fofof--20050401--1928390812'],
 
257
            rev.parent_ids)
244
258
 
245
259
    def test_bad_revision(self):
246
260
        self.assertRaises(errors.InvalidRevisionId,
252
266
#     an identical tree without a ghost
253
267
# fetch missing should rewrite the TOC of weaves to list newly available parents.
254
268
        
255
 
    def test_pending_merges(self):
256
 
        """Tracking pending-merged revisions."""
257
 
        wt = self.make_branch_and_tree('.')
258
 
        b = wt.branch
259
 
        self.assertEquals(wt.pending_merges(), [])
260
 
        wt.add_pending_merge('foo@azkhazan-123123-abcabc')
261
 
        self.assertEquals(wt.pending_merges(), ['foo@azkhazan-123123-abcabc'])
262
 
        wt.add_pending_merge('foo@azkhazan-123123-abcabc')
263
 
        self.assertEquals(wt.pending_merges(), ['foo@azkhazan-123123-abcabc'])
264
 
        wt.add_pending_merge('wibble@fofof--20050401--1928390812')
265
 
        self.assertEquals(wt.pending_merges(),
266
 
                          ['foo@azkhazan-123123-abcabc',
267
 
                           'wibble@fofof--20050401--1928390812'])
268
 
        wt.commit("commit from base with two merges")
269
 
        rev = b.repository.get_revision(b.revision_history()[0])
270
 
        self.assertEquals(len(rev.parent_ids), 2)
271
 
        self.assertEquals(rev.parent_ids[0],
272
 
                          'foo@azkhazan-123123-abcabc')
273
 
        self.assertEquals(rev.parent_ids[1],
274
 
                           'wibble@fofof--20050401--1928390812')
275
 
        # list should be cleared when we do a commit
276
 
        self.assertEquals(wt.pending_merges(), [])
277
 
 
278
269
    def test_sign_existing_revision(self):
279
270
        wt = self.make_branch_and_tree('.')
280
271
        branch = wt.branch