Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a commit message from a bzr post-commit hook?

Tags:

I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of

post_commit(local, master, old_revno, old_revid, new_revno, mew_revid)

How can I extract the commit message for the branch from this with bzrlib in Python?

like image 422
Josh Matthews Avatar asked Sep 04 '08 02:09

Josh Matthews


1 Answers

And the answer is like so:

def check_commit_msg(local, master, old_revno, old_revid, new_revno, new_revid):
    branch = local or master
    revision = branch.repository.get_revision(new_revid)
    print revision.message

local and master are Branch objects, so once you have a revision, it's easy to extract the message.

like image 142
Josh Matthews Avatar answered Oct 12 '22 09:10

Josh Matthews