1
0
Fork 0
pull/2320/head
Jordi Boggiano 2013-10-11 20:12:02 -03:00
parent 9a806658d6
commit 11a0d16ccc
31 changed files with 62 additions and 49 deletions

View File

@ -317,6 +317,7 @@ EOF;
return array( return array(
$filesCode); $filesCode);
EOF; EOF;
} }

View File

@ -377,6 +377,7 @@ class Pool
if ($constraint === null) { if ($constraint === null) {
return self::MATCH; return self::MATCH;
} }
return $constraint->matches(new VersionConstraint('==', $candidateVersion)) ? self::MATCH : self::MATCH_NAME; return $constraint->matches(new VersionConstraint('==', $candidateVersion)) ? self::MATCH : self::MATCH_NAME;
} }

View File

@ -10,7 +10,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Downloader; namespace Composer\Downloader;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
@ -75,16 +74,17 @@ class PerforceDownloader extends VcsDownloader
public function getLocalChanges(PackageInterface $package, $path) public function getLocalChanges(PackageInterface $package, $path)
{ {
$this->io->write('Perforce driver does not check for local changes before overriding', true); $this->io->write('Perforce driver does not check for local changes before overriding', true);
return; return;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected function getCommitLogs($fromReference, $toReference, $path) protected function getCommitLogs($fromReference, $toReference, $path)
{ {
$commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference); $commitLogs = $this->perforce->getCommitLogs($fromReference, $toReference);
return $commitLogs; return $commitLogs;
} }

View File

@ -539,7 +539,6 @@ class Installer
return true; return true;
} }
/** /**
* Workaround: if your packages depend on plugins, we must be sure * Workaround: if your packages depend on plugins, we must be sure
* that those are installed / updated first; else it would lead to packages * that those are installed / updated first; else it would lead to packages

View File

@ -165,6 +165,7 @@ class LibraryInstaller implements InstallerInterface
if (strpos($initialDownloadPath, $targetDownloadPath) === 0) { if (strpos($initialDownloadPath, $targetDownloadPath) === 0) {
$this->removeCode($initial); $this->removeCode($initial);
$this->installCode($target); $this->installCode($target);
return; return;
} }

View File

@ -43,7 +43,6 @@ class PlatformRepository extends ArrayRepository
$version = $versionParser->normalize($prettyVersion); $version = $versionParser->normalize($prettyVersion);
} }
$php = new CompletePackage('php', $version, $prettyVersion); $php = new CompletePackage('php', $version, $prettyVersion);
$php->setDescription('The PHP interpreter'); $php->setDescription('The PHP interpreter');
parent::addPackage($php); parent::addPackage($php);

View File

@ -10,12 +10,10 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Repository\Vcs; namespace Composer\Repository\Vcs;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\Util\Perforce; use Composer\Util\Perforce;
/** /**
@ -145,6 +143,7 @@ class PerforceDriver extends VcsDriver
if (isset($this->composerInfo)) { if (isset($this->composerInfo)) {
$result = count($this->composerInfo) > 0; $result = count($this->composerInfo) > 0;
} }
return $result; return $result;
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* This file is part of Composer. * This file is part of Composer.
* *
@ -9,7 +10,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Util; namespace Composer\Util;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
@ -20,7 +20,6 @@ use Symfony\Component\Process\Process;
*/ */
class Perforce class Perforce
{ {
protected $path; protected $path;
protected $p4Depot; protected $p4Depot;
protected $p4Client; protected $p4Client;
@ -35,7 +34,6 @@ class Perforce
protected $uniquePerforceClientName; protected $uniquePerforceClientName;
protected $windowsFlag; protected $windowsFlag;
public static function createPerforce($repoConfig, $port, $path, ProcessExecutor $process = null) public static function createPerforce($repoConfig, $port, $path, ProcessExecutor $process = null)
{ {
if (!isset($process)) { if (!isset($process)) {
@ -44,6 +42,7 @@ class Perforce
$isWindows = defined('PHP_WINDOWS_VERSION_BUILD'); $isWindows = defined('PHP_WINDOWS_VERSION_BUILD');
$perforce = new Perforce($repoConfig, $port, $path, $process, $isWindows); $perforce = new Perforce($repoConfig, $port, $path, $process, $isWindows);
return $perforce; return $perforce;
} }
@ -161,6 +160,7 @@ class Perforce
$this->p4Stream = '//' . $this->p4Depot; $this->p4Stream = '//' . $this->p4Depot;
} }
} }
return $this->p4Stream; return $this->p4Stream;
} }
@ -268,6 +268,7 @@ class Perforce
if ($index === false) { if ($index === false) {
return false; return false;
} }
return true; return true;
} }
@ -329,7 +330,6 @@ class Perforce
fclose($spec); fclose($spec);
} }
protected function read($pipe, $name) protected function read($pipe, $name)
{ {
if (feof($pipe)) { if (feof($pipe)) {
@ -347,10 +347,10 @@ class Perforce
{ {
$command = $this->generateP4Command(' login -a'); $command = $this->generateP4Command(' login -a');
$process = new Process($command, null, null, $password); $process = new Process($command, null, null, $password);
return $process->run(); return $process->run();
} }
public function p4Login(IOInterface $io) public function p4Login(IOInterface $io)
{ {
$this->queryP4User($io); $this->queryP4User($io);
@ -369,6 +369,7 @@ class Perforce
{ {
$result = ''; $result = '';
$processExecutor->execute('p4 -p ' . $url . ' info -s', $result); $processExecutor->execute('p4 -p ' . $url . ' info -s', $result);
return false === strpos($result, 'error'); return false === strpos($result, 'error');
} }
@ -380,6 +381,7 @@ class Perforce
return $this->getComposerInformationFromPath($composerJson); return $this->getComposerInformationFromPath($composerJson);
} }
return $this->getComposerInformationFromLabel($identifier, $index); return $this->getComposerInformationFromLabel($identifier, $index);
} }
@ -496,6 +498,7 @@ class Perforce
} }
$fields = explode(' ', $changes); $fields = explode(' ', $changes);
$changeList = $fields[1]; $changeList = $fields[1];
return $changeList; return $changeList;
} }
@ -513,6 +516,7 @@ class Perforce
$main = substr($fromReference, 0, $index) . '/...'; $main = substr($fromReference, 0, $index) . '/...';
$command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList); $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
$result = $this->executeCommand($command); $result = $this->executeCommand($command);
return $result; return $result;
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* This file is part of Composer. * This file is part of Composer.
* *
@ -9,7 +10,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Test\Downloader; namespace Composer\Test\Downloader;
use Composer\Downloader\PerforceDownloader; use Composer\Downloader\PerforceDownloader;
@ -41,7 +41,6 @@ class PerforceDownloaderTest extends \PHPUnit_Framework_TestCase
$this->io = $this->getMock('Composer\IO\IOInterface'); $this->io = $this->getMock('Composer\IO\IOInterface');
} }
public function testDoDownloadGetRepoConfig() public function testDoDownloadGetRepoConfig()
{ {
$downloader = new PerforceDownloader($this->io, $this->config); $downloader = new PerforceDownloader($this->io, $this->config);

View File

@ -17,7 +17,6 @@ use Composer\Config;
use Composer\Installer\PluginInstaller; use Composer\Installer\PluginInstaller;
use Composer\Package\Loader\JsonLoader; use Composer\Package\Loader\JsonLoader;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\PackageInterface;
use Composer\Plugin\PluginManager; use Composer\Plugin\PluginManager;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
@ -166,4 +165,3 @@ class PluginInstallerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('installer-v3', $plugins[1]->version); $this->assertEquals('installer-v3', $plugins[1]->version);
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* This file is part of Composer. * This file is part of Composer.
* *
@ -11,7 +12,6 @@
namespace Composer\Test\Repository\Vcs; namespace Composer\Test\Repository\Vcs;
use Composer\Repository\Vcs\PerforceDriver; use Composer\Repository\Vcs\PerforceDriver;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Config; use Composer\Config;

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* This file is part of Composer. * This file is part of Composer.
* *
@ -9,7 +10,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Util\Perforce; use Composer\Util\Perforce;
@ -70,7 +70,6 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('//depot/branch', $stream); $this->assertEquals('//depot/branch', $stream);
} }
public function testGetStreamWithoutLabelWithStreamWithoutLabel() public function testGetStreamWithoutLabelWithStreamWithoutLabel()
{ {
$stream = $this->perforce->getStreamWithoutLabel('//depot/branch'); $stream = $this->perforce->getStreamWithoutLabel('//depot/branch');
@ -123,6 +122,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'P4USER=TEST_P4VARIABLE_USER' . PHP_EOL ; $output = 'P4USER=TEST_P4VARIABLE_USER' . PHP_EOL ;
return true; return true;
} }
) )
@ -146,6 +146,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'TEST_P4VARIABLE_USER' . PHP_EOL; $output = 'TEST_P4VARIABLE_USER' . PHP_EOL;
return true; return true;
} }
) )
@ -237,6 +238,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'P4PASSWD=TEST_P4VARIABLE_PASSWORD' . PHP_EOL; $output = 'P4PASSWD=TEST_P4VARIABLE_PASSWORD' . PHP_EOL;
return true; return true;
} }
) )
@ -260,6 +262,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'TEST_P4VARIABLE_PASSWORD' . PHP_EOL; $output = 'TEST_P4VARIABLE_PASSWORD' . PHP_EOL;
return true; return true;
} }
) )
@ -357,6 +360,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'Stream //depot/branch mainline none \'branch\'' . PHP_EOL; $output = 'Stream //depot/branch mainline none \'branch\'' . PHP_EOL;
return true; return true;
} }
) )
@ -382,6 +386,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL; $output = 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL;
return true; return true;
} }
) )
@ -404,6 +409,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL; $output = 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL;
return true; return true;
} }
) )
@ -428,6 +434,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = 'Depot depot 2013/06/25 stream /p4/1/depots/depot/... \'Created by Me\''; $output = 'Depot depot 2013/06/25 stream /p4/1/depots/depot/... \'Created by Me\'';
return true; return true;
} }
) )
@ -447,6 +454,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = PerforceTest::getComposerJson(); $output = PerforceTest::getComposerJson();
return true; return true;
} }
) )
@ -472,6 +480,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = '//depot/composer.json#1 - branch change 10001 (text)'; $output = '//depot/composer.json#1 - branch change 10001 (text)';
return true; return true;
} }
) )
@ -485,6 +494,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = PerforceTest::getComposerJson(); $output = PerforceTest::getComposerJson();
return true; return true;
} }
) )
@ -513,6 +523,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = PerforceTest::getComposerJson(); $output = PerforceTest::getComposerJson();
return true; return true;
} }
) )
@ -540,6 +551,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = '//depot/composer.json#1 - branch change 10001 (text)'; $output = '//depot/composer.json#1 - branch change 10001 (text)';
return true; return true;
} }
) )
@ -553,6 +565,7 @@ class PerforceTest extends \PHPUnit_Framework_TestCase
$this->returnCallback( $this->returnCallback(
function ($command, &$output) { function ($command, &$output) {
$output = PerforceTest::getComposerJson(); $output = PerforceTest::getComposerJson();
return true; return true;
} }
) )

View File

@ -144,7 +144,6 @@ class RemoteFilesystemTest extends \PHPUnit_Framework_TestCase
} }
} }
public function testCaptureAuthenticationParamsFromUrl() public function testCaptureAuthenticationParamsFromUrl()
{ {
$io = $this->getMock('Composer\IO\IOInterface'); $io = $this->getMock('Composer\IO\IOInterface');