Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,333
Community Members
 
Community Events
176
Community Groups

Linking to issues where the link needs a space character

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

 

3 answers

1 accepted

0 votes
Answer accepted

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

Like # people like this

Hi Charles,

You are very welcome, please feel free to reach out if you ever need anything else.

Kind regards,
Theodora

0 votes
Norbert C Atlassian Team Mar 21, 2022

Hi @Charles Smothers - Sierra 

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

No - Craig's suggestion did not work.  See the additional comments that I've included in this thread.

Thanks,

--

Charles

0 votes

Have you tried
Change\#(\d+)

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

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.

After reading more about Python Regular Expressions, I've also tried variations of these:

Change\040\043(\d+)

Change[ ][#](\d+)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events