1
from bzrlib.plugins.bzrtools.fetch_ghosts import GhostFetcher
2
from bzrlib.tests import TestCaseWithTransport
5
class TestFetchGhosts(TestCaseWithTransport):
7
def prepare_with_ghosts(self):
8
tree = self.make_branch_and_tree('.')
9
tree.commit('rev1', rev_id='rev1-id')
10
tree.set_parent_ids(['rev1-id', 'ghost-id'])
14
def test_fetch_ghosts_failure(self):
15
tree = self.prepare_with_ghosts()
16
branch = self.make_branch('branch')
17
GhostFetcher(tree.branch, branch).run()
18
self.assertFalse(tree.branch.repository.has_revision('ghost-id'))
20
def test_fetch_ghosts_success(self):
21
tree = self.prepare_with_ghosts()
22
ghost_tree = self.make_branch_and_tree('ghost_tree')
23
ghost_tree.commit('ghost', rev_id='ghost-id')
24
GhostFetcher(tree.branch, ghost_tree.branch).run()
25
self.assertTrue(tree.branch.repository.has_revision('ghost-id'))