Search code examples
tortoisehgissue-trackingbitbucket

How can I integrate bitbucket.org's Issues with issue tracking in TortoiseHg?


I can not find any documentation for this - is it possible?


Solution

  • The help for the fields you've found in the TortoiseHg config dialog (thg userconfig) is:

    • Issue Regex field:

      Defines the regex to match when picking up issue numbers.

    • Issue Link field:

      Defines the command to run when an issue number is recognized. You may include groups in issue.regex, and corresponding {n} tokens in issue.link (where n is a non-negative integer). {0} refers to the entire string matched by issue.regex, while {1} refers to the first group and so on. If no {n} tokensare found in issue.link, the entire matched string is appended instead.

    In other words, if you configure them like

    [tortoisehg]
    issue.regex = [Ii]ssue(\d+)
    issue.link = https://www.mercurial-scm.org/bts/issue{1}
    

    then you will have a setting suitable for the Mercurial project itself: if a commit message contains the text "issueNNN" or "IssueNNN", then TortoiseHg will now make that a link to the Mercurial bug tracker for Issue NNN.

    For Bitbucket's issue tracker you will want a link like

    https://bitbucket.org/<user>/<repo>/issue/{1}/
    

    and then capture the issue number in the regular expression. This works because Bitbucket is smart enough to ignore the rest of the URL after the issue number -- you can write whatever you want there, or write nothing as above.

    Very simple functionality, but also quite useful when you often lookup bugs based on the commit messages.