Bazaar plugin: List of modified files on pre-commit hook

1.4k Views Asked by At

I want to write a Bazaar plugin that performs some actions one the modified files before they are committed. Things like checking for syntax errors, and warning the commiter if there are still TODO's in the file.

How do I get a list of the modified files in a Bazaar plugin?

1

There are 1 best solutions below

0
On BEST ANSWER

If you're using pre_commit hook then your hook function will get tree_delta as one of argument (see doc on hook signatures). You need to use tree_delta object to access list of added/modified/renamed files. Documentation of TreeDelta class is available here.

Example of pre_commit hook code you can see here.