I have been trying to get Bitbucket to link my commits back to an issue in Team Dynamix. It mostly works.
If I create a commit in Bitbucket with this in the commit message, then Team Dynamix can find the commit and link it to the change request commit in Bitbucket:
"Change #123456 - change the foo to bar"
From the Team Dynamix side, this works just fine.
However I cannot get Bitbucket to link back to Team Dynamix
I've tried making this the link key: Change #(\d+) and I've tried Change\s#(\d+)
If I make the commit message "TDX-123456 - change the foo to bar"
And if I then make the link key TDX-(\d+) then Bitbucket will link the commit to the Team Dynamix ticket. But with this commit message, Team Dynamix will not find the commit.
I'm trying to get Bitbucket to include the space character in the commit message as part of the regex so that it will utilize the right link url. The documentation says that it uses python regex so that is what I'm trying: https://bitbucket.org/blog/use-custom-regex-to-link-anywhere-on-bitbucket
Is there anyone who has used the regex feature to get links to work?
--
Charles
Hi Charles,
I have attempted to reproduce this, a link configured as follows:
Link url: https://www.example.com/TDX-\1
Link key: Change\s#(\d+)
will turn the text 'Change #123456' into a link for https://www.example.com/TDX-123456, as long as the number of digits in the issue key is six or less.
If there are more digits, e.g. 'Change #1234567' or 'Change #12345678', I can see that the numeric part turns into a link for a Bitbucket commit. Can you please confirm if there are there more than 6 digits in the numeric part of your issue keys?
We have a bug report for this in our issue tracker, where I have also added your specific use case in a private comment:
I'm afraid that we don't have a workaround for this regex pattern at the moment.
Using a key like TDX-(\d+) should work ok even for issue keys that have more than 6 digits.
I would suggest selecting the link This affects my team in the bug report to indicate you are affected by this issue. You are more than welcome to leave any feedback there, and you can also add yourself as a watcher (by selecting the Start watching this issue link in the bug report) if you'd like to get notified via email on any updates.
Please keep in mind that we don't provide ETAs and bug fixing is implemented as per our policy here.
Kind regards,
Theodora
Theodora,
This exactly answers my question - however our change numbers do indeed have more than 6 digits. Our id numbers are now 7 digits. I'm so appreciative that you found that the number of digits was a factor.
I did run across the BCLOUD-20799 bug report when I was searching for answers, but I wasn't sure that it was related to my issue. I've followed your suggestion and clicked the "This affects my team" link. I'll leave feedback there as well. And I'll follow the issue.
I'll accept this answer - Thanks again.
--
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charles,
You are very welcome, please feel free to reach out if you ever need anything else.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for contacting Atlassian Community, my name is Norbert and I'm a Bitbucket Cloud Support Engineer, it's nice to meet with you!
Can you verify if you've tried Craig's suggestion? Did it work for you?
We're looking forward to hear from you.
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No - Craig's suggestion did not work. See the additional comments that I've included in this thread.
Thanks,
--
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried the following:
Change\s#(\d+)
Change\s\#(\d+)
Change \#(\d+)
Change\ \#(\d+)
In every case, the numbers after the # would be hyper-linked back to bitbucket and not linked back to the url that is configured into the Repository Links.
Is there some amount of time I need to wait between making a change to the links and when I look at the commit history to see whether my change had any affect?
--
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you look at the various ways I tried to escape the space and/or the # none worked.
It seems that perhaps something in Bitbucket gets the first try at a pattern match and it is finding the #123456 and therefore any patterns I try to use will not be given a chance to match.
Can someone look at the code in Bitbucket to see if that is the case?
Or try to reproduce it yourself with these steps:
1. create a commit with this commit message: "Change #123456 - change the foo to bar"
2. push the commit to Bitbucket
3. look at the commit history in Bitbucket - notice that it is hyperlinked and notice what the link points to. The hyperlink will be something like this: https://bitbucket.org/customer-domain/repo-name/commits/123456
4. try creating new Repository Link that will result in the the hyperlink pointing to some other url.
Nothing I do with regards to creating or editing the Repository Links will result in any other hyperlink.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After reading more about Python Regular Expressions, I've also tried variations of these:
Change\040\043(\d+)
Change[ ][#](\d+)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.