/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/test_fetch.py

  • Committer: Andrew Bennetts
  • Date: 2008-11-27 09:00:45 UTC
  • mfrom: (3865 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3866.
  • Revision ID: andrew.bennetts@canonical.com-20081127090045-qxatg46jzwrbh2lg
Merge bzr.dev, resolving NEWS conflict.  (And improve the wording of the new NEWS entry too.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
374
374
        self.assertEqual(('get_record_stream', [('rev-one',)],
375
375
                          target._fetch_order, False),
376
376
                         self.find_get_record_stream(source.inventories.calls))
377
 
        # Because of bugs in the old fetch code, revisions could accidentally
378
 
        # have deltas present in knits. However, it was never intended, so we
379
 
        # always for include_delta_closure=True, to make sure we get fulltexts.
380
 
        # bug #261339
381
377
        self.assertEqual(('get_record_stream', [('rev-one',)],
382
 
                          target._fetch_order, True),
 
378
                          target._fetch_order, False),
383
379
                         self.find_get_record_stream(source.revisions.calls))
384
380
        # XXX: Signatures is special, and slightly broken. The
385
381
        # standard item_keys_introduced_by actually does a lookup for every
390
386
        # we care about.
391
387
        signature_calls = source.signatures.calls[-1:]
392
388
        self.assertEqual(('get_record_stream', [('rev-one',)],
393
 
                          target._fetch_order, True),
 
389
                          target._fetch_order, False),
394
390
                         self.find_get_record_stream(signature_calls))
395
391
 
396
392
    def test_fetch_no_deltas_with_delta_closure(self):
432
428
                          target._fetch_order, True),
433
429
                         self.find_get_record_stream(signature_calls))
434
430
 
 
431
    def test_fetch_revisions_with_deltas_into_pack(self):
 
432
        # See BUG #261339, dev versions of bzr could accidentally create deltas
 
433
        # in revision texts in knit branches (when fetching from packs). So we
 
434
        # ensure that *if* a knit repository has a delta in revisions, that it
 
435
        # gets properly expanded back into a fulltext when stored in the pack
 
436
        # file.
 
437
        tree = self.make_branch_and_tree('source', format='dirstate')
 
438
        target = self.make_repository('target', format='pack-0.92')
 
439
        self.build_tree(['source/file'])
 
440
        tree.set_root_id('root-id')
 
441
        tree.add('file', 'file-id')
 
442
        tree.commit('one', rev_id='rev-one')
 
443
        # Hack the KVF for revisions so that it "accidentally" allows a delta
 
444
        tree.branch.repository.revisions._max_delta_chain = 200
 
445
        tree.commit('two', rev_id='rev-two')
 
446
        source = tree.branch.repository
 
447
        # Ensure that we stored a delta
 
448
        source.lock_read()
 
449
        self.addCleanup(source.unlock)
 
450
        record = source.revisions.get_record_stream([('rev-two',)],
 
451
            'unordered', False).next()
 
452
        self.assertEqual('knit-delta-gz', record.storage_kind)
 
453
        target.fetch(tree.branch.repository, revision_id='rev-two')
 
454
        # The record should get expanded back to a fulltext
 
455
        target.lock_read()
 
456
        self.addCleanup(target.unlock)
 
457
        record = target.revisions.get_record_stream([('rev-two',)],
 
458
            'unordered', False).next()
 
459
        self.assertEqual('knit-ft-gz', record.storage_kind)
 
460
 
 
461
 
435
462
 
436
463
class Test1To2Fetch(TestCaseWithTransport):
437
464
    """Tests for Model1To2 failure modes"""