HgDriver does not identify bitbucket mercurial repos correctly
parent
902a5c32db
commit
44634a689d
|
@ -195,7 +195,7 @@ class HgDriver extends VcsDriver
|
||||||
*/
|
*/
|
||||||
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
|
||||||
{
|
{
|
||||||
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Test\Repository\Vcs;
|
||||||
|
|
||||||
|
use Composer\Repository\Vcs\HgDriver;
|
||||||
|
use Composer\TestCase;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
use Composer\Config;
|
||||||
|
|
||||||
|
class HgDriverTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @type \Composer\IO\IOInterface|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
private $io;
|
||||||
|
/** @type \Composer\Config */
|
||||||
|
private $config;
|
||||||
|
/** @type string */
|
||||||
|
private $home;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->io = $this->getMock('Composer\IO\IOInterface');
|
||||||
|
$this->home = $this->getUniqueTmpDirectory();
|
||||||
|
$this->config = new Config();
|
||||||
|
$this->config->merge(array(
|
||||||
|
'config' => array(
|
||||||
|
'home' => $this->home,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
$fs = new Filesystem;
|
||||||
|
$fs->removeDirectory($this->home);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupports()
|
||||||
|
{
|
||||||
|
$this->assertTrue(
|
||||||
|
HgDriver::supports($this->io, $this->config, 'ssh://bitbucket.org/user/repo')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertTrue(
|
||||||
|
HgDriver::supports($this->io, $this->config, 'ssh://hg@bitbucket.org/user/repo')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertTrue(
|
||||||
|
HgDriver::supports($this->io, $this->config, 'ssh://user@bitbucket.org/user/repo')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue