This Mercurial hook updates a Jira issue with your mercurial commits' comment. It utilizes Jira CLI and is triggered by Mercurial commits.
I wrote this hook so my mercurial commits would appear in a bug by putting my bug number into the comments. The hook will log the bug into the Jira comment field, if comment has "BUG:#JIRA_ISSUE".
jira cli 2.6.0
- https://marketplace.atlassian.com/plugins/org.swift.jira.cli#versions
- jira.sh needs to be accessible to your path
- If $HOME/.hgrc doesn't exist, you need to create this file. You then need to add the following line your $HOME/.hgrc
Trigger by commits.
.hgrc:
[hooks] commit = ~/.hg/jira-commit.sh
or
Trigger by push/pull/unbundle
.hgrc:
[hooks] changegroup = ~/.hg/jira-commit.sh
- Create a jira-setting file in $HOME/.hg/jira-setting
jira-settings:
# No space JIRA_HOST=(your mercurial host include port if necessary) JIRA_USERNAME=(your username) JIRA_PASSWORD=(your password)|`(keychain script to retrieve your password)`
- Copy jira-commit.sh to ~/.hg/
Eventually, I will write a installation script that uses ruby brew or something to automate all these steps.