~gz/+junk/treetransform_hook_example

« back to all changes in this revision

Viewing changes to treetransform_hook_plugin.py

  • Committer: Martin Packman
  • Date: 2012-05-17 13:05:50 UTC
  • Revision ID: martin.packman@canonical.com-20120517130550-w29iezxld33uiktg
Trivial example plugin using MutableTree.hooks pre_transform and post_transform

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__doc__ = """Trivial plugin demonstrating MutableTree.post_transform hook"""
 
2
 
 
3
from bzrlib import (
 
4
    mutabletree,
 
5
    trace,
 
6
    )
 
7
 
 
8
 
 
9
def show_pre_transform(tree, ttrans):
 
10
    trace.note("GZ: pre_transform %s %s", tree, list(ttrans.iter_changes()))
 
11
 
 
12
 
 
13
def show_post_transform(tree, ttrans):
 
14
    trace.note("GZ: post_transform %s %s", tree, list(ttrans.iter_changes()))
 
15
 
 
16
 
 
17
mutabletree.MutableTree.hooks.install_named_hook(
 
18
    "pre_transform", show_pre_transform, "Print pre_transform hook details")
 
19
mutabletree.MutableTree.hooks.install_named_hook(
 
20
    "post_transform", show_post_transform, "Print post_transform hook details")