The class that contains each hook is given before the hooks it supplies. For
instance, BranchHooks as the class is the hooks class for
bzrlib.branch.Branch.hooks.

Each description also indicates whether the hook runs on the client (the
machine where bzr was invoked) or the server (the machine addressed by
the branch URL). These may be, but are not necessarily, the same machine.

Plugins (including hooks) are run on the server if all of these is true:

The connection is via a smart server (accessed with a URL starting with
“bzr://”, “bzr+ssh://” or “bzr+http://”, or accessed via a “http://”
URL when a smart server is available via HTTP).

The hook is either server specific or part of general infrastructure rather
than client specific code (such as commit).

Called to determine an automatic tag name for a revision.
automatic_tag_name is called with (branch, revision_id) and should
return a tag name or None if no tag name could be determined. The
first non-None tag name returned will be used.

Called after new branch initialization completes. post_branch_init is
called with a bzrlib.branch.BranchInitHookParams. Note that init,
branch and checkout (both heavyweight and lightweight) will all
trigger this hook.

Called in bzr client and server after a change to the tip of a branch
is made. post_change_branch_tip is called with a
bzrlib.branch.ChangeBranchTipParams. Note that push, pull, commit,
uncommit will all trigger this hook.

Called in the bzr client after a commit has completed. post_commit is
called with (local, master, old_revno, old_revid, new_revno,
new_revid). old_revid is NULL_REVISION for the first commit to a
branch.

Called in the bzr client after an uncommit completes. post_uncommit is
called with (local, master, old_revno, old_revid, new_revno,
new_revid) where local is the local branch or None, master is the
target branch, and an empty branch receives new_revno of 0, new_revid
of None.

Called in bzr client and server before a change to the tip of a branch
is made. pre_change_branch_tip is called with a
bzrlib.branch.ChangeBranchTipParams. Note that push, pull, commit,
uncommit will all trigger this hook.

Called after a commit is calculated but before it is completed.
pre_commit is called with (local, master, old_revno, old_revid,
future_revno, future_revid, tree_delta, future_tree). old_revid is
NULL_REVISION for the first commit to a branch, tree_delta is a
TreeDelta object describing changes from the basis revision. hooks
MUST NOT modify this delta. future_tree is an in-memory tree obtained
from CommitBuilder.revision_tree() and hooks MUST NOT modify this
tree.

Called when a stacked branch is activating its fallback locations.
transform_fallback_location is called with (branch, url), and should
return a new url. Returning the same url allows it to be used as-is,
returning a different one can be used to cause the branch to stack on
a closer copy of that fallback_location. Note that the branch cannot
have history accessing methods called on it during this hook because
the fallback locations have not been activated. When there are
multiple hooks installed for transform_fallback_location, all are
called with the url returned from the previous hook.The order is
however undefined.

Called when creating a single command. Called with (cmd_or_None,
command_name). get_command should either return the cmd_or_None
parameter, or a replacement Command object that should be used for the
command. Note that the Command.hooks hooks are core infrastructure.
Many users will prefer to use bzrlib.commands.register_command or
plugin_cmds.register_lazy.

Called when enumerating commands. Called with a set of cmd_name
strings for all the commands found so far. This set is safe to mutate
- e.g. to remove a command. list_commands should return the updated
set of command names.

Called with a bzrlib.merge.Merger object to create a per file merge
object when starting a merge. Should return either None or a subclass
of bzrlib.merge.AbstractPerFileMerger. Such objects will then be
called per file that needs to be merged (including when one side has
deleted the file and the other has changed it). See the
AbstractPerFileMerger API docs for details on how it is used by merge.

Called with a MergeRequestBodyParams when a body is needed for a merge
request. Callbacks must return a body. If more than one callback is
registered, the output of one callback is provided to the next.

Called when a commit message is being generated.
commit_message_template is called with the bzrlib.commit.Commit object
and the message that is known so far. commit_message_template must
return a new message to use (which could be the same as it was given).
When there are multiple hooks registered for commit_message_template,
they are chained with the result from the first passed into the
second, and so on.

Set a fixed commit message. set_commit_message is called with the
bzrlib.commit.Commit object (so you can also change e.g. revision
properties by editing commit.builder._revprops) and the message so
far. set_commit_message must return the message to use or None if it
should use the message editor as normal.

Called after a commit is performed on a tree. The hook is called with
a bzrlib.mutabletree.PostCommitHookParams object. The mutable tree the
commit was performed on is available via the mutable_tree attribute of
that object.

Called before a commit is performed on a tree. The start commit hook
is able to change the tree before the commit takes place. start_commit
is called with the bzrlib.mutabletree.MutableTree that the commit is
being performed on.

Called by the bzr server when an exception occurs. server_exception is
called with the sys.exc_info() tuple return true for the hook if the
exception has been handled, in which case the server will exit
normally.

Called by the bzr server when it starts serving a directory.
server_started is called with (backing urls, public url), where
backing_url is a list of URLs giving the server-specific directory
locations, and public_url is the public URL for the directory being
served.

Called with argument StatusHookParams after Bazaar has displayed the
status. StatusHookParams has the attributes (old_tree, new_tree,
to_file, versioned, show_ids, short, verbose). The last four arguments
correspond to the command line options specified by the user for the
status command. to_file is the output stream for writing.

Called with argument StatusHookParams before Bazaar displays the
status. StatusHookParams has the attributes (old_tree, new_tree,
to_file, versioned, show_ids, short, verbose). The last four arguments
correspond to the command line options specified by the user for the
status command. to_file is the output stream for writing.