~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
            revprops=revprops,
227
227
            possible_master_transports=possible_master_transports,
228
228
            *args, **kwargs)
 
229
        post_hook_params = PostCommitHookParams(self)
 
230
        for hook in MutableTree.hooks['post_commit']:
 
231
            hook(post_hook_params)
229
232
        return committed_id
230
233
 
231
234
    def _gather_kinds(self, files, kinds):
581
584
        self.create_hook(hooks.HookPoint('start_commit',
582
585
            "Called before a commit is performed on a tree. The start commit "
583
586
            "hook is able to change the tree before the commit takes place. "
584
 
            "start_commit is called with the bzrlib.tree.MutableTree that the "
585
 
            "commit is being performed on.", (1, 4), None))
 
587
            "start_commit is called with the bzrlib.mutabletree.MutableTree "
 
588
            "that the commit is being performed on.", (1, 4), None))
 
589
        self.create_hook(hooks.HookPoint('post_commit',
 
590
            "Called after a commit is performed on a tree. The hook is "
 
591
            "called with a bzrlib.mutabletree.PostCommitHookParams object. "
 
592
            "The mutable tree the commit was performed on is available via "
 
593
            "the mutable_tree attribute of that object.", (2, 0), None))
586
594
 
587
595
 
588
596
# install the default hooks into the MutableTree class.
589
597
MutableTree.hooks = MutableTreeHooks()
590
598
 
591
599
 
 
600
class PostCommitHookParams(object):
 
601
    """Parameters for the post_commit hook.
 
602
 
 
603
    To access the parameters, use the following attributes:
 
604
 
 
605
    * mutable_tree - the MutableTree object
 
606
    """
 
607
 
 
608
    def __init__(self, mutable_tree):
 
609
        """Create the parameters for the post_commit hook."""
 
610
        self.mutable_tree = mutable_tree
 
611
 
 
612
 
592
613
class _FastPath(object):
593
614
    """A path object with fast accessors for things like basename."""
594
615