/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/branch_implementations/test_stacking.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-11-21 22:19:32 UTC
  • mfrom: (3830.3.25 288751-pack-deltas)
  • Revision ID: pqm@pqm.ubuntu.com-20081121221932-44m8c85k5ri8h5hg
(mbp) Fix bug #288751 by teaching fetch to expand to fulltexts if it
        would cause a delta to span repo boundaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
class TestStacking(TestCaseWithBranch):
32
32
 
 
33
    def check_lines_added_or_present(self, stacked_branch, revid):
 
34
        # similar to a failure seen in bug 288751 by mbp 20081120
 
35
        stacked_repo = stacked_branch.repository
 
36
        stacked_repo.lock_read()
 
37
        try:
 
38
            list(stacked_repo.inventories.iter_lines_added_or_present_in_keys(
 
39
                    [(revid,)]))
 
40
        finally:
 
41
            stacked_repo.unlock()
 
42
 
33
43
    def test_get_set_stacked_on_url(self):
34
44
        # branches must either:
35
45
        # raise UnstackableBranchFormat or
293
303
        unstacked.fetch(stacked.branch.repository, 'rev2')
294
304
        unstacked.get_revision('rev1')
295
305
        unstacked.get_revision('rev2')
 
306
        self.check_lines_added_or_present(stacked.branch, 'rev1')
 
307
        self.check_lines_added_or_present(stacked.branch, 'rev2')
296
308
 
297
309
    def test_autopack_when_stacked(self):
298
310
        # in bzr.dev as of 20080730, autopack was reported to fail in stacked
334
346
        other_tree = other_dir.open_workingtree()
335
347
        text_lines[9] = 'changed in other\n'
336
348
        self.build_tree_contents([('other/a', ''.join(text_lines))])
337
 
        other_tree.commit('commit in other')
 
349
        stacked_revid = other_tree.commit('commit in other')
338
350
        # this should have generated a delta; try to pull that across
339
351
        # bug 252821 caused a RevisionNotPresent here...
340
352
        stacked_tree.pull(other_tree.branch)
341
353
        stacked_tree.branch.repository.pack()
342
354
        stacked_tree.branch.check()
 
355
        self.check_lines_added_or_present(stacked_tree.branch, stacked_revid)
343
356
 
344
357
    def test_fetch_revisions_with_file_changes(self):
345
358
        # Fetching revisions including file changes into a stacked branch
371
384
        rtree.lock_read()
372
385
        self.addCleanup(rtree.unlock)
373
386
        self.assertEqual('new content', rtree.get_file_by_path('a').read())
 
387
        self.check_lines_added_or_present(target, 'rev2')
374
388
 
375
389
    def test_transform_fallback_location_hook(self):
376
390
        # The 'transform_fallback_location' branch hook allows us to inspect