Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getting diffs from Bitbucket Server #871

Merged
merged 5 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<!-- Your comment below this -->

- Fix structuredDiffForFile for BitBucket Server - [@osmestad]
- Fix Buddy.works isPR and use PR number instead of PR ID - [@mmiszy]

<!-- Your comment above this -->
Expand Down Expand Up @@ -1693,6 +1694,7 @@ Not usable for others, only stubs of classes etc. - [@orta]
[@nminhnguyen]: https://github.com/NMinhNguyen
[@nornagon]: https://github.com/nornagon
[@orta]: https://github.com/orta
[@osmestad]: https://github.com/osmestad
[@patrickkempff]: https://github.com/patrickkempff
[@peterjgrainger]: https://github.com/peterjgrainger
[@randak]: https://github.com/randak
Expand Down
2 changes: 1 addition & 1 deletion source/platforms/bitbucket_server/BitBucketServerAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {

getStructuredDiffForFile = async (base: string, head: string, filename: string): Promise<BitBucketServerDiff[]> => {
const { repoSlug } = this.repoMetadata
const path = `rest/api/1.0/${repoSlug}/compare/diff/${filename}?withComments=false&from=${base}&to=${head}`
const path = `rest/api/1.0/${repoSlug}/compare/diff/${filename}?withComments=false&from=${head}&to=${base}`
const res = await this.get(path)
throwIfNotOk(res)
return (await res.json()).diffs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("API testing - BitBucket Server", () => {
expect(api.fetch).toHaveBeenCalledWith(
`${host}/rest/api/1.0/projects/FOO/repos/BAR/compare/diff/` +
`filename.txt` +
`?withComments=false&from=BASE&to=HEAD`,
`?withComments=false&from=HEAD&to=BASE`,
{ method: "GET", body: null, headers: expectedJSONHeaders },
undefined
)
Expand Down