How do I get the current file during a bitbucket pull-request.

All,

I'm writing a plugin for BitBucket Server, that is displayed during a pull-request on the review/diff view. As part of this, I'd like to know what file the developer/reviewer is currently looking at.  Does anyone know how to look up the current active file?

I looked through the Developer docs and couldn't find any points of reference to help figure this out.

- Mike D.

1 answer

I think I was able to figure this out, albeit this might not be the best solution.

Within JavaScript, I was able to get the file and fullPath via the following lines:

var filePath =  require('bitbucket/internal/model/page-state').getFilePath();
var fullPath = filePath.attributes.components.join('/');

- Mike D.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

31,149 views 26 12
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