post_transform_hook syntax etc

phil wigglesworth philip.wigglesworth at gmail.com
Thu May 17 12:39:46 UTC 2012


I'm trying to work around a
problem<https://bugs.launchpad.net/bzr/+bug/997933>(997933) in Bazaar
(bzrlib 2.5.0). The defect causes Bazaar to trample on
inherited file permissions on files in Win7-64, so that when anyone in the
team changes anything, everyone else gets "file permission" errors on that
changed file. That defect report is not the subject of this post, the
work-around is.

My problem working around that defect is how to create a "post transform
hook", which as far as I can
see<https://code.launchpad.net/%7Ejelmer/bzr/transform-hooks/+merge/89007>is
present in 2.5 of the bzr library (I'm using 2.5.0).

Syntax-wise I have this in my hook file:

from bzrlib import branch

def post_transform_hook():
   print "post_transform_hook"

branch.Branch.hooks.install_named_hook('post_transform',
post_transform_hook, 'My post_transform hook')

Running that garners me the message: "The BranchHooks hook 'post_transform'
is unknown in this version of bzrlib."

Does anyone know what the problem is? I've no real idea of how this stuff
works, so I may have the wrong "import" or something like that, for all I
know, although similar syntax to the above works ok for push and pull. Does
anyone have an example of a post_transform hook I can crib from?

Once I have the hook working without error, I'll need a list of the files
which have changed (been "transformed" I guess) - can anyone tell me where
I can find anything to tell me what parameters may be available to get that
list and iterate it? All I'm going to do is set the "include inheritable
permissions from this object's parent" flag for each file changed, which
solves our problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20120517/6386b38b/attachment.html>


More information about the bazaar mailing list