230
230
branch.set_submit_branch('sftp://example.net')
231
231
self.assertEqual(branch.get_submit_branch(), 'sftp://example.net')
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('.')
237
236
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)
237
rev_id = wt.commit('commit against a ghost first parent.')
238
rev = wt.branch.repository.get_revision(rev_id)
239
self.assertEqual(rev.parent_ids, ['non:existent@rev--ision--0--2'])
241
240
# parent_sha1s is not populated now, WTF. rbc 20051003
242
241
self.assertEqual(len(rev.parent_sha1s), 0)
243
self.assertEqual(rev.parent_ids[0], 'non:existent@rev--ision--0--2')
243
def test_record_two_ghosts(self):
244
"""Recording with all ghosts works."""
245
wt = self.make_branch_and_tree('.')
246
wt.add_pending_merge('foo@azkhazan-123123-abcabc')
247
wt.add_pending_merge('wibble@fofof--20050401--1928390812')
248
rev_id = wt.commit("commit from ghost base with one merge")
249
# the revision should have been committed with two parents
250
rev = wt.branch.repository.get_revision(rev_id)
251
self.assertEqual(['foo@azkhazan-123123-abcabc',
252
'wibble@fofof--20050401--1928390812'],
245
255
def test_bad_revision(self):
246
256
self.assertRaises(errors.InvalidRevisionId,
252
262
# an identical tree without a ghost
253
263
# fetch missing should rewrite the TOC of weaves to list newly available parents.
255
def test_pending_merges(self):
256
"""Tracking pending-merged revisions."""
257
wt = self.make_branch_and_tree('.')
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(), [])
278
265
def test_sign_existing_revision(self):
279
266
wt = self.make_branch_and_tree('.')
280
267
branch = wt.branch