~ubuntu-branches/ubuntu/karmic/bzr/karmic-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2008-08-25 19:06:49 UTC
  • mfrom: (1.1.44 upstream)
  • Revision ID: james.westby@ubuntu.com-20080825190649-pq87jonr4uvs7s0y
Tags: 1.6-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        finally:
94
94
            to_repo.unlock()
95
95
 
96
 
        # Implementations can either copy the missing basis text, or raise an
97
 
        # exception
 
96
        # Implementations can either ensure that the target of the delta is
 
97
        # reconstructable, or raise an exception (which stream based copies
 
98
        # generally do).
98
99
        try:
99
100
            to_repo.fetch(tree.branch.repository, 'rev-two')
100
101
        except errors.RevisionNotPresent, e:
101
102
            # If an exception is raised, the revision should not be in the
102
103
            # target.
103
 
            self.assertRaises(
104
 
                (errors.NoSuchRevision, errors.RevisionNotPresent),
105
 
                 to_repo.revision_tree, 'rev-two')
 
104
            self.assertRaises((errors.NoSuchRevision, errors.RevisionNotPresent),
 
105
                              to_repo.revision_tree, 'rev-two')
106
106
        else:
107
 
            # If not exception is raised, then the basis text should be
 
107
            # If not exception is raised, then the text should be
108
108
            # available.
109
109
            to_repo.lock_read()
110
110
            try:
111
 
                rt = to_repo.revision_tree('rev-one')
112
 
                self.assertEqual('contents of tree/a\n',
 
111
                rt = to_repo.revision_tree('rev-two')
 
112
                self.assertEqual('new contents\n',
113
113
                                 rt.get_file_text('a-id'))
114
114
            finally:
115
115
                to_repo.unlock()
118
118
        repo_a = self.make_repository('.')
119
119
        repo_b = repository.Repository.open('.')
120
120
        try:
121
 
            self.assertRaises(errors.NoSuchRevision, repo_b.fetch, repo_a,
122
 
                              revision_id='XXX')
 
121
            self.assertRaises(errors.NoSuchRevision, repo_b.fetch, repo_a, revision_id='XXX')
123
122
        except errors.LockError, e:
124
123
            check_old_format_lock_error(self.repository_format)
125
124
 
173
172
        from_tree.add('filename', 'funky-chars<>%&;"\'')
174
173
        from_tree.commit('commit filename')
175
174
        to_repo = self.make_to_repository('to')
176
 
        to_repo.fetch(from_tree.branch.repository,
177
 
                      from_tree.get_parent_ids()[0])
 
175
        to_repo.fetch(from_tree.branch.repository, from_tree.get_parent_ids()[0])
178
176
 
179
177
    def test_fetch_revision_hash(self):
180
178
        """Ensure that inventory hashes are updated by fetch"""
207
205
        to_repo.fetch(from_tree.branch.repository, tree_rev)
208
206
        # to_repo should have a file_graph for from_tree.path2id('subtree') and
209
207
        # revid tree_rev.
 
208
        file_id = from_tree.path2id('subtree')
210
209
        to_repo.lock_read()
211
210
        try:
212
 
            file_vf = to_repo.weave_store.get_weave(
213
 
                from_tree.path2id('subtree'), to_repo.get_transaction())
214
 
            self.assertEqual([tree_rev], file_vf.get_ancestry([tree_rev]))
 
211
            self.assertEqual({(file_id, tree_rev):()},
 
212
                to_repo.texts.get_parent_map([(file_id, tree_rev)]))
215
213
        finally:
216
214
            to_repo.unlock()