X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=__init__.py;h=bae47ea3e9e7b898d458a7ff20b761de3df4631b;hb=fbf251de0ad945d3b25bcd991af64f6836d3ece1;hp=ca1768e45974a038c8c4f297352aa85c4df057a4;hpb=6a73fedeef5fea9b643fa5f7a47f4b161c6cf5de;p=bzrirker.git diff --git a/__init__.py b/__init__.py index ca1768e..bae47ea 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,14 @@ # GPL 2+ - see COPYING for details """Sending irker notifications for commits and branch changes. -Details to follow +This will talk to an irkerd (currently assumed to be running on localhost) +and post commit logs. + +Useful configuration settings: + irker_project - The name of the project used in announcements + irker_channels - The irc channels to post announcements to + irker_colours - Settings for using colours in the announcements (ANSI or + mIRC) """ from bzrlib.config import option_registry @@ -17,25 +24,24 @@ from bzrlib.plugins.bzrirker import irkerhook as _irkerhook """) -def post_commit(branch, revision_id): - """This is the post_commit hook that should get run after commit.""" - _irkerhook.IrkerSender(branch, revision_id, - branch.get_config_stack()).send_maybe() - - def branch_commit_hook(local, master, old_revno, old_revid, new_revno, new_revid): """This is the post_commit hook that runs after commit.""" - _irkerhook.IrkerSender(master, new_revid, master.get_config_stack(), - local_branch=local).send_maybe() + if local is None: + _irkerhook.IrkerSender(master, new_revid, + master.get_config_stack()).send() + else: + _irkerhook.IrkerSender(local, new_revid, + master.get_config_stack()).send() def branch_post_change_hook(params): """This is the post_change_branch_tip hook.""" # (branch, old_revno, new_revno, old_revid, new_revid) - _irker.IrkerSender(params.branch, params.new_revid, - params.branch.get_config_stack(), local_branch=None, - op='change').send_maybe() + br = params.branch + revs = br._revision_history()[params.old_revno:params.new_revno] + for rev_id in revs: + _irkerhook.IrkerSender(br, rev_id, br.get_config_stack()).send() def test_suite(): @@ -50,13 +56,12 @@ option_registry.register_lazy("irker_channels", "bzrlib.plugins.bzrirker.irkerhook", "opt_irker_channels") option_registry.register_lazy("irker_colours", "bzrlib.plugins.bzrirker.irkerhook", "opt_irker_colours") -option_registry.register_lazy("irker_url", - "bzrlib.plugins.bzrirker.irkerhook", "opt_irker_url") option_registry.register_lazy("irker_project", "bzrlib.plugins.bzrirker.irkerhook", "opt_irker_project") from bzrlib.hooks import install_lazy_named_hook -install_lazy_named_hook("bzrlib.branch", "Branch.hooks", 'post_commit', - branch_commit_hook, 'bzr-irker') +# This causes double commit messages - investigate what we need further +#install_lazy_named_hook("bzrlib.branch", "Branch.hooks", 'post_commit', +# branch_commit_hook, 'bzr-irker') install_lazy_named_hook("bzrlib.branch", "Branch.hooks", 'post_change_branch_tip', branch_post_change_hook, 'bzr-irker')