1
0
Fork 0

Skip empty time values

pull/3498/head
Jordi Boggiano 2014-12-03 13:06:24 +00:00
parent 13d368e061
commit 2b7b605839
6 changed files with 6 additions and 6 deletions

View File

@ -93,7 +93,7 @@ class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
$changeset = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $changeset['timestamp'];

View File

@ -156,7 +156,7 @@ class GitDriver extends VcsDriver
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$this->process->execute(sprintf('git log -1 --format=%%at %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
$date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
$composer['time'] = $date->format('Y-m-d H:i:s');

View File

@ -171,7 +171,7 @@ class GitHubDriver extends VcsDriver
if ($composer) {
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
$commit = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $commit['commit']['committer']['date'];

View File

@ -102,7 +102,7 @@ class HgBitbucketDriver extends VcsDriver
$composer = JsonFile::parseJson($repoData['data'], $resource);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$resource = $this->getScheme() . '://bitbucket.org/api/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
$changeset = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $changeset['timestamp'];

View File

@ -124,7 +124,7 @@ class HgDriver extends VcsDriver
$composer = JsonFile::parseJson($composer, $identifier);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$this->process->execute(sprintf('hg log --template "{date|rfc3339date}" -r %s', ProcessExecutor::escape($identifier)), $output, $this->repoDir);
$date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
$composer['time'] = $date->format('Y-m-d H:i:s');

View File

@ -148,7 +148,7 @@ class SvnDriver extends VcsDriver
$composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
if (!isset($composer['time'])) {
if (empty($composer['time'])) {
$output = $this->execute('svn info', $this->baseUrl . $path . $rev);
foreach ($this->process->splitLines($output) as $line) {
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {