0

I have successfully been able to "diff" two files using the stash git API, however, each time you have to specify the full hashes of the commits, like so:

rest/api/latest/projects/{project}/diff/{path to file}?since={hash}&until={hash}

What I would like to do is something like this:

rest/api/latest/projects/{project}/diff/{path to file}?since=HEAD^^&until=HEAD

To resemble:

git diff HEAD^^ HEAD {my_file} (So diff between the HEAD and previous commits on that file.)

The only way I have been able to get a list of historical commits from the API is using the following from their docs:

https://stash.atlassian.com/rest/api/1.0/projects/JIRA/repos/jira/commits

which will: "the latest commits to the jira repository in the JIRA project" but not for a specific file.

From what I have been able to find it seems as though the API does not support this functionality.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Benjamin Slabbert
  • 511
  • 2
  • 9
  • 9

1 Answers1

0

I have been able to solve this, thanks to my Firfox console. The UI makes use of a history drop down showing the last 25 commits to the file with the following URL:

rest/api/latest/projects/{project}/commits?path={path_to_fil‌​e}&until=refs%2Fhead‌​s%2Fmaster&start=0&l‌​imit=25
Benjamin Slabbert
  • 511
  • 2
  • 9
  • 9