1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-20 08:05:05 +01:00

Only subsplit a single tag on release

This commit is contained in:
Beau Simensen 2012-10-30 18:53:06 -07:00
parent 4d873b3d30
commit b183b24d08
2 changed files with 69 additions and 3 deletions

View File

@ -92,6 +92,7 @@
repository="${repo.dir}"
remote="${guzzle.remote}"
heads="${head}"
tags="v${new.version}"
base="src"
subIndicatorFile="composer.json"
gitPath="${cmd.git}" />

View File

@ -23,6 +23,11 @@ class GuzzleSubSplitTask extends GitBaseTask
*/
protected $heads = null;
/**
* Publish for comma-separated tags instead of all tags
*/
protected $tags = null;
/**
* Base of the tree RELATIVE TO .subsplit working dir
*/
@ -39,6 +44,16 @@ class GuzzleSubSplitTask extends GitBaseTask
*/
protected $dryRun = null;
/**
* Do not sync any heads.
*/
protected $noHeads = false;
/**
* Do not sync any tags.
*/
protected $noTags = false;
/**
* The splits we found in the heads
*/
@ -64,6 +79,16 @@ class GuzzleSubSplitTask extends GitBaseTask
return $this->heads;
}
public function setTags($str)
{
$this->tags = explode(',', $str);
}
public function getTags()
{
return $this->tags;
}
public function setBase($str)
{
$this->base = $str;
@ -93,6 +118,27 @@ class GuzzleSubSplitTask extends GitBaseTask
{
return $this->dryRun;
}
public function setNoHeads($bool)
{
$this->noHeads = (bool) $bool;
}
public function getNoHeads()
{
return $this->noHeads;
}
public function setNoTags($bool)
{
$this->noTags = (bool) $bool;
}
public function getNoTags()
{
return $this->noTags;
}
/**
* GitClient from VersionControl_Git
*/
@ -141,13 +187,32 @@ class GuzzleSubSplitTask extends GitBaseTask
$base = rtrim($base, '/') . '/';
$org = $this->getOwningTarget()->getProject()->getProperty('github.org');
$splits = array();
$heads = $this->getHeads();
foreach ($heads as $head) {
foreach ($this->splits[$head] as $component => $meta) {
$cmd = 'git subsplit publish ';
$cmd .= escapeshellarg($base . $component . ':git@github.com:'. $org.'/'.$meta['repo']) . ' --heads='.$head;
passthru($cmd);
$splits[] = $base . $component . ':git@github.com:'. $org.'/'.$meta['repo'];
}
$cmd = 'git subsplit publish ';
$cmd .= escapeshellarg(implode(' ', $splits));
if ($this->getNoHeads()) {
$cmd .= ' --no-heads';
} else {
$cmd .= ' --heads='.$head;
}
if ($this->getNoTags()) {
$cmd .= ' --no-tags';
} else {
if ($this->getTags()) {
$cmd .= ' --tags=' . escapeshellarg(implode(' ', $this->getTags()));
}
}
passthru($cmd);
}
}