136
136
tree.commit('foo', rev_id='foo', local=True)
137
137
self.failIf(master.repository.has_revision('foo'))
138
138
self.assertEqual(None, master.last_revision())
140
def test_record_initial_ghost(self):
141
"""The working tree needs to record ghosts during commit."""
142
wt = self.make_branch_and_tree('.')
143
wt.add_pending_merge('non:existent@rev--ision--0--2')
144
rev_id = wt.commit('commit against a ghost first parent.')
145
rev = wt.branch.repository.get_revision(rev_id)
146
self.assertEqual(rev.parent_ids, ['non:existent@rev--ision--0--2'])
147
# parent_sha1s is not populated now, WTF. rbc 20051003
148
self.assertEqual(len(rev.parent_sha1s), 0)
150
def test_record_two_ghosts(self):
151
"""The working tree should preserve all the parents during commit."""
152
wt = self.make_branch_and_tree('.')
153
wt.add_pending_merge('foo@azkhazan-123123-abcabc')
154
wt.add_pending_merge('wibble@fofof--20050401--1928390812')
155
rev_id = wt.commit("commit from ghost base with one merge")
156
# the revision should have been committed with two parents
157
rev = wt.branch.repository.get_revision(rev_id)
158
self.assertEqual(['foo@azkhazan-123123-abcabc',
159
'wibble@fofof--20050401--1928390812'],
141
162
class TestCommitProgress(TestCaseWithWorkingTree):