How to diff arbitrary commits using REST API

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

BSERV-2550 - Getting issue details... STATUS

There currently aren't any good ways of diffing arbitrary commits in Bitbucket Server's UI.  We have a Feature request BSERV-2550 which addresses this. It's possible to tag commits that you wish to diff and then create a pull request and selecting tags instead of branches, but REST API is also an option. The following may be useful for those who don't like the tag option and also plugin developers. 

ソリューション

Diff Two Commits

  • 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.

     

    https://MyStash.com/rest/api/latest/projects/STASH/repos/stash/changes?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467
    https://MyStash.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://MyStash.com/rest/api/latest/projects/STASH/repos/stash/diff?since=689fcf1017dc944ab976433a9ead8f2912d83622&until=a222a1f58c17f9164eb498eeaadde94675a49467

 

 

最終更新日: 2016 年 2 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.