It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

Exclude files from Bitbucket's new pull request experience Edited

Tom Kane Atlassian Team Jan 29, 2019

Hello community!

I'm excited to share that we've released a new feature called Excluded files. You can now exclude files in large diffs on pull requests for which you are the admin, so the review process is easier for everyone involved.

To enable the new feature, go to the repository containing the pull request and click Settings > Excluded files in the Pull Requests section. Learn more.

Please note that for now, the Excluded files filter is only available in the new pull request experience.

Happy coding!

Tom

Bitbucket Developer

7 comments

Super excited about the "Excluded files" feature - it's VERY needed as all our diffs are difficult to manage with package-lock.json changes.

HOWEVER, I cannot seem to get it to work. I have tried turning on "New pull request experience" but it has NO EFFECT on our PR's. I'm not sure why... is there an initialization time of some sort? I've tried turning it off and on, creating PR's after turning it on, to no avail. Can someone help?

Tyler T Atlassian Team Feb 21, 2019

As @Alastair Wilkes mentioned in your other post - this might be caused by toggling the feature for a team account versus a personal account. The "New pull request experience" feature can only be activated on a personal account level.

For others that have run into the same issue, please see this post: https://community.atlassian.com/t5/Bitbucket-questions/quot-New-pull-request-experience-quot-has-no-effect/qaq-p/1014162#M38857

Thank you Tyler. Yep, that was the problem. I also had to clear cookies for BitBucket.org in order to see the new experience.

It's completely pointless to still generate HTML for excluded files. I am trying to utilize Exclude Files to slim down a pull request that fails to load due to having 5000+ files. But because 99% of the files are in an excluded directory, *AND* those files still generate HTML which requires massive load time, the PR still won't load!

You should not generate UI or data for excluded files. Excluded files should not require processing of any kind. Why is the server/client code still having to process excluded files? How am I supposed to exclude our third party libraries directory so that it doesn't cause PRs to fail to load due to number of files?!

Tom Kane Atlassian Team Aug 20, 2019

Hi Robert,

I apologize that I wasn't notified of your message sooner.

Due to technical constraints, we filter out excluded files after the diff is calculated. In the future we plan to filter files before the diff is calculated but it will require changes and upgrades to underlying core components. The feature can still reduce the page to a reasonable size for all but the most massive PRs.

On the PR page you will see a placeholder card for each excluded file, which would result in a large page load if you have 5000+ files in a PR. Are you referring to these placeholder cards when you say the PR is "generat[ing] HTML for excluded files"? You shouldn't be seeing diffs for those excluded files unless you click the link in the placeholder card.

This information surely comes too late to help you with your large PR but I wanted to explain the reasoning.

Regards,

Tom

Yes, I'm referring to the placeholder cards. I do not see diffs, so in that respect the feature is "working as intended", but my feedback is really to say that the feature, as designed, is not good enough for my specific use case.

Tom Kane Atlassian Team Aug 21, 2019

I would like to hear more about your specific use case.

Do you (and/or your team) intend to actually review this PR with 5000+ files? You want to approve the changes to files that aren't in the excluded directory?

Or are you using PRs as a way to merge a batch of changes but you aren't actually reviewing the diff?

If I work on a feature where I modify our normal code, and add a new third party library in to support implementing this feature, there is now essentially two categories of changes: Changes to our own code, and addition of code that we do not own, maintain, or care to look at.

For changes to our own code, we do want to code review those changes. When we add a third party library, that's not our code, but still required to implement the feature. So we don't want to review that third party library code, but it is required to be in version control so it is available.

To keep feature development atomic, we merge everything in together. So really we use exclusions as a mechanism to ignore changes in our "Third Party" directory so that we're only code reviewing the changes to stuff we care about. Just because something is in version control doesn't mean I want to diff it.

The way I would do this on the command line is:

$ git diff origin/master -- :^ThirdParty

This means exclude any and all changes under the "ThirdParty" directory when I do my diff. Effectively, this is how I want exclusions to function in pull requests too. The PR should really just be our visual diff tool on the web. The part you are functionally missing here is the ability to provide a pathspec (the part after the `--`).

