""")
-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:
+ _irker.IrkerSender(br, rev_id, br.get_config_stack()).send()
def test_suite():
class IrkerSender(object):
"""An irker message sender."""
- def __init__(self, branch, revision_id, config, local_branch=None,
- op='commit'):
+ def __init__(self, branch, revision_id, config):
self.config = config
self.branch = branch
self.repository = branch.repository
- if (local_branch is not None and
- local_branch.repository.has_revision(revision_id)):
- self.repository = local_branch.repository
self._revision_id = revision_id
self.revision = None
self.revno = None
- self.op = op
def _setup_revision_and_revno(self):
self.revision = self.repository.get_revision(self._revision_id)
self.revno = self.branch.revision_id_to_revno(self._revision_id)
def _format(self):
+ delta = self.branch.repository.get_revision_delta(self._revision_id)
+ files = []
+ [files.append(f) for (f,_,_) in delta.added]
+ [files.append(f) for (f,_,_) in delta.removed]
+ [files.append(f) for (_,f,_,_,_,_) in delta.renamed]
+ [files.append(f) for (f,_,_,_,_) in delta.modified]
+
fields = {
'project': self.project(),
'committer': self.revision.committer,
- 'repo': '',
+ 'repo': self.branch.nick,
'rev': '%d' % self.revno,
- 'files': '',
+ 'files': ' '.join(files),
'logmsg': self.revision.get_summary(),
'url': self.url(),
}