Skip empty time values
parent
13d368e061
commit
2b7b605839
|
@ -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'];
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue