Manually link JIRA issues to Fisheye commits

Is it possible to manually link a commit to a JIRA issue i.e. not putting the JIRA issue in the commit message? I'm using mercurial if that makes a difference.

Having googled it does seem like the feature is alluded to but I can't find anything definitive.

If it isn't possible are there any alternative such as changing commit comments later or enforncing commit comments to have a JIRA issue in them?

4 answers

1 accepted

3 votes
Joe Xie Atlassian Team Oct 11, 2012

It is not possible to manually link a JIRA issue to a changeset without changing the commit message to contain the JIRA issue key, which means you will have to edit the history of your repository.

Unfortunately, it isn't trivial to edit the history in Mecurial. See this plugin http://mercurial.selenic.com/wiki/HisteditExtension for how you might do it. But it isn't something that I would reocmmend doing.

You could install a pre-commit hook (see http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html) which will enforce that each commit message have the JIRA issue key. This will stop the problem of missing links between issues and changesets.

One way of achieving a similar effect is to use Crucible. You can manually link changesets to code reviews and link code reviews to JIRA issues.

Would it be possible to write a plugin for JIRA that puts a new link type in the "More Actions" -> Link menu off of an issue that would let you create a link that showed up in the "Issue Links" section on the issue? If that's possible, I might be interested in writing a plugin to do it. Then, once we have the link to a changeset in the Issue Links section, we update the FishEye plugin to add looking through there as well as doing the standard RPC search to FishEye for tags in commit messages.

Rewritting repository history is a big no for many use cases. In git this not only makes a repository 'incompatible' with its all existing forks, but also invalidates any signed tags on the affected branches.

And there are many scenarios when one can end with a commit which needs to be linked to an JIRA issue, but does not contain the issue key in the commit:

– user mistakes. Even best pre-commit and pre-update hooks won't help when a user have more than one issue assigned he can refer. If he refers wrong, this stays in the commit message.
– imports of legacy code. The code may contain other keywords to refer to issues, which could have been migrated to JIRA.

– it could be found after a fact, that an issue has been fixed by some commit

etc.

Manual (and programaticall, via API) linking is IMHO a must have for these applications.

I really feel like we do need this. As Jacek said, there's all kinds of situations where you might need to link them after the fact. Rewriting the messages is not the answer on Git and Mercurial.

A less satisfactory workaround is web-linking the issue to the URL which refers to the commit. A poor man's solution.

There needs to be a way to point into Fisheye from jira other than tags in commit messages. Forcing Jira issues to be added during commits isn't enough since more than one issue may need to point at the same source changes. Issues sometimes also need to point to commits already made.

Why can't Jira/Fisheye work like Jira/Confluence, link from anywhere to anywhere and get an automatic reciprocal link??

As a workaround, you can add custom number field, like "changeset", to the issue. Then this would be used with a SIL Scripted field to dynamically create a clickable link. I did this, but using the created date of the ticket to perform a fisheye search.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

800 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you