[MERGE] Add tests for start_commit hook.
John Arbash Meinel
john at arbash-meinel.com
Sat Apr 5 13:55:36 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jelmer Vernooij wrote:
| This patch adds a start_commit hook for MutableTrees (bug 186422). This
| hook is executed before a commit is started and can actually modify the
| state of the working tree, for example by adding files. This patch is
| required to be able to support bzr in etckeeper
| (http://kitenet.net/~joey/code/etckeeper/)
|
| Cheers,
|
| Jelmer
|
This should be a workingtree_implementations test so that we are sure to
maintain the hook in any future implementation.
You also need to define the api of the start_commit hook. It seems like you are
just passing in the mutable tree so just saying:
# the hook has the signature None = hook(MutableTree)
Aka, the return value is ignored, and the Tree being committed is being passed in.
However....
Don't you need to pass in the selected_files? Possibly in a way that it can add
more?
What about the commit message, or any of the other parameters being passed in? I
know there is some amount of just getting enough for what you need, and we are
having an edit_message hook, etc. But we also want to make sure that the hook is
functional for more than just 1 use case.
There is also some small PEP8 stuff in test_mutiabletree.py
I'm fine having those tests there, but we need to have a
workingtree_implementation test for hooks, and we should make sure that all of
them fire 'start_commit' passing in the working tree so that people can depend
on it.
In some ways I'd like it to be an end-to-end blackbox test. Mostly because of
the problems we ran into when we changed 'set_revision_history()' to no longer
be called, and suddenly the 'set_rh' hook was never fired again. It is okay to
do that, but we need to *know* that we are doing so.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH93bIJdeBCYSNAAMRAqSUAJ9c8lMQTB8e90DazQjLX1V/Ay6XJwCgtArH
KVG2je5LqD0Y4+txw/AWVDg=
=Itp1
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list