Like Tom Kane likes this

Hello,
File excluding feature is awesome and we love it.
But, can I set global exclude settings for all repositories, which will merge with current repository settings while opening PR ? or internal settings may override global settings.
like *.Designer.cs or *.min.js files.

if no, are you planning to make it?

@Tom Kane Hello, do you have any information about my question?

Tom Kane Atlassian Team Aug 20, 2019

Hi Luka,

I apologize that I wasn't notified of your message sooner.

Bitbucket does not currently support Excluded files settings for more than one repository at a time. One reason we chose to use a text field for the Excluded files setting is so that it's easy to copy/paste from one repository to another.

We may consider a setting that applies to several repositories in the future but we have no definite plans.

I hope that helps.

Tom

Hello,
Thank you for reply.
I hope you will add this in global settings.

Hello guys, that's a great feature.
Is this available on the server version? If not, do you think it will be implemented soon?

Like Krzysztof Zych likes this
Bryan Turner Atlassian Team Sep 04, 2019

@Jakub Sroczyk

I'm one of the Bitbucket Server developers. Excluding files is not available in Server, and is not on our current roadmap. BSERV-9951 is a feature request for it, but it's not very active or highly requested. Since Bitbucket Server doesn't show all of its diffs on a single page, like Bitbucket Cloud does, such filtering really only impacts the change tree; users already don't have to view diffs for individual files they don't find interesting, or pay (most of) the performance cost of loading them.

If this feature is important to you, I'd encourage you to vote for the issue and to detail your use case. Use cases are important for helping PM evaluate the potential benefits of shipping an improvement.

Best regards,
Bryan Turner
Atlassian Bitbucket

Hi, how do you add tasks using the new PR UI? Is that feature not yet available?
Also, is there any way to get the old behaviour where if you delete a comment (with no children) the comment is completely removed without leaving the comment with the text "This comment has been deleted by its author"?

Hi Simon,

In the right sidebar, in the "Early Access Preview" panel, you can temporarily switch to the old UI.

2019-10-31_10-41-04.png

Or add ?spa=0 to end of a URL to get the same effect. 

Hope this helps.

I know I can switch back to the old UI, but my question is about the new UI. I also noticed there's no way to like a comment anymore, is that not coming back? 

Doesn't seem to work at all for me.
I added exclude rules after creating a PR, do I have to do it before or something?
Also the PR has 200 files (most I am trying to exclude), so I do get the "Pull request is too large to display" message - is that preventing the exclude from working? If so it makes exclude next to useless

Tom Kane Atlassian Team Apr 16, 2020

Hi @matthersh,

While there is a limit of 200 files for a PR, excluded files aren't counted against that limit.

Adding or updating rules after creating a PR should have an immediate effect when you refresh the PR view. It's a long shot but maybe try a hard refresh in case you have some local caching.

Can you confirm in your Labs settings that you've turned on the New pull request experience feature for your account? Note that turning the feature on for a team does not work.

Hope that helps!

I am not able to get this to work. I do have the new experience working (and it's great) but the excluded files are still showing in my PR's.

 

I have a single line in the exclude section for generated files

*.auto.cs

but I still see these files in the PR. Is there something I am not doing correctly?

pr.png

Tyler T Atlassian Team May 28, 2020

The files will still appear in the sidebar, but they will be collapsed by default in the diffs view. When you load a PR, are these files still expanded in the main diff view?

They are not expanded, i misunderstood the feature in that I thought they would be excluded from the sidebar too. Thanks for the quick response and clarification.

Like Tyler T likes this

You're welcome! If they were completely hidden that could potentially cause problems when pull requests are approved and merged. The idea of the future is to hide the expanded diff which helps with code review and page performance.

Cheers

You could just group those files into a collapsed tab on the sidebar and made those visible only if the user click on it.

It is counter-intuitive to call a feature EXCLUDE when you in fact, just collapse the view of those files.

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,542 views 0 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you