Request: post-commit hook needs more info

Robert Collins robertc at robertcollins.net
Wed Oct 17 22:55:04 BST 2007


On Wed, 2007-10-17 at 16:50 -0500, John Arbash Meinel wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Matthew D. Fuller wrote:
> > On Wed, Oct 17, 2007 at 11:14:15AM -0500 I heard the voice of
> > John Arbash Meinel, and lo! it spake thus:
> >> 1) The path to the working tree for this commit.
> > 
> > This sounds like trouble for a post-commit hook running on a remote
> > server from a checkout...
> > 
> > ("Then, the smart server will attempt to hack into your
> > workstation...")
> > 
> > 
> 
> Well, it could always be set to None. It still seems better than abusing:
>   a_branch.bzrdir.root_transport.local_abspath('.')
> 
> Also, at the moment, all of these hooks are executed on the client.

Hopefully this will change very soon.

> What I would like to see is passing tree, but barring that, tree.basedir.
> 
> As it is, commit.py requires a working tree. One of the first lines is:
> 
>         if working_tree is None:
>             raise BzrError("working_tree must be passed into commit().")
> 
> It is just that these are considered "Branch.hooks", not "WorkingTree.hooks".
> 
> I personally am fine with them declared on the branch (so that a lightweight
> checkout of the same branch will have the same hooks declared). Just that the
> callback should probably be defined in terms of the working tree that is being
> committed, since that *is* actually a required object.
> 
> (Certainly, Branch.commit() doesn't make sense since a Branch is just a
> pointer, it doesn't have any changes to commit.)

Indeed, but branch can still have policy about what changes it will
accept, and about notifying changes that have occured.

I don't think a Branch hook should ever take a tree. 

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071018/59f03370/attachment-0001.pgp 


More information about the bazaar mailing list