Display renamed/moved files in diffs (Git)

Issue #12536 resolved
Alastair Wilkes created an issue

When generating a diff, Bitbucket should attempt to detect if files were renamed instead just showing them as removed and then added with a different path.

This issue is for Git diffs; renames in Mercurial diffs is tracked in #12539.

Official response

Comments (24)

  1. Todd Lucas

    In #589 you said that this enhancement is planned for Git repos. Is there any plan on adding it for Mercurial repos as well? I am always loathe to move files because of all the noise it adds to a PR. Lately, I've been moving files on a separate branch/PR as a workaround. But this is an artificial workflow. Thanks.

  2. Alastair Wilkes reporter

    Hi @Todd Lucas, thanks for your question. Indeed, right now we're working on this feature for Git repos. I don't have an update on Mercurial at this time.

  3. Alastair Wilkes reporter

    Good news! This feature is now available as a beta. You can enable it on the "Manage features" page in Settings. Feel free to post any feedback as comments on this issue. We have a backlog of clean-up work already lined up for the next few weeks but we'll be paying attention.

  4. Benj Kamm

    Awesome! I just turned it on and this is great.

    Looks like for now, it is only recognizing renames when the file was only moved/renamed with no actual changes. If the file was moved and there were any changes to it, it is not being displayed as a rename, but still showing as a delete and add. Excited to see this progress and looking forward to the full implementation!

  5. Stephen Rosenthal

    Thank you for finally moving forward with this!

    I agree with Benjamin. It's extremely common for renames to have a few (or a lot) of changes. I browsed the past few pages of my team's pull requests and only found one "pure" rename but several "impure" renames. Usually we're renaming a Java class and also the file containing it.

    I hope the next iteration of this feature displays "impure" renames in a friendly way, rather than a full page of red for the old file and a full page of green for the new file.

  6. Alastair Wilkes reporter

    Thanks both!

    Yes - today's release includes support for 'exact' renames. We do plan to roll out 'inexact' rename support during this beta period. Stay tuned!

  7. Steve Muskiewicz

    Question on enabling this feature, we have a "team" account and I went in and enabled for our team but it appears that unless individual users also go in an enable on their user profile, it doesn't seem to work. This doesn't seem to be true for other features (turning it on for the team turns on for everyone on the team). Am I wrong to expect this is how it should work?

  8. Alastair Wilkes reporter

    Thanks for your question, @Steve Muskiewicz!

    My apologies, my original post was unclear. This specific beta feature must be enabled by each user. We know that's an inconvenience for larger teams, so we're pushing to get this out as an on-for-everyone feature soon. Thanks for trying it out!

  9. DeWe
    Yes - today's release includes support for 'exact' renames. We do plan to roll out 'inexact' rename support during this beta period. Stay tuned!

    @aldango, any estimate on this? As the previous speaker already mentioned having 'inexact' rename support is crucial.

  10. Alastair Wilkes reporter

    Good news - inexact rename support has been enabled for users who have opted into this feature.

    We are working through a couple of UI bugs, mostly around the side-by-side diff view and comment drifting. If you see any other issues, give us a buzz on this ticket!

  11. Alastair Wilkes reporter

    We had to divert our attention from this for a little while, but I’m pleased to announce that we’ll be rolling this out across all users soon.

    In preparation for rollout, tomorrow we will switch this opt-in feature to apply to diffs on repos owned by the account that opted in (previously, it applied to any diff that the opted-in user viewed). Starting tomorrow, when the feature is enabled for an account, it will apply to all the account's repos, regardless of whether the viewer has opted in. To ease this transition for those already using the feature, we’re going to automatically opt-in 1) teams that have admins who have opted-in and 2) teams where more than 50% of members have opted-in.

    If your team does not meet these criteria but you’d like to opt-in your team, follow these steps:

    1. Navigate to your team’s page (bitbucket.org/{team_name})
    2. Click on "Manage team"
    3. Click on "Manage features” in the left column
    4. Enable "Show renamed/moved files in diffs"

    Otherwise, sit tight - we’ll be enabling it for everyone soon!

  12. Igor Baidiuk

    Why can't this be enabled on per-account basis? To me it looks to be change in user's view on diff rather than how diffs are processed. Very frustrating that I cannot simply see how this works and must somehow ask my team to opt-in. So we're still in the world of 1km diffs.

  13. Mike Deneault

    I'm listed as an administrator for our company's Bitbucket account, but when I click on "Manage Team" there is no menu item for "Manage features" in the left menu (or anywhere else). Has this been moved, or pushed out to all users?

  14. Zachary Davis Account Deactivated

    "Manage features" has been renamed to "Labs" since Alastair's comment, so you should be able to follow his instructions with that change:

    1. Navigate to your team’s page (bitbucket.org/{team_name})
    2. Click on "Manage team"
    3. Click on "Labs” in the left column
    4. Enable "Show renamed/moved files in diffs"
  15. Log in to comment