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

I am trying to write a bzr post-commithook for my private bugtracker, but I am stuck in a function signature

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

How can I extract a commit for a branch from this post using bzrlibc Python?

+5
source share
1 answer

And the answer is:

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 retrieve the message.

+5
source

Source: https://habr.com/ru/post/1696667/


All Articles