From 046b1184dcf50b191daa5a96ecdc351d7db791eb Mon Sep 17 00:00:00 2001 From: Stefan Grootscholten Date: Sun, 22 Jan 2017 14:58:35 +0100 Subject: [PATCH] Change getChangeDate call Use the v2.0 commit resource instead of the v1.0 changeset resource. --- src/Composer/Repository/Vcs/BitbucketDriver.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Composer/Repository/Vcs/BitbucketDriver.php b/src/Composer/Repository/Vcs/BitbucketDriver.php index 00401e253..3fbfb53fe 100644 --- a/src/Composer/Repository/Vcs/BitbucketDriver.php +++ b/src/Composer/Repository/Vcs/BitbucketDriver.php @@ -205,11 +205,15 @@ abstract class BitbucketDriver extends VcsDriver return $this->fallbackDriver->getChangeDate($identifier); } - $resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/' - . $this->owner . '/' . $this->repository . '/changesets/' . $identifier; - $changeset = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource); + $resource = sprintf( + 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date', + $this->owner, + $this->repository, + $identifier + ); + $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource); - return new \DateTime($changeset['timestamp']); + return new \DateTime($commit['date']); } /**