/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/repository_implementations/test_fetch.py

  • Committer: Lukáš Lalinský
  • Date: 2007-12-17 17:28:25 UTC
  • mfrom: (3120 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3123.
  • Revision ID: lalinsky@gmail.com-20071217172825-tr3pqm1mhvs3gwnn
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    bzrdir,
21
21
    errors,
22
22
    gpg,
 
23
    repository,
23
24
    )
24
25
from bzrlib.tests import TestSkipped
25
26
from bzrlib.tests.repository_implementations import TestCaseWithRepository
68
69
        # disk.
69
70
        knit3_repo = b_bzrdir.open_repository()
70
71
        rev1_tree = knit3_repo.revision_tree('rev1')
71
 
        lines = rev1_tree.get_file_lines(rev1_tree.inventory.root.file_id)
 
72
        lines = rev1_tree.get_file_lines(rev1_tree.get_root_id())
72
73
        self.assertEqual([], lines)
73
74
        b_branch = b_bzrdir.create_branch()
74
75
        b_branch.pull(tree_a.branch)
81
82
        rev2_tree = knit3_repo.revision_tree('rev2')
82
83
        self.assertEqual('rev1', rev2_tree.inventory.root.revision)
83
84
 
 
85
    def test_fetch_all_from_self(self):
 
86
        tree = self.make_branch_and_tree('.')
 
87
        rev_id = tree.commit('one')
 
88
        # This needs to be a new copy of the repository, if this changes, the
 
89
        # test needs to be rewritten
 
90
        repo = tree.branch.repository.bzrdir.open_repository()
 
91
        # This fetch should be a no-op see bug #158333
 
92
        tree.branch.repository.fetch(repo, None)
 
93
 
 
94
    def test_fetch_from_self(self):
 
95
        tree = self.make_branch_and_tree('.')
 
96
        rev_id = tree.commit('one')
 
97
        repo = tree.branch.repository.bzrdir.open_repository()
 
98
        # This fetch should be a no-op see bug #158333
 
99
        tree.branch.repository.fetch(repo, rev_id)
 
100
 
 
101
    def test_fetch_missing_from_self(self):
 
102
        tree = self.make_branch_and_tree('.')
 
103
        rev_id = tree.commit('one')
 
104
        # Even though the fetch() is a NO-OP it should assert the revision id
 
105
        # is present
 
106
        repo = tree.branch.repository.bzrdir.open_repository()
 
107
        self.assertRaises(errors.NoSuchRevision, tree.branch.repository.fetch,
 
108
                          repo, 'no-such-revision')
 
109
 
84
110
    def makeARepoWithSignatures(self):
85
111
        wt = self.make_branch_and_tree('a-repo-with-sigs')
86
112
        wt.commit('rev1', allow_pointless=True, rev_id='rev1')