~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-08-29 01:46:49 UTC
  • mfrom: (3363.10.29 preview-post)
  • Revision ID: pqm@pqm.ubuntu.com-20080829014649-2xy77164nvtxzl9y
Test interface of PreviewTree in the post-change state (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib import (
29
29
    errors,
30
30
    osutils,
 
31
    progress,
31
32
    tests,
32
33
    transform,
33
34
    )
42
43
from bzrlib.tests.workingtree_implementations import (
43
44
    WorkingTreeTestProviderAdapter,
44
45
    )
 
46
from bzrlib.revision import NULL_REVISION
45
47
from bzrlib.revisiontree import RevisionTree
46
48
from bzrlib.transform import TransformPreview
47
49
from bzrlib.workingtree import (
79
81
    return preview_tree
80
82
 
81
83
 
 
84
def preview_tree_post(testcase, tree):
 
85
    basis = tree.basis_tree()
 
86
    tt = TransformPreview(basis)
 
87
    testcase.addCleanup(tt.finalize)
 
88
    pp = progress.ProgressPhase('', 1, progress.DummyProgress())
 
89
    tree.lock_read()
 
90
    testcase.addCleanup(tree.unlock)
 
91
    transform._prepare_revert_transform(basis, tree, tt, None, False, pp,
 
92
                                        basis, {})
 
93
    preview_tree = tt.get_preview_tree()
 
94
    preview_tree.set_parent_ids(tree.get_parent_ids())
 
95
    return preview_tree
 
96
 
 
97
 
82
98
class TestTreeImplementationSupport(TestCaseWithTransport):
83
99
 
84
100
    def test_revision_tree_from_workingtree(self):
327
343
            WorkingTreeFormat4()))
328
344
        self.scenarios.append(self.create_tree_scenario('PreviewTree',
329
345
            preview_tree_pre))
 
346
        self.scenarios.append(self.create_tree_scenario('PreviewTreePost',
 
347
            preview_tree_post))
330
348
 
331
349
    def create_tree_scenario(self, name, converter, workingtree_format=None):
332
350
        """Create a scenario for the specified converter