~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-18 10:42:07 UTC
  • mfrom: (6437.3.6 2.5)
  • mto: (6437.3.7 2.5)
  • mto: This revision was merged to the branch mainline in revision 6441.
  • Revision ID: jelmer@vernstok.nl-20120118104207-yc5fhsaz4mupjcam
Merge 2.5 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    PathsNotVersionedError,
38
38
    )
39
39
from bzrlib.inventory import Inventory
 
40
from bzrlib.mutabletree import MutableTree
40
41
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
41
42
from bzrlib.tests import (
42
43
    features,
451
452
            revision_id='a')
452
453
        self.assertEqual(['a'], made_tree.get_parent_ids())
453
454
 
 
455
    def test_post_build_tree_hook(self):
 
456
        calls = []
 
457
        def track_post_build_tree(tree):
 
458
            calls.append(tree.last_revision())
 
459
        source = self.make_branch_and_tree('source')
 
460
        source.commit('a', rev_id='a', allow_pointless=True)
 
461
        source.commit('b', rev_id='b', allow_pointless=True)
 
462
        self.build_tree(['new/'])
 
463
        made_control = self.bzrdir_format.initialize('new')
 
464
        source.branch.repository.clone(made_control)
 
465
        source.branch.clone(made_control)
 
466
        MutableTree.hooks.install_named_hook("post_build_tree",
 
467
            track_post_build_tree, "Test")
 
468
        made_tree = self.workingtree_format.initialize(made_control,
 
469
            revision_id='a')
 
470
        self.assertEqual(['a'], calls)
 
471
 
454
472
    def test_update_sets_last_revision(self):
455
473
        # working tree formats from the meta-dir format and newer support
456
474
        # setting the last revision on a tree independently of that on the