~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-05-12 03:07:05 UTC
  • mfrom: (3350.3.22 data_stream_revamp)
  • Revision ID: pqm@pqm.ubuntu.com-20080512030705-nvl2q1tuls904eru
Deprecate bzrlib.versionedfiles.VersionedFile.join.

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"""