I want to show a list of files on a repo that were changed between any two commits. When user clicks on individual file he will sill the diff between the revision i have provided. I do not need an UI element for this , just URL is fine. I looked at
https://bitbucket.org/site/master/issues/4779/ability-to-diff-between-any-two-commits
But that link does not work in bitbucket 4.14, the enterprise version tht we have in our organization. Is there some way to do so in version 4.14 ?
Hey Victor,
It appears that you're looking for the Bitbucket Server feature request BSERV-2896. The link you posted is for Bitbucket Cloud which is a different code base. I posted a workaround there I think you might find helpful. I'll outline it below:
You can tag commits that you wish to diff and then create a pull request and selecting tags instead of branches.
If you are willing to go outside of the UI, we have REST API that you can utilize to diff arbitrary commits. Here is our documentation on that REST API end point:
https://developer.atlassian.com/static/rest/stash/3.11.3/stash-rest.html#idp257216
The command line for diffs is: "git diff A B", where it shows the changes from A to B. Our REST URL looks like
/rest/api/latest/projects/KEY/repos/slug/changes?since=A&until=B
(where A and B have the same relevance). That will list all the files that changed.
You can call /rest/api/latest/projects/KEY/repos/slug/diff/<one file>?since=A&until=B. Write the file path you want the diff for after "/diff/" and before "?since".
*Example:*
https://mybitbucket.com/rest/api/latest/projects/STASH/repos/stash/changes?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467}}
https://mybitbucket.com/rest/api/latest/projects/STASH/repos/stash/diff/dao-impl/src/main/java/com/atlassian/stash/internal/pull/HibernateRescopeRequestDao.java?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467
You will have to include a path after {{/diff}}. You can't just ask for the entire diff
So something like this will return a 400 Bad Request:
https://mybitbucket.com/rest/api/latest/projects/STASH/repos/stash/diff?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467
I realize that neither of these are great options, but hopefully these workarounds can hold you over.
@Ben Stuart, this isn't mentioned in the REST api docs you linked to, but UI assume the response is in unified diff format? If so, that doesn't add anything over what I could do with git at command line. The whole point of this is to leverage Bitbucket's rich UI.
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.
We were unable to load this page.
That's all I get in diff tab :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you send me the link?
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 get it. You can also try replacing the commit id's with the version's
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your help! I was using short (7 digit) id instead of full id and thats why it didn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oops! I should have been more clear. It's good that you figured it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems to only work when diffing 2 branches. It does not work for me if it's the same branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is so easy to get on github UI ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Go to compare and past commit id into search field:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have bitbucket v5.8 and the following works for me:
https://gitep/projects/<PROJECT>/repos/<REPO>/pull-requests/<PULL REQUEST ID>/commits/<UNTIL COMMIT HASH>?since=<SINCE COMMIT HASH>
For example:
https://gitep/projects/MyProject/repos/MyRepo/pull-requests/8865/commits/c2a5e355336666c897727f961de460f090f427b7?since=248addca4fab36483db9644f5037b261bf317634
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The point is here that the OP doesn't want to create a PR for this. We all know diff api works to view PR diffs. We also know that you can tag both commits you want to diff and the "compare" function in the UI works. This is hacky, and cumbersome for those of us that'd like to leverage and reference BB's rich UI from a build system, e.g. I'm using a jenkins job and would like a nice submodule-aware changelog and diff view, which doesn't really exist in any existing jenkins plugins. If I could just like to a bitbucket server page, problem would be solved, elegantly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This does help when trying to track what changed between commits on a PR, but it would be nice to be able to hit a URL that allowed you to simply use a commit hash to compare against. The API can do it and the UI can already do it between ranges on a PR. It really shouldn't be much more than supporting a new route and composing a new UI (or just extending the existing compare UI) based on shared code.
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.