~benoit.pierre/bzrtools/shell_improvements

« back to all changes in this revision

Viewing changes to tests/test_fetch_ghosts.py

  • Committer: Benoît Pierre
  • Date: 2009-08-02 12:55:24 UTC
  • mfrom: (682.1.36 bzrtools)
  • Revision ID: benoit.pierre@gmail.com-20090802125524-1p2oot1y2l0y3o9w
Merge with upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from bzrlib.plugins.bzrtools.fetch_ghosts import GhostFetcher
 
2
from bzrlib.tests import TestCaseWithTransport
 
3
 
 
4
 
 
5
class TestFetchGhosts(TestCaseWithTransport):
 
6
 
 
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'])
 
11
        tree.commit('rev2')
 
12
        return tree
 
13
 
 
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'))
 
19
 
 
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'))