~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2006-03-07 05:59:14 UTC
  • mfrom: (1558.1.20 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1595.
  • Revision ID: aaron.bentley@utoronto.ca-20060307055914-a88728997afceb90
MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
        to_signature = to_repo.revision_store.get('rev2', 'sig').read()
169
169
        self.assertEqual(from_signature, to_signature)
170
170
 
 
171
 
 
172
class TestCaseWithGhosts(TestCaseWithInterRepository):
 
173
 
 
174
    def setUp(self):
 
175
        super(TestCaseWithGhosts, self).setUp()
 
176
        # we want two repositories at this point
 
177
        # one with a revision that is a ghost in the other
 
178
        # repository.
 
179
 
 
180
        # 'ghost' is a ghost in missing_ghost and not in with_ghost_rev
 
181
        inv = bzrlib.tree.EmptyTree().inventory
 
182
        repo = self.make_repository('with_ghost_rev')
 
183
        sha1 = repo.add_inventory('ghost', inv, [])
 
184
        rev = bzrlib.revision.Revision(timestamp=0,
 
185
                                       timezone=None,
 
186
                                       committer="Foo Bar <foo@example.com>",
 
187
                                       message="Message",
 
188
                                       inventory_sha1=sha1,
 
189
                                       revision_id='ghost')
 
190
        rev.parent_ids = []
 
191
        repo.add_revision('ghost', rev)
 
192
         
 
193
        repo = self.make_to_repository('missing_ghost')
 
194
        sha1 = repo.add_inventory('with_ghost', inv, [])
 
195
        rev = bzrlib.revision.Revision(timestamp=0,
 
196
                                       timezone=None,
 
197
                                       committer="Foo Bar <foo@example.com>",
 
198
                                       message="Message",
 
199
                                       inventory_sha1=sha1,
 
200
                                       revision_id='with_ghost')
 
201
        rev.parent_ids = ['ghost']
 
202
        repo.add_revision('with_ghost', rev)
 
203
 
 
204
    def test_fetch_all_fixes_up_ghost(self):
 
205
        # fetching from a repo with a current ghost unghosts it in referencing
 
206
        # revisions.
 
207
        repo = repository.Repository.open('missing_ghost')
 
208
        rev = repo.get_revision('with_ghost')
 
209
        from_repo = repository.Repository.open('with_ghost_rev')
 
210
        repo.fetch(from_repo)
 
211
        # rev must not be corrupt now
 
212
        rev = repo.get_revision('with_ghost')
 
213
        self.assertEqual([None, 'ghost', 'with_ghost'], repo.get_ancestry('with_ghost'))