Previous: , Up: Hooks   [Contents][Index]


6.1.12 Validation Hooks

If there is a policy decision to make, Monotone defines certain hooks to allow a client to validate or reject certain behaviors.

validate_changes (revision_text, branchname)

This hook is called by mtn commit just after the to-be-committed changes and the branch have been logically verified and before the user enters his/her commit message. revision_text is the full text of the changes for this revision, which can be parsed with the parse_basic_io function. The second parameter, branchname, is the branch for this commit - unless it gets changed in edit_comment later on.

If the hook finds the changes satisfactory, it should return true, "". If it finds fault, then it should return false, reason where reason is a string containing the reason the changes were rejected. By default, this hook is not defined and acts as if it returned true, "".

validate_commit_message (message, revision_text, branchname)

This hook is called by mtn commit after edit_comment. message is the result of edit_comment and revision_text is the full text of the changes for this revision, which can be parsed with the parse_basic_io function. branchname is parsed from the result of edit_comment.

If the hook finds the commit message satisfactory, it should return true, "". If it finds fault, then it should return false, reason where reason is a string containing the reason the message was rejected. By default, this hook is not defined and acts as if it returned true, "".

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status