~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

  • Committer: Aaron Bentley
  • Date: 2008-04-29 15:07:23 UTC
  • mto: (3380.3.3 cleanup)
  • mto: This revision was merged to the branch mainline in revision 3392.
  • Revision ID: aaron@aaronbentley.com-20080429150723-eqd5di6s1cr14q3g
Updates from review

Show diffs side-by-side

added added

removed removed

Lines of Context:
327
327
class Test1To2Fetch(TestCaseWithTransport):
328
328
    """Tests for Model1To2 failure modes"""
329
329
 
330
 
    def do_test(self, first, second):
 
330
    def make_tree_and_repo(self):
 
331
        self.tree = self.make_branch_and_tree('tree', format='pack-0.92')
 
332
        self.repo = self.make_repository('rich-repo', format='rich-root-pack')
 
333
        self.repo.lock_write()
 
334
        self.addCleanup(self.repo.unlock)
 
335
 
 
336
    def do_fetch_order_test(self, first, second):
331
337
        """Test that fetch works no matter what the set order of revision is.
332
338
 
333
339
        This test depends on the order of items in a set, which is
338
344
        self.tree.commit('Commit 2', rev_id=second)
339
345
        self.repo.fetch(self.tree.branch.repository, second)
340
346
 
 
347
    def test_fetch_order_AB(self):
 
348
        """See do_test"""
 
349
        self.do_fetch_order_test('A', 'B')
 
350
 
 
351
    def test_fetch_order_BA(self):
 
352
        """See do_test"""
 
353
        self.do_fetch_order_test('B', 'A')
 
354
 
341
355
    def get_parents(self, file_id, revision_id):
342
356
        transaction = self.repo.get_transaction()
343
357
        vf = self.repo.weave_store.get_weave(file_id, transaction)
344
358
        return vf.get_parents_with_ghosts(revision_id)
345
359
 
346
 
    def test_fetch_order_AB(self):
347
 
        """See do_test"""
348
 
        self.do_test('A', 'B')
349
 
 
350
 
    def test_fetch_order_BA(self):
351
 
        """See do_test"""
352
 
        self.do_test('B', 'A')
353
 
 
354
360
    def test_fetch_ghosts(self):
355
361
        self.make_tree_and_repo()
356
362
        self.tree.commit('first commit', rev_id='left-parent')
366
372
        self.assertEqual(['left-parent', 'ghost-parent', 'not-ghost-parent'],
367
373
                         self.get_parents(root_id, 'second-id'))
368
374
 
369
 
    def make_tree_and_repo(self):
370
 
        self.tree = self.make_branch_and_tree('tree', format='pack-0.92')
371
 
        self.repo = self.make_repository('rich-repo', format='rich-root-pack')
372
 
        self.repo.lock_write()
373
 
        self.addCleanup(self.repo.unlock)
374
 
 
375
375
    def make_two_commits(self, change_root, fetch_twice):
376
376
        self.make_tree_and_repo()
377
377
        self.tree.commit('first commit', rev_id='first-id')