repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
matteosister/GitElephant | src/GitElephant/Objects/Tag.php | Tag.createFromOutputLines | public static function createFromOutputLines(Repository $repository, array $outputLines, string $name)
{
$tag = new self($repository, $name);
$tag->parseOutputLines($outputLines);
return $tag;
} | php | public static function createFromOutputLines(Repository $repository, array $outputLines, string $name)
{
$tag = new self($repository, $name);
$tag->parseOutputLines($outputLines);
return $tag;
} | [
"public",
"static",
"function",
"createFromOutputLines",
"(",
"Repository",
"$",
"repository",
",",
"array",
"$",
"outputLines",
",",
"string",
"$",
"name",
")",
"{",
"$",
"tag",
"=",
"new",
"self",
"(",
"$",
"repository",
",",
"$",
"name",
")",
";",
"$"... | static generator to generate a single commit from output of command.show service
@param \GitElephant\Repository $repository repository
@param array $outputLines output lines
@param string $name name
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Tag | [
"static",
"generator",
"to",
"generate",
"a",
"single",
"commit",
"from",
"output",
"of",
"command",
".",
"show",
"service"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tag.php#L91-L97 |
matteosister/GitElephant | src/GitElephant/Objects/Tag.php | Tag.delete | public function delete()
{
$this->repository
->getCaller()
->execute(TagCommand::getInstance($this->getRepository())->delete($this));
} | php | public function delete()
{
$this->repository
->getCaller()
->execute(TagCommand::getInstance($this->getRepository())->delete($this));
} | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"getCaller",
"(",
")",
"->",
"execute",
"(",
"TagCommand",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
")",
"->",
"delete",
"(",
"$",
"thi... | deletes the tag | [
"deletes",
"the",
"tag"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tag.php#L133-L138 |
matteosister/GitElephant | src/GitElephant/Objects/Tag.php | Tag.createFromCommand | private function createFromCommand()
{
$command = TagCommand::getInstance($this->getRepository())->listTags();
$outputLines = $this->getCaller()->execute($command, true, $this->getRepository()->getPath())->getOutputLines();
$this->parseOutputLines($outputLines);
} | php | private function createFromCommand()
{
$command = TagCommand::getInstance($this->getRepository())->listTags();
$outputLines = $this->getCaller()->execute($command, true, $this->getRepository()->getPath())->getOutputLines();
$this->parseOutputLines($outputLines);
} | [
"private",
"function",
"createFromCommand",
"(",
")",
"{",
"$",
"command",
"=",
"TagCommand",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
")",
"->",
"listTags",
"(",
")",
";",
"$",
"outputLines",
"=",
"$",
"this",
"->",
"getCa... | get the commit properties from command
@see ShowCommand::commitInfo | [
"get",
"the",
"commit",
"properties",
"from",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tag.php#L145-L150 |
matteosister/GitElephant | src/GitElephant/Objects/Tag.php | Tag.parseOutputLines | private function parseOutputLines(array $outputLines)
{
$found = false;
foreach ($outputLines as $tagString) {
if ($tagString != '' and $this->name === trim($tagString)) {
$lines = $this->getCaller()
->execute(RevListCommand::getInstance($this->getRepository())->getTagCommit($this))
->getOutputLines();
$this->setSha($lines[0]);
$found = true;
break;
}
}
if (!$found) {
throw new \InvalidArgumentException(sprintf('the tag %s doesn\'t exists', $this->name));
}
} | php | private function parseOutputLines(array $outputLines)
{
$found = false;
foreach ($outputLines as $tagString) {
if ($tagString != '' and $this->name === trim($tagString)) {
$lines = $this->getCaller()
->execute(RevListCommand::getInstance($this->getRepository())->getTagCommit($this))
->getOutputLines();
$this->setSha($lines[0]);
$found = true;
break;
}
}
if (!$found) {
throw new \InvalidArgumentException(sprintf('the tag %s doesn\'t exists', $this->name));
}
} | [
"private",
"function",
"parseOutputLines",
"(",
"array",
"$",
"outputLines",
")",
"{",
"$",
"found",
"=",
"false",
";",
"foreach",
"(",
"$",
"outputLines",
"as",
"$",
"tagString",
")",
"{",
"if",
"(",
"$",
"tagString",
"!=",
"''",
"and",
"$",
"this",
"... | parse the output of a git command showing a commit
@param array $outputLines output lines
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return void | [
"parse",
"the",
"output",
"of",
"a",
"git",
"command",
"showing",
"a",
"commit"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tag.php#L164-L181 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.clearAll | public function clearAll()
{
$this->commandName = null;
$this->configs = array();
$this->commandArguments = array();
$this->commandSubject = null;
$this->commandSubject2 = null;
$this->path = null;
$this->binaryVersion = null;
} | php | public function clearAll()
{
$this->commandName = null;
$this->configs = array();
$this->commandArguments = array();
$this->commandSubject = null;
$this->commandSubject2 = null;
$this->path = null;
$this->binaryVersion = null;
} | [
"public",
"function",
"clearAll",
"(",
")",
"{",
"$",
"this",
"->",
"commandName",
"=",
"null",
";",
"$",
"this",
"->",
"configs",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"commandArguments",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"... | Clear all previous variables | [
"Clear",
"all",
"previous",
"variables"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L134-L143 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.addConfigs | public function addConfigs($configs)
{
foreach ($configs as $config => $value) {
$this->configs[$config] = $value;
}
} | php | public function addConfigs($configs)
{
foreach ($configs as $config => $value) {
$this->configs[$config] = $value;
}
} | [
"public",
"function",
"addConfigs",
"(",
"$",
"configs",
")",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"configs",
"[",
"$",
"config",
"]",
"=",
"$",
"value",
";",
"}",
"}"
] | Set Configs
@param array|Map $configs the config variable. i.e. { "color.status" => "false", "color.diff" => "true" } | [
"Set",
"Configs"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L175-L180 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.addGlobalConfigs | protected function addGlobalConfigs($configs)
{
if (!empty($configs)) {
foreach ($configs as $config => $value) {
$this->globalConfigs[$config] = $value;
}
}
} | php | protected function addGlobalConfigs($configs)
{
if (!empty($configs)) {
foreach ($configs as $config => $value) {
$this->globalConfigs[$config] = $value;
}
}
} | [
"protected",
"function",
"addGlobalConfigs",
"(",
"$",
"configs",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"configs",
")",
")",
"{",
"foreach",
"(",
"$",
"configs",
"as",
"$",
"config",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"globalConf... | Set global configs
@param array|Map $configs the config variable. i.e. { "color.status" => "false", "color.diff" => "true" } | [
"Set",
"global",
"configs"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L187-L194 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.addGlobalOptions | protected function addGlobalOptions($options)
{
if (!empty($options)) {
foreach ($options as $name => $value) {
$this->globalOptions[$name] = $value;
}
}
} | php | protected function addGlobalOptions($options)
{
if (!empty($options)) {
foreach ($options as $name => $value) {
$this->globalOptions[$name] = $value;
}
}
} | [
"protected",
"function",
"addGlobalOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
")",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"globalOption... | Set global option
@param array|Map $options a global option | [
"Set",
"global",
"option"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L201-L208 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.normalizeOptions | public function normalizeOptions(array $options = array(), array $switchOptions = array(), $valueOptions = array())
{
$normalizedOptions = array();
foreach ($options as $option) {
if (array_key_exists($option, $switchOptions)) {
$normalizedOptions[$switchOptions[$option]] = $switchOptions[$option];
} else {
$parts = preg_split('/([\s=])+/', $option, 2, PREG_SPLIT_DELIM_CAPTURE);
if (count($parts)) {
$optionName = $parts[0];
if (in_array($optionName, $valueOptions)) {
$value = ($parts[1] == '=') ? $option : array($parts[0], $parts[2]);
$normalizedOptions[$optionName] = $value;
}
}
}
}
return $normalizedOptions;
} | php | public function normalizeOptions(array $options = array(), array $switchOptions = array(), $valueOptions = array())
{
$normalizedOptions = array();
foreach ($options as $option) {
if (array_key_exists($option, $switchOptions)) {
$normalizedOptions[$switchOptions[$option]] = $switchOptions[$option];
} else {
$parts = preg_split('/([\s=])+/', $option, 2, PREG_SPLIT_DELIM_CAPTURE);
if (count($parts)) {
$optionName = $parts[0];
if (in_array($optionName, $valueOptions)) {
$value = ($parts[1] == '=') ? $option : array($parts[0], $parts[2]);
$normalizedOptions[$optionName] = $value;
}
}
}
}
return $normalizedOptions;
} | [
"public",
"function",
"normalizeOptions",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
",",
"array",
"$",
"switchOptions",
"=",
"array",
"(",
")",
",",
"$",
"valueOptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"normalizedOptions",
"=",
"array"... | Normalize any valid option to its long name
an provide a structure that can be more intelligently
handled by other routines
@param array $options command options
@param array $switchOptions list of valid options that are switch like
@param array $valueOptions list of valid options that must have a value assignment
@return array Associative array of valid, normalized command options | [
"Normalize",
"any",
"valid",
"option",
"to",
"its",
"long",
"name",
"an",
"provide",
"a",
"structure",
"that",
"can",
"be",
"more",
"intelligently",
"handled",
"by",
"other",
"routines"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L293-L313 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCommand | public function getCommand()
{
if (is_null($this->commandName)) {
throw new \RuntimeException("You should pass a commandName to execute a command");
}
$command = '';
$command .= $this->getCLIConfigs();
$command .= $this->getCLIGlobalOptions();
$command .= $this->getCLICommandName();
$command .= $this->getCLICommandArguments();
$command .= $this->getCLISubjects();
$command .= $this->getCLIPath();
$command = preg_replace('/\\s{2,}/', ' ', $command);
return trim($command);
} | php | public function getCommand()
{
if (is_null($this->commandName)) {
throw new \RuntimeException("You should pass a commandName to execute a command");
}
$command = '';
$command .= $this->getCLIConfigs();
$command .= $this->getCLIGlobalOptions();
$command .= $this->getCLICommandName();
$command .= $this->getCLICommandArguments();
$command .= $this->getCLISubjects();
$command .= $this->getCLIPath();
$command = preg_replace('/\\s{2,}/', ' ', $command);
return trim($command);
} | [
"public",
"function",
"getCommand",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"commandName",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"You should pass a commandName to execute a command\"",
")",
";",
"}",
"$",
"command",... | Get the current command
@return string
@throws \RuntimeException | [
"Get",
"the",
"current",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L321-L338 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCLICommandArguments | private function getCLICommandArguments()
{
$command = '';
$combinedArguments = array_merge($this->globalCommandArguments, $this->commandArguments);
if (count($combinedArguments) > 0) {
$command .= ' ' . implode(' ', array_map('escapeshellarg', $combinedArguments));
}
return $command;
} | php | private function getCLICommandArguments()
{
$command = '';
$combinedArguments = array_merge($this->globalCommandArguments, $this->commandArguments);
if (count($combinedArguments) > 0) {
$command .= ' ' . implode(' ', array_map('escapeshellarg', $combinedArguments));
}
return $command;
} | [
"private",
"function",
"getCLICommandArguments",
"(",
")",
"{",
"$",
"command",
"=",
"''",
";",
"$",
"combinedArguments",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"globalCommandArguments",
",",
"$",
"this",
"->",
"commandArguments",
")",
";",
"if",
"(",
"... | get a string of CLI-formatted command arguments
@return string The command argument string | [
"get",
"a",
"string",
"of",
"CLI",
"-",
"formatted",
"command",
"arguments"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L345-L353 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCLIConfigs | private function getCLIConfigs()
{
$command = '';
$combinedConfigs = array_merge($this->globalConfigs, $this->configs);
if (count($combinedConfigs)) {
foreach ($combinedConfigs as $config => $value) {
$command .= sprintf(
' %s %s=%s',
escapeshellarg('-c'),
escapeshellarg($config),
escapeshellarg($value)
);
}
}
return $command;
} | php | private function getCLIConfigs()
{
$command = '';
$combinedConfigs = array_merge($this->globalConfigs, $this->configs);
if (count($combinedConfigs)) {
foreach ($combinedConfigs as $config => $value) {
$command .= sprintf(
' %s %s=%s',
escapeshellarg('-c'),
escapeshellarg($config),
escapeshellarg($value)
);
}
}
return $command;
} | [
"private",
"function",
"getCLIConfigs",
"(",
")",
"{",
"$",
"command",
"=",
"''",
";",
"$",
"combinedConfigs",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"globalConfigs",
",",
"$",
"this",
"->",
"configs",
")",
";",
"if",
"(",
"count",
"(",
"$",
"comb... | get a string of CLI-formatted configs
@return string The config string | [
"get",
"a",
"string",
"of",
"CLI",
"-",
"formatted",
"configs"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L370-L385 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCLIGlobalOptions | private function getCLIGlobalOptions()
{
$command = '';
if (count($this->globalOptions) > 0) {
foreach ($this->globalOptions as $name => $value) {
$command .= sprintf(' %s=%s', escapeshellarg($name), escapeshellarg($value));
}
}
return $command;
} | php | private function getCLIGlobalOptions()
{
$command = '';
if (count($this->globalOptions) > 0) {
foreach ($this->globalOptions as $name => $value) {
$command .= sprintf(' %s=%s', escapeshellarg($name), escapeshellarg($value));
}
}
return $command;
} | [
"private",
"function",
"getCLIGlobalOptions",
"(",
")",
"{",
"$",
"command",
"=",
"''",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"globalOptions",
")",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"globalOptions",
"as",
"$",
"name",
... | get a string of CLI-formatted global options
@return string The global options string | [
"get",
"a",
"string",
"of",
"CLI",
"-",
"formatted",
"global",
"options"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L392-L401 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCLIPath | private function getCLIPath()
{
$command = '';
if (!is_null($this->path)) {
$command .= sprintf(' -- %s', escapeshellarg($this->path));
}
return $command;
} | php | private function getCLIPath()
{
$command = '';
if (!is_null($this->path)) {
$command .= sprintf(' -- %s', escapeshellarg($this->path));
}
return $command;
} | [
"private",
"function",
"getCLIPath",
"(",
")",
"{",
"$",
"command",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"path",
")",
")",
"{",
"$",
"command",
".=",
"sprintf",
"(",
"' -- %s'",
",",
"escapeshellarg",
"(",
"$",
"this",
... | get a string of CLI-formatted path
@return string The path string | [
"get",
"a",
"string",
"of",
"CLI",
"-",
"formatted",
"path"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L408-L415 |
matteosister/GitElephant | src/GitElephant/Command/BaseCommand.php | BaseCommand.getCLISubjects | private function getCLISubjects()
{
$command = '';
if (!is_null($this->commandSubject)) {
$command .= ' ';
if ($this->commandSubject instanceof SubCommandCommand) {
$command .= $this->commandSubject->getCommand();
} else {
if (is_array($this->commandSubject)) {
$command .= implode(' ', array_map('escapeshellarg', $this->commandSubject));
} else {
$command .= escapeshellarg($this->commandSubject);
}
}
}
if (!is_null($this->commandSubject2)) {
$command .= ' ';
if ($this->commandSubject2 instanceof SubCommandCommand) {
$command .= $this->commandSubject2->getCommand();
} else {
if (is_array($this->commandSubject2)) {
$command .= implode(' ', array_map('escapeshellarg', $this->commandSubject2));
} else {
$command .= escapeshellarg($this->commandSubject2);
}
}
}
return $command;
} | php | private function getCLISubjects()
{
$command = '';
if (!is_null($this->commandSubject)) {
$command .= ' ';
if ($this->commandSubject instanceof SubCommandCommand) {
$command .= $this->commandSubject->getCommand();
} else {
if (is_array($this->commandSubject)) {
$command .= implode(' ', array_map('escapeshellarg', $this->commandSubject));
} else {
$command .= escapeshellarg($this->commandSubject);
}
}
}
if (!is_null($this->commandSubject2)) {
$command .= ' ';
if ($this->commandSubject2 instanceof SubCommandCommand) {
$command .= $this->commandSubject2->getCommand();
} else {
if (is_array($this->commandSubject2)) {
$command .= implode(' ', array_map('escapeshellarg', $this->commandSubject2));
} else {
$command .= escapeshellarg($this->commandSubject2);
}
}
}
return $command;
} | [
"private",
"function",
"getCLISubjects",
"(",
")",
"{",
"$",
"command",
"=",
"''",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"commandSubject",
")",
")",
"{",
"$",
"command",
".=",
"' '",
";",
"if",
"(",
"$",
"this",
"->",
"commandSubjec... | get a string of CLI-formatted subjects
@throws \RuntimeException
@return string The subjects string | [
"get",
"a",
"string",
"of",
"CLI",
"-",
"formatted",
"subjects"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BaseCommand.php#L423-L451 |
matteosister/GitElephant | src/GitElephant/Command/RevListCommand.php | RevListCommand.getTagCommit | public function getTagCommit(Tag $tag)
{
$this->clearAll();
$this->addCommandName(static::GIT_REVLIST);
// only the last commit
$this->addCommandArgument('-n1');
$this->addCommandSubject($tag->getFullRef());
return $this->getCommand();
} | php | public function getTagCommit(Tag $tag)
{
$this->clearAll();
$this->addCommandName(static::GIT_REVLIST);
// only the last commit
$this->addCommandArgument('-n1');
$this->addCommandSubject($tag->getFullRef());
return $this->getCommand();
} | [
"public",
"function",
"getTagCommit",
"(",
"Tag",
"$",
"tag",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"(",
"static",
"::",
"GIT_REVLIST",
")",
";",
"// only the last commit",
"$",
"this",
"->",
"addComma... | get tag commit command via rev-list
@param \GitElephant\Objects\Tag $tag a tag instance
@throws \RuntimeException
@return string | [
"get",
"tag",
"commit",
"command",
"via",
"rev",
"-",
"list"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/RevListCommand.php#L54-L63 |
matteosister/GitElephant | src/GitElephant/Command/RevListCommand.php | RevListCommand.commitPath | public function commitPath(Commit $commit, $max = 1000)
{
$this->clearAll();
$this->addCommandName(static::GIT_REVLIST);
$this->addCommandArgument(sprintf('--max-count=%s', $max));
$this->addCommandSubject($commit->getSha());
return $this->getCommand();
} | php | public function commitPath(Commit $commit, $max = 1000)
{
$this->clearAll();
$this->addCommandName(static::GIT_REVLIST);
$this->addCommandArgument(sprintf('--max-count=%s', $max));
$this->addCommandSubject($commit->getSha());
return $this->getCommand();
} | [
"public",
"function",
"commitPath",
"(",
"Commit",
"$",
"commit",
",",
"$",
"max",
"=",
"1000",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"(",
"static",
"::",
"GIT_REVLIST",
")",
";",
"$",
"this",
"-... | get the commits path to the passed commit. Useful to count commits in a repo
@param \GitElephant\Objects\Commit $commit commit instance
@param int $max max count
@throws \RuntimeException
@return string | [
"get",
"the",
"commits",
"path",
"to",
"the",
"passed",
"commit",
".",
"Useful",
"to",
"count",
"commits",
"in",
"a",
"repo"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/RevListCommand.php#L74-L82 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.createFromOutputLines | public static function createFromOutputLines(Repository $repository, array $outputLines)
{
$tree = new self($repository);
$tree->parseOutputLines($outputLines);
return $tree;
} | php | public static function createFromOutputLines(Repository $repository, array $outputLines)
{
$tree = new self($repository);
$tree->parseOutputLines($outputLines);
return $tree;
} | [
"public",
"static",
"function",
"createFromOutputLines",
"(",
"Repository",
"$",
"repository",
",",
"array",
"$",
"outputLines",
")",
"{",
"$",
"tree",
"=",
"new",
"self",
"(",
"$",
"repository",
")",
";",
"$",
"tree",
"->",
"parseOutputLines",
"(",
"$",
"... | static method to generate standalone log
@param \GitElephant\Repository $repository repo
@param array $outputLines output lines from command.log
@return \GitElephant\Objects\Tree | [
"static",
"method",
"to",
"generate",
"standalone",
"log"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L84-L90 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.createFromCommand | private function createFromCommand()
{
$command = LsTreeCommand::getInstance($this->getRepository())->tree($this->ref, $this->subject);
$outputLines = $this->getCaller()->execute($command)->getOutputLines(true);
$this->parseOutputLines($outputLines);
} | php | private function createFromCommand()
{
$command = LsTreeCommand::getInstance($this->getRepository())->tree($this->ref, $this->subject);
$outputLines = $this->getCaller()->execute($command)->getOutputLines(true);
$this->parseOutputLines($outputLines);
} | [
"private",
"function",
"createFromCommand",
"(",
")",
"{",
"$",
"command",
"=",
"LsTreeCommand",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
")",
"->",
"tree",
"(",
"$",
"this",
"->",
"ref",
",",
"$",
"this",
"->",
"subject",
... | get the commit properties from command
@see LsTreeCommand::tree | [
"get",
"the",
"commit",
"properties",
"from",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L97-L102 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.parseOutputLines | private function parseOutputLines(array $outputLines)
{
foreach ($outputLines as $line) {
$this->parseLine($line);
}
usort($this->children, [$this, 'sortChildren']);
$this->scanPathsForBlob($outputLines);
} | php | private function parseOutputLines(array $outputLines)
{
foreach ($outputLines as $line) {
$this->parseLine($line);
}
usort($this->children, [$this, 'sortChildren']);
$this->scanPathsForBlob($outputLines);
} | [
"private",
"function",
"parseOutputLines",
"(",
"array",
"$",
"outputLines",
")",
"{",
"foreach",
"(",
"$",
"outputLines",
"as",
"$",
"line",
")",
"{",
"$",
"this",
"->",
"parseLine",
"(",
"$",
"line",
")",
";",
"}",
"usort",
"(",
"$",
"this",
"->",
... | parse the output of a git command showing a ls-tree
@param array $outputLines output lines | [
"parse",
"the",
"output",
"of",
"a",
"git",
"command",
"showing",
"a",
"ls",
"-",
"tree"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L132-L139 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.getParent | public function getParent()
{
if ($this->isRoot()) {
return null;
}
return substr($this->subject->getFullPath(), 0, strrpos($this->subject->getFullPath(), '/'));
} | php | public function getParent()
{
if ($this->isRoot()) {
return null;
}
return substr($this->subject->getFullPath(), 0, strrpos($this->subject->getFullPath(), '/'));
} | [
"public",
"function",
"getParent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"substr",
"(",
"$",
"this",
"->",
"subject",
"->",
"getFullPath",
"(",
")",
",",
"0",
",",
"strrpos"... | get the current tree parent, null if root
@return null|string | [
"get",
"the",
"current",
"tree",
"parent",
"null",
"if",
"root"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L154-L161 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.getBinaryData | public function getBinaryData()
{
$cmd = CatFileCommand::getInstance($this->getRepository())->content($this->getSubject(), $this->ref);
return $this->getCaller()->execute($cmd)->getRawOutput();
} | php | public function getBinaryData()
{
$cmd = CatFileCommand::getInstance($this->getRepository())->content($this->getSubject(), $this->ref);
return $this->getCaller()->execute($cmd)->getRawOutput();
} | [
"public",
"function",
"getBinaryData",
"(",
")",
"{",
"$",
"cmd",
"=",
"CatFileCommand",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"getRepository",
"(",
")",
")",
"->",
"content",
"(",
"$",
"this",
"->",
"getSubject",
"(",
")",
",",
"$",
"this",
"->... | get binary data
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return string | [
"get",
"binary",
"data"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L202-L207 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.getBreadcrumb | public function getBreadcrumb()
{
$bc = [];
if (!$this->isRoot()) {
$arrayNames = explode('/', $this->subject->getFullPath());
$pathString = '';
foreach ($arrayNames as $i => $name) {
if ($this->isBlob() and $name === $this->blob->getName()) {
$bc[$i]['path'] = $pathString . $name;
$bc[$i]['label'] = $this->blob;
$pathString .= $name . '/';
} else {
$bc[$i]['path'] = $pathString . $name;
$bc[$i]['label'] = $name;
$pathString .= $name . '/';
}
}
}
return $bc;
} | php | public function getBreadcrumb()
{
$bc = [];
if (!$this->isRoot()) {
$arrayNames = explode('/', $this->subject->getFullPath());
$pathString = '';
foreach ($arrayNames as $i => $name) {
if ($this->isBlob() and $name === $this->blob->getName()) {
$bc[$i]['path'] = $pathString . $name;
$bc[$i]['label'] = $this->blob;
$pathString .= $name . '/';
} else {
$bc[$i]['path'] = $pathString . $name;
$bc[$i]['label'] = $name;
$pathString .= $name . '/';
}
}
}
return $bc;
} | [
"public",
"function",
"getBreadcrumb",
"(",
")",
"{",
"$",
"bc",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"$",
"arrayNames",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"subject",
"->",
"getFull... | Return an array like this
0 => array(
'path' => the path to the current element
'label' => the name of the current element
),
1 => array(),
...
@return array | [
"Return",
"an",
"array",
"like",
"this",
"0",
"=",
">",
"array",
"(",
"path",
"=",
">",
"the",
"path",
"to",
"the",
"current",
"element",
"label",
"=",
">",
"the",
"name",
"of",
"the",
"current",
"element",
")",
"1",
"=",
">",
"array",
"()",
"..."
... | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L220-L240 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.scanPathsForBlob | private function scanPathsForBlob(array $outputLines)
{
// no children, empty folder or blob!
if (count($this->children) > 0) {
return;
}
// root, no blob
if ($this->isRoot()) {
return;
}
if (1 === count($outputLines)) {
$treeObject = NodeObject::createFromOutputLine($this->repository, $outputLines[0]);
if ($treeObject->getSha() === $this->subject->getSha()) {
$this->blob = $treeObject;
}
}
} | php | private function scanPathsForBlob(array $outputLines)
{
// no children, empty folder or blob!
if (count($this->children) > 0) {
return;
}
// root, no blob
if ($this->isRoot()) {
return;
}
if (1 === count($outputLines)) {
$treeObject = NodeObject::createFromOutputLine($this->repository, $outputLines[0]);
if ($treeObject->getSha() === $this->subject->getSha()) {
$this->blob = $treeObject;
}
}
} | [
"private",
"function",
"scanPathsForBlob",
"(",
"array",
"$",
"outputLines",
")",
"{",
"// no children, empty folder or blob!",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"children",
")",
">",
"0",
")",
"{",
"return",
";",
"}",
"// root, no blob",
"if",
"(",
... | check if the path is equals to a fullPath
to tell if it's a blob
@param array $outputLines output lines
@return mixed | [
"check",
"if",
"the",
"path",
"is",
"equals",
"to",
"a",
"fullPath",
"to",
"tell",
"if",
"it",
"s",
"a",
"blob"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L250-L268 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.sortChildren | private function sortChildren(NodeObject $a, NodeObject $b)
{
if ($a->getType() == $b->getType()) {
$names = [$a->getName(), $b->getName()];
sort($names);
return ($a->getName() === $names[0]) ? -1 : 1;
}
return $a->getType() == NodeObject::TYPE_TREE || $b->getType() == NodeObject::TYPE_BLOB ? -1 : 1;
} | php | private function sortChildren(NodeObject $a, NodeObject $b)
{
if ($a->getType() == $b->getType()) {
$names = [$a->getName(), $b->getName()];
sort($names);
return ($a->getName() === $names[0]) ? -1 : 1;
}
return $a->getType() == NodeObject::TYPE_TREE || $b->getType() == NodeObject::TYPE_BLOB ? -1 : 1;
} | [
"private",
"function",
"sortChildren",
"(",
"NodeObject",
"$",
"a",
",",
"NodeObject",
"$",
"b",
")",
"{",
"if",
"(",
"$",
"a",
"->",
"getType",
"(",
")",
"==",
"$",
"b",
"->",
"getType",
"(",
")",
")",
"{",
"$",
"names",
"=",
"[",
"$",
"a",
"-... | Reorder children of the tree
Tree first (alphabetically) and then blobs (alphabetically)
@param \GitElephant\Objects\NodeObject $a the first object
@param \GitElephant\Objects\NodeObject $b the second object
@return int | [
"Reorder",
"children",
"of",
"the",
"tree",
"Tree",
"first",
"(",
"alphabetically",
")",
"and",
"then",
"blobs",
"(",
"alphabetically",
")"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L279-L289 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.parseLine | private function parseLine($line)
{
if ($line == '') {
return;
}
$slices = NodeObject::getLineSlices($line);
if ($this->isBlob()) {
$this->pathChildren[] = $this->blob->getName();
} else {
if ($this->isRoot()) {
// if is root check for first children
$pattern = '/(\w+)\/(.*)/';
$replacement = '$1';
} else {
// filter by the children of the path
$actualPath = $this->subject->getFullPath();
if (!preg_match(sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/')), $slices['fullPath'])) {
return;
}
$pattern = sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/'));
$replacement = '$1';
}
$name = preg_replace($pattern, $replacement, $slices['fullPath']);
if (strpos($name, '/') !== false) {
return;
}
if (!in_array($name, $this->pathChildren)) {
$path = rtrim(rtrim($slices['fullPath'], $name), '/');
$treeObject = new TreeObject(
$this->repository,
$slices['permissions'],
$slices['type'],
$slices['sha'],
$slices['size'],
$name,
$path
);
$this->children[] = $treeObject;
$this->pathChildren[] = $name;
}
}
} | php | private function parseLine($line)
{
if ($line == '') {
return;
}
$slices = NodeObject::getLineSlices($line);
if ($this->isBlob()) {
$this->pathChildren[] = $this->blob->getName();
} else {
if ($this->isRoot()) {
// if is root check for first children
$pattern = '/(\w+)\/(.*)/';
$replacement = '$1';
} else {
// filter by the children of the path
$actualPath = $this->subject->getFullPath();
if (!preg_match(sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/')), $slices['fullPath'])) {
return;
}
$pattern = sprintf('/^%s\/(\w*)/', preg_quote($actualPath, '/'));
$replacement = '$1';
}
$name = preg_replace($pattern, $replacement, $slices['fullPath']);
if (strpos($name, '/') !== false) {
return;
}
if (!in_array($name, $this->pathChildren)) {
$path = rtrim(rtrim($slices['fullPath'], $name), '/');
$treeObject = new TreeObject(
$this->repository,
$slices['permissions'],
$slices['type'],
$slices['sha'],
$slices['size'],
$name,
$path
);
$this->children[] = $treeObject;
$this->pathChildren[] = $name;
}
}
} | [
"private",
"function",
"parseLine",
"(",
"$",
"line",
")",
"{",
"if",
"(",
"$",
"line",
"==",
"''",
")",
"{",
"return",
";",
"}",
"$",
"slices",
"=",
"NodeObject",
"::",
"getLineSlices",
"(",
"$",
"line",
")",
";",
"if",
"(",
"$",
"this",
"->",
"... | Parse a single line into pieces
@param string $line a single line output from the git binary
@return mixed | [
"Parse",
"a",
"single",
"line",
"into",
"pieces"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L298-L342 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.getLastCommit | public function getLastCommit($ref = 'master')
{
if ($this->isRoot()) {
return $this->getRepository()->getCommit($ref);
}
$log = $this->repository->getObjectLog($this->getObject(), $ref);
return $log[0];
} | php | public function getLastCommit($ref = 'master')
{
if ($this->isRoot()) {
return $this->getRepository()->getCommit($ref);
}
$log = $this->repository->getObjectLog($this->getObject(), $ref);
return $log[0];
} | [
"public",
"function",
"getLastCommit",
"(",
"$",
"ref",
"=",
"'master'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRoot",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"getCommit",
"(",
"$",
"ref",
")",
";",
"}"... | get the last commit for a given treeish, for the actual tree
@param string $ref
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Commit | [
"get",
"the",
"last",
"commit",
"for",
"a",
"given",
"treeish",
"for",
"the",
"actual",
"tree"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L379-L387 |
matteosister/GitElephant | src/GitElephant/Objects/Tree.php | Tree.offsetGet | public function offsetGet($offset)
{
return isset($this->children[$offset]) ? $this->children[$offset] : null;
} | php | public function offsetGet($offset)
{
return isset($this->children[$offset]) ? $this->children[$offset] : null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"children",
"[",
"$",
"offset",
"]",
")",
"?",
"$",
"this",
"->",
"children",
"[",
"$",
"offset",
"]",
":",
"null",
";",
"}"
] | ArrayAccess interface
@param int $offset offset
@return null | [
"ArrayAccess",
"interface"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Tree.php#L449-L452 |
matteosister/GitElephant | src/GitElephant/Command/RemoteCommand.php | RemoteCommand.remote | public function remote(SubCommandCommand $subcommand = null, Array $options = array())
{
$normalizedOptions = $this->normalizeOptions($options, $this->remoteCmdSwitchOptions());
$this->clearAll();
$this->addCommandName(self::GIT_REMOTE);
foreach ($normalizedOptions as $value) {
$this->addCommandArgument($value);
}
if ($subcommand) {
$this->addCommandSubject($subcommand);
}
return $this->getCommand();
} | php | public function remote(SubCommandCommand $subcommand = null, Array $options = array())
{
$normalizedOptions = $this->normalizeOptions($options, $this->remoteCmdSwitchOptions());
$this->clearAll();
$this->addCommandName(self::GIT_REMOTE);
foreach ($normalizedOptions as $value) {
$this->addCommandArgument($value);
}
if ($subcommand) {
$this->addCommandSubject($subcommand);
}
return $this->getCommand();
} | [
"public",
"function",
"remote",
"(",
"SubCommandCommand",
"$",
"subcommand",
"=",
"null",
",",
"Array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"normalizedOptions",
"=",
"$",
"this",
"->",
"normalizeOptions",
"(",
"$",
"options",
",",
"$",
... | Build the remote command
NOTE: git-remote is most useful when using its subcommands, therefore
in practice you will likely pass a SubCommandCommand object. This
class provide "convenience" methods that do this for you.
@param \GitElephant\Command\SubCommandCommand $subcommand A subcommand object
@param array $options Options for the main git-remote command
@throws \RuntimeException
@return string Command string to pass to caller | [
"Build",
"the",
"remote",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/RemoteCommand.php#L64-L81 |
matteosister/GitElephant | src/GitElephant/Command/RemoteCommand.php | RemoteCommand.show | public function show($name = null, $queryRemotes = true)
{
$subcmd = new ShowSubCommand();
$subcmd->prepare($name, $queryRemotes);
return $this->remote($subcmd);
} | php | public function show($name = null, $queryRemotes = true)
{
$subcmd = new ShowSubCommand();
$subcmd->prepare($name, $queryRemotes);
return $this->remote($subcmd);
} | [
"public",
"function",
"show",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"$",
"subcmd",
"=",
"new",
"ShowSubCommand",
"(",
")",
";",
"$",
"subcmd",
"->",
"prepare",
"(",
"$",
"name",
",",
"$",
"queryRemotes",
")",... | git-remote show [name] command
NOTE: for technical reasons $name is optional, however under normal
implementation it SHOULD be passed!
@param string $name
@param bool $queryRemotes
@throws \RuntimeException
@return string | [
"git",
"-",
"remote",
"show",
"[",
"name",
"]",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/RemoteCommand.php#L119-L125 |
matteosister/GitElephant | src/GitElephant/Command/RemoteCommand.php | RemoteCommand.add | public function add($name, $url, $options = array())
{
$subcmd = new AddSubCommand();
$subcmd->prepare($name, $url, $options);
return $this->remote($subcmd);
} | php | public function add($name, $url, $options = array())
{
$subcmd = new AddSubCommand();
$subcmd->prepare($name, $url, $options);
return $this->remote($subcmd);
} | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"url",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"subcmd",
"=",
"new",
"AddSubCommand",
"(",
")",
";",
"$",
"subcmd",
"->",
"prepare",
"(",
"$",
"name",
",",
"$",
"url",
... | git-remote add [options] <name> <url>
@param string $name remote name
@param string $url URL of remote
@param array $options options for the add subcommand
@throws \RuntimeException
@return string | [
"git",
"-",
"remote",
"add",
"[",
"options",
"]",
"<name",
">",
"<url",
">"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/RemoteCommand.php#L137-L143 |
matteosister/GitElephant | src/GitElephant/Objects/Commit/Message.php | Message.toString | public function toString(bool $full = false)
{
if (count($this->message) == 0) {
return null;
}
if ($full) {
return implode(PHP_EOL, $this->message);
} else {
return $this->message[0];
}
} | php | public function toString(bool $full = false)
{
if (count($this->message) == 0) {
return null;
}
if ($full) {
return implode(PHP_EOL, $this->message);
} else {
return $this->message[0];
}
} | [
"public",
"function",
"toString",
"(",
"bool",
"$",
"full",
"=",
"false",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"message",
")",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"full",
")",
"{",
"return",
"implode"... | Return message string
@param bool $full get the full message
@return string|null | [
"Return",
"message",
"string"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Commit/Message.php#L78-L89 |
matteosister/GitElephant | src/GitElephant/Command/Caller/Caller.php | Caller.execute | public function execute($cmd, $git = true, $cwd = null, $acceptedExitCodes = array(0))
{
if ($git) {
$cmd = $this->getBinaryPath() . ' ' . $cmd;
}
if (stripos(PHP_OS, 'WIN') !== 0) {
// We rely on the C locale in all output we parse.
$cmd = 'LC_ALL=C ' . $cmd;
}
$process = new Process($cmd, is_null($cwd) ? $this->repositoryPath : $cwd);
$process->setTimeout(15000);
$process->run();
if (!in_array($process->getExitCode(), $acceptedExitCodes)) {
$text = 'Exit code: ' . $process->getExitCode();
$text .= ' while executing: "' . $cmd;
$text .= '" with reason: ' . $process->getErrorOutput();
$text .= "\n" . $process->getOutput();
throw new \RuntimeException($text);
}
$this->rawOutput = $process->getOutput();
// rtrim values
$values = array_map('rtrim', explode(PHP_EOL, $process->getOutput()));
$this->outputLines = $values;
return $this;
} | php | public function execute($cmd, $git = true, $cwd = null, $acceptedExitCodes = array(0))
{
if ($git) {
$cmd = $this->getBinaryPath() . ' ' . $cmd;
}
if (stripos(PHP_OS, 'WIN') !== 0) {
// We rely on the C locale in all output we parse.
$cmd = 'LC_ALL=C ' . $cmd;
}
$process = new Process($cmd, is_null($cwd) ? $this->repositoryPath : $cwd);
$process->setTimeout(15000);
$process->run();
if (!in_array($process->getExitCode(), $acceptedExitCodes)) {
$text = 'Exit code: ' . $process->getExitCode();
$text .= ' while executing: "' . $cmd;
$text .= '" with reason: ' . $process->getErrorOutput();
$text .= "\n" . $process->getOutput();
throw new \RuntimeException($text);
}
$this->rawOutput = $process->getOutput();
// rtrim values
$values = array_map('rtrim', explode(PHP_EOL, $process->getOutput()));
$this->outputLines = $values;
return $this;
} | [
"public",
"function",
"execute",
"(",
"$",
"cmd",
",",
"$",
"git",
"=",
"true",
",",
"$",
"cwd",
"=",
"null",
",",
"$",
"acceptedExitCodes",
"=",
"array",
"(",
"0",
")",
")",
"{",
"if",
"(",
"$",
"git",
")",
"{",
"$",
"cmd",
"=",
"$",
"this",
... | Executes a command
@param string $cmd the command to execute
@param bool $git if the command is git or a generic command
@param null $cwd the directory where the command must be executed
@param array $acceptedExitCodes exit codes accepted to consider the command execution successful
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\ProcessTimedOutException
@throws \Symfony\Component\Process\Exception\RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@return Caller | [
"Executes",
"a",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/Caller/Caller.php#L83-L111 |
matteosister/GitElephant | src/GitElephant/Command/Caller/Caller.php | Caller.getOutputLines | public function getOutputLines($stripBlankLines = false)
{
if ($stripBlankLines) {
$output = array();
foreach ($this->outputLines as $line) {
if ('' !== $line) {
$output[] = $line;
}
}
return $output;
}
return $this->outputLines;
} | php | public function getOutputLines($stripBlankLines = false)
{
if ($stripBlankLines) {
$output = array();
foreach ($this->outputLines as $line) {
if ('' !== $line) {
$output[] = $line;
}
}
return $output;
}
return $this->outputLines;
} | [
"public",
"function",
"getOutputLines",
"(",
"$",
"stripBlankLines",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"stripBlankLines",
")",
"{",
"$",
"output",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"outputLines",
"as",
"$",
"line",
"... | returns the output of the last executed command as an array of lines
@param bool $stripBlankLines remove the blank lines
@return array | [
"returns",
"the",
"output",
"of",
"the",
"last",
"executed",
"command",
"as",
"an",
"array",
"of",
"lines"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/Caller/Caller.php#L130-L144 |
matteosister/GitElephant | src/GitElephant/Command/BranchCommand.php | BranchCommand.contains | public function contains($reference)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandArgument('--contains');
$this->addCommandSubject($reference);
return $this->getCommand();
} | php | public function contains($reference)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandArgument('--contains');
$this->addCommandSubject($reference);
return $this->getCommand();
} | [
"public",
"function",
"contains",
"(",
"$",
"reference",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"(",
"self",
"::",
"BRANCH_COMMAND",
")",
";",
"$",
"this",
"->",
"addCommandArgument",
"(",
"'--contains'... | Locate branches that contain a reference
@param string $reference reference
@throws \RuntimeException
@return string the command | [
"Locate",
"branches",
"that",
"contain",
"a",
"reference"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BranchCommand.php#L52-L60 |
matteosister/GitElephant | src/GitElephant/Command/BranchCommand.php | BranchCommand.create | public function create($name, $startPoint = null)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandSubject($name);
if (null !== $startPoint) {
$this->addCommandSubject2($startPoint);
}
return $this->getCommand();
} | php | public function create($name, $startPoint = null)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandSubject($name);
if (null !== $startPoint) {
$this->addCommandSubject2($startPoint);
}
return $this->getCommand();
} | [
"public",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"startPoint",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"(",
"self",
"::",
"BRANCH_COMMAND",
")",
";",
"$",
"this",
"->",
"add... | Create a new branch
@param string $name The new branch name
@param string|null $startPoint the new branch start point.
@throws \RuntimeException
@return string the command | [
"Create",
"a",
"new",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BranchCommand.php#L71-L81 |
matteosister/GitElephant | src/GitElephant/Command/BranchCommand.php | BranchCommand.listBranches | public function listBranches($all = false, $simple = false)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
if (!$simple) {
$this->addCommandArgument('-v');
}
$this->addCommandArgument('--no-color');
$this->addCommandArgument('--no-abbrev');
if ($all) {
$this->addCommandArgument('-a');
}
return $this->getCommand();
} | php | public function listBranches($all = false, $simple = false)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
if (!$simple) {
$this->addCommandArgument('-v');
}
$this->addCommandArgument('--no-color');
$this->addCommandArgument('--no-abbrev');
if ($all) {
$this->addCommandArgument('-a');
}
return $this->getCommand();
} | [
"public",
"function",
"listBranches",
"(",
"$",
"all",
"=",
"false",
",",
"$",
"simple",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"(",
"self",
"::",
"BRANCH_COMMAND",
")",
";",
"if",
"... | Lists branches
@param bool $all lists all remotes
@param bool $simple list only branch names
@throws \RuntimeException
@return string the command | [
"Lists",
"branches"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BranchCommand.php#L92-L106 |
matteosister/GitElephant | src/GitElephant/Command/BranchCommand.php | BranchCommand.singleInfo | public function singleInfo($name, $all = false, $simple = false, $verbose = false)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
if (!$simple) {
$this->addCommandArgument('-v');
}
$this->addCommandArgument('--list');
$this->addCommandArgument('--no-color');
$this->addCommandArgument('--no-abbrev');
if ($all) {
$this->addCommandArgument('-a');
}
if ($verbose) {
$this->addCommandArgument('-vv');
}
$this->addCommandSubject($name);
return $this->getCommand();
} | php | public function singleInfo($name, $all = false, $simple = false, $verbose = false)
{
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
if (!$simple) {
$this->addCommandArgument('-v');
}
$this->addCommandArgument('--list');
$this->addCommandArgument('--no-color');
$this->addCommandArgument('--no-abbrev');
if ($all) {
$this->addCommandArgument('-a');
}
if ($verbose) {
$this->addCommandArgument('-vv');
}
$this->addCommandSubject($name);
return $this->getCommand();
} | [
"public",
"function",
"singleInfo",
"(",
"$",
"name",
",",
"$",
"all",
"=",
"false",
",",
"$",
"simple",
"=",
"false",
",",
"$",
"verbose",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",
"addCommandName",
"... | get info about a single branch
@param string $name The branch name
@param bool $all lists all remotes
@param bool $simple list only branch names
@param bool $verbose verbose, show also the upstream branch
@throws \RuntimeException
@return string | [
"get",
"info",
"about",
"a",
"single",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BranchCommand.php#L137-L156 |
matteosister/GitElephant | src/GitElephant/Command/BranchCommand.php | BranchCommand.delete | public function delete($name, $force = false)
{
$arg = ($force === true) ? '-D' : '-d';
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandArgument($arg);
$this->addCommandSubject($name);
return $this->getCommand();
} | php | public function delete($name, $force = false)
{
$arg = ($force === true) ? '-D' : '-d';
$this->clearAll();
$this->addCommandName(self::BRANCH_COMMAND);
$this->addCommandArgument($arg);
$this->addCommandSubject($name);
return $this->getCommand();
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"arg",
"=",
"(",
"$",
"force",
"===",
"true",
")",
"?",
"'-D'",
":",
"'-d'",
";",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"this",
"->",... | Delete a branch by its name
@param string $name The branch to delete
@param bool $force Force the delete
@throws \RuntimeException
@return string the command | [
"Delete",
"a",
"branch",
"by",
"its",
"name"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Command/BranchCommand.php#L167-L176 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.pick | public static function pick(Repository $repository, string $name = null, bool $queryRemotes = true)
{
return new self($repository, $name, $queryRemotes);
} | php | public static function pick(Repository $repository, string $name = null, bool $queryRemotes = true)
{
return new self($repository, $name, $queryRemotes);
} | [
"public",
"static",
"function",
"pick",
"(",
"Repository",
"$",
"repository",
",",
"string",
"$",
"name",
"=",
"null",
",",
"bool",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"repository",
",",
"$",
"name",
",",
"$",... | Static constructor
@param \GitElephant\Repository $repository repository instance
@param string $name remote name
@param bool $queryRemotes Fetch new information from remotes
@return \GitElephant\Objects\Remote | [
"Static",
"constructor"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L105-L108 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.getVerboseOutput | public function getVerboseOutput(RemoteCommand $remoteCmd = null)
{
if (!$remoteCmd) {
$remoteCmd = RemoteCommand::getInstance($this->repository);
}
$command = $remoteCmd->verbose();
return $this->repository->getCaller()->execute($command)->getOutputLines(true);
} | php | public function getVerboseOutput(RemoteCommand $remoteCmd = null)
{
if (!$remoteCmd) {
$remoteCmd = RemoteCommand::getInstance($this->repository);
}
$command = $remoteCmd->verbose();
return $this->repository->getCaller()->execute($command)->getOutputLines(true);
} | [
"public",
"function",
"getVerboseOutput",
"(",
"RemoteCommand",
"$",
"remoteCmd",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"remoteCmd",
")",
"{",
"$",
"remoteCmd",
"=",
"RemoteCommand",
"::",
"getInstance",
"(",
"$",
"this",
"->",
"repository",
")",
";"... | get output lines from git-remote --verbose
@param RemoteCommand $remoteCmd Optionally provide RemoteCommand object
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"get",
"output",
"lines",
"from",
"git",
"-",
"remote",
"--",
"verbose"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L121-L129 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.getShowOutput | public function getShowOutput(string $name = null, RemoteCommand $remoteCmd = null, bool $queryRemotes = true)
{
if (!$remoteCmd) {
$remoteCmd = RemoteCommand::getInstance($this->repository);
}
$command = $remoteCmd->show($name, $queryRemotes);
return $this->repository->getCaller()->execute($command)->getOutputLines(true);
} | php | public function getShowOutput(string $name = null, RemoteCommand $remoteCmd = null, bool $queryRemotes = true)
{
if (!$remoteCmd) {
$remoteCmd = RemoteCommand::getInstance($this->repository);
}
$command = $remoteCmd->show($name, $queryRemotes);
return $this->repository->getCaller()->execute($command)->getOutputLines(true);
} | [
"public",
"function",
"getShowOutput",
"(",
"string",
"$",
"name",
"=",
"null",
",",
"RemoteCommand",
"$",
"remoteCmd",
"=",
"null",
",",
"bool",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"remoteCmd",
")",
"{",
"$",
"remoteCmd",
... | get output lines from git-remote show [name]
NOTE: for technical reasons $name is optional, however under normal
implementation it SHOULD be passed!
@param string $name Name of remote to show details
@param RemoteCommand $remoteCmd Optionally provide RemoteCommand object
@param bool $queryRemotes Do not fetch new information from remotes
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"get",
"output",
"lines",
"from",
"git",
"-",
"remote",
"show",
"[",
"name",
"]"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L147-L155 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.createFromCommand | private function createFromCommand(bool $queryRemotes = true)
{
$outputLines = $this->getVerboseOutput();
$list = [];
foreach ($outputLines as $line) {
$matches = static::getMatches($line);
if (isset($matches[1])) {
$list[] = $matches[1];
}
}
array_filter($list);
if (in_array($this->name, $list)) {
$remoteDetails = $this->getShowOutput($this->name, null, $queryRemotes);
$this->parseOutputLines($remoteDetails);
} else {
throw new \InvalidArgumentException(sprintf('The %s remote doesn\'t exists', $this->name));
}
return $this;
} | php | private function createFromCommand(bool $queryRemotes = true)
{
$outputLines = $this->getVerboseOutput();
$list = [];
foreach ($outputLines as $line) {
$matches = static::getMatches($line);
if (isset($matches[1])) {
$list[] = $matches[1];
}
}
array_filter($list);
if (in_array($this->name, $list)) {
$remoteDetails = $this->getShowOutput($this->name, null, $queryRemotes);
$this->parseOutputLines($remoteDetails);
} else {
throw new \InvalidArgumentException(sprintf('The %s remote doesn\'t exists', $this->name));
}
return $this;
} | [
"private",
"function",
"createFromCommand",
"(",
"bool",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"$",
"outputLines",
"=",
"$",
"this",
"->",
"getVerboseOutput",
"(",
")",
";",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"outputLines",
"as",... | get/store the properties from git-remote command
NOTE: the name property should be set if this is to do anything,
otherwise it's likely to throw
@param bool $queryRemotes Do not fetch new information from remotes
@throws \RuntimeException
@throws \UnexpectedValueException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return \GitElephant\Objects\Remote | [
"get",
"/",
"store",
"the",
"properties",
"from",
"git",
"-",
"remote",
"command"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L171-L190 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.parseOutputLines | public function parseOutputLines(array $remoteDetails)
{
array_filter($remoteDetails);
$name = array_shift($remoteDetails);
$name = (is_string($name)) ? trim($name) : '';
$name = $this->parseName($name);
if (!$name) {
throw new \UnexpectedValueException(sprintf('Invalid data provided for remote detail parsing'));
}
$this->name = $name;
$fetchURLPattern = '/^Fetch\s+URL:\s*(.*)$/';
$fetchURL = null;
$pushURLPattern = '/^Push\s+URL:\s*(.*)$/';
$pushURL = null;
$remoteHEADPattern = '/^HEAD\s+branch:\s*(.*)$/';
$remoteHEAD = null;
$remoteBranchHeaderPattern = '/^Remote\s+branch(?:es)?:$/';
$localBranchPullHeaderPattern = '/^Local\sbranch(?:es)?\sconfigured\sfor\s\'git\spull\'\:$/';
$localRefPushHeaderPattern = '/^Local\sref(?:s)?\sconfigured\sfor\s\'git\spush\':$/';
$groups = [
'remoteBranches' => null,
'localBranches' => null,
'localRefs' => null,
];
foreach ($remoteDetails as $lineno => $line) {
$line = trim($line);
$matches = [];
if (is_null($fetchURL) && preg_match($fetchURLPattern, $line, $matches)) {
$this->fetchURL = $fetchURL = $matches[1];
} elseif (is_null($pushURL) && preg_match($pushURLPattern, $line, $matches)) {
$this->pushURL = $pushURL = $matches[1];
} elseif (is_null($remoteHEAD) && preg_match($remoteHEADPattern, $line, $matches)) {
$this->remoteHEAD = $remoteHEAD = $matches[1];
} elseif (is_null($groups['remoteBranches']) && preg_match($remoteBranchHeaderPattern, $line, $matches)) {
$groups['remoteBranches'] = $lineno;
} elseif (is_null($groups['localBranches']) && preg_match($localBranchPullHeaderPattern, $line, $matches)) {
$groups['localBranches'] = $lineno;
} elseif (is_null($groups['localRefs']) && preg_match($localRefPushHeaderPattern, $line, $matches)) {
$groups['localRefs'] = $lineno;
}
}
$this->setBranches($this->aggregateBranchDetails($groups, $remoteDetails));
} | php | public function parseOutputLines(array $remoteDetails)
{
array_filter($remoteDetails);
$name = array_shift($remoteDetails);
$name = (is_string($name)) ? trim($name) : '';
$name = $this->parseName($name);
if (!$name) {
throw new \UnexpectedValueException(sprintf('Invalid data provided for remote detail parsing'));
}
$this->name = $name;
$fetchURLPattern = '/^Fetch\s+URL:\s*(.*)$/';
$fetchURL = null;
$pushURLPattern = '/^Push\s+URL:\s*(.*)$/';
$pushURL = null;
$remoteHEADPattern = '/^HEAD\s+branch:\s*(.*)$/';
$remoteHEAD = null;
$remoteBranchHeaderPattern = '/^Remote\s+branch(?:es)?:$/';
$localBranchPullHeaderPattern = '/^Local\sbranch(?:es)?\sconfigured\sfor\s\'git\spull\'\:$/';
$localRefPushHeaderPattern = '/^Local\sref(?:s)?\sconfigured\sfor\s\'git\spush\':$/';
$groups = [
'remoteBranches' => null,
'localBranches' => null,
'localRefs' => null,
];
foreach ($remoteDetails as $lineno => $line) {
$line = trim($line);
$matches = [];
if (is_null($fetchURL) && preg_match($fetchURLPattern, $line, $matches)) {
$this->fetchURL = $fetchURL = $matches[1];
} elseif (is_null($pushURL) && preg_match($pushURLPattern, $line, $matches)) {
$this->pushURL = $pushURL = $matches[1];
} elseif (is_null($remoteHEAD) && preg_match($remoteHEADPattern, $line, $matches)) {
$this->remoteHEAD = $remoteHEAD = $matches[1];
} elseif (is_null($groups['remoteBranches']) && preg_match($remoteBranchHeaderPattern, $line, $matches)) {
$groups['remoteBranches'] = $lineno;
} elseif (is_null($groups['localBranches']) && preg_match($localBranchPullHeaderPattern, $line, $matches)) {
$groups['localBranches'] = $lineno;
} elseif (is_null($groups['localRefs']) && preg_match($localRefPushHeaderPattern, $line, $matches)) {
$groups['localRefs'] = $lineno;
}
}
$this->setBranches($this->aggregateBranchDetails($groups, $remoteDetails));
} | [
"public",
"function",
"parseOutputLines",
"(",
"array",
"$",
"remoteDetails",
")",
"{",
"array_filter",
"(",
"$",
"remoteDetails",
")",
";",
"$",
"name",
"=",
"array_shift",
"(",
"$",
"remoteDetails",
")",
";",
"$",
"name",
"=",
"(",
"is_string",
"(",
"$",... | parse details from remote show
@param array|string $remoteDetails Output lines for a remote show
@throws \UnexpectedValueException | [
"parse",
"details",
"from",
"remote",
"show"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L199-L246 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.aggregateBranchDetails | protected function aggregateBranchDetails($groupLines, $remoteDetails)
{
$configuredRefs = [];
arsort($groupLines);
foreach ($groupLines as $type => $lineno) {
$configuredRefs[$type] = array_splice($remoteDetails, $lineno);
array_shift($configuredRefs[$type]);
}
$configuredRefs['remoteBranches'] = isset($configuredRefs['remoteBranches'])
? $this->parseRemoteBranches($configuredRefs['remoteBranches'])
: [];
$configuredRefs['localBranches'] = isset($configuredRefs['localBranches'])
? $this->parseLocalPullBranches($configuredRefs['localBranches'])
: [];
$configuredRefs['localRefs'] = isset($configuredRefs['localRefs'])
? $this->parseLocalPushRefs($configuredRefs['localRefs'])
: [];
$aggBranches = [];
foreach ($configuredRefs as $branches) {
foreach ($branches as $branchName => $data) {
if (!isset($aggBranches[$branchName])) {
$aggBranches[$branchName] = [];
}
$aggBranches[$branchName] = $aggBranches[$branchName] + $data;
}
}
return $aggBranches;
} | php | protected function aggregateBranchDetails($groupLines, $remoteDetails)
{
$configuredRefs = [];
arsort($groupLines);
foreach ($groupLines as $type => $lineno) {
$configuredRefs[$type] = array_splice($remoteDetails, $lineno);
array_shift($configuredRefs[$type]);
}
$configuredRefs['remoteBranches'] = isset($configuredRefs['remoteBranches'])
? $this->parseRemoteBranches($configuredRefs['remoteBranches'])
: [];
$configuredRefs['localBranches'] = isset($configuredRefs['localBranches'])
? $this->parseLocalPullBranches($configuredRefs['localBranches'])
: [];
$configuredRefs['localRefs'] = isset($configuredRefs['localRefs'])
? $this->parseLocalPushRefs($configuredRefs['localRefs'])
: [];
$aggBranches = [];
foreach ($configuredRefs as $branches) {
foreach ($branches as $branchName => $data) {
if (!isset($aggBranches[$branchName])) {
$aggBranches[$branchName] = [];
}
$aggBranches[$branchName] = $aggBranches[$branchName] + $data;
}
}
return $aggBranches;
} | [
"protected",
"function",
"aggregateBranchDetails",
"(",
"$",
"groupLines",
",",
"$",
"remoteDetails",
")",
"{",
"$",
"configuredRefs",
"=",
"[",
"]",
";",
"arsort",
"(",
"$",
"groupLines",
")",
";",
"foreach",
"(",
"$",
"groupLines",
"as",
"$",
"type",
"=>... | provided with the start points of the branch details, parse out the
branch details and return a structured representation of said details
@param array $groupLines Associative array whose values are line numbers
are respective of the "group" detail present in $remoteDetails
@param array $remoteDetails Output of git-remote show [name]
@return array | [
"provided",
"with",
"the",
"start",
"points",
"of",
"the",
"branch",
"details",
"parse",
"out",
"the",
"branch",
"details",
"and",
"return",
"a",
"structured",
"representation",
"of",
"said",
"details"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L258-L290 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.parseRemoteBranches | public function parseRemoteBranches(array $lines)
{
$branches = [];
$delimiter = ' ';
foreach ($lines as $line) {
$line = trim($line);
$line = preg_replace('/\s+/', ' ', $line);
$parts = explode($delimiter, $line);
if (count($parts) > 1) {
$branches[$parts[0]] = ['local_relationship' => $parts[1]];
}
}
return $branches;
} | php | public function parseRemoteBranches(array $lines)
{
$branches = [];
$delimiter = ' ';
foreach ($lines as $line) {
$line = trim($line);
$line = preg_replace('/\s+/', ' ', $line);
$parts = explode($delimiter, $line);
if (count($parts) > 1) {
$branches[$parts[0]] = ['local_relationship' => $parts[1]];
}
}
return $branches;
} | [
"public",
"function",
"parseRemoteBranches",
"(",
"array",
"$",
"lines",
")",
"{",
"$",
"branches",
"=",
"[",
"]",
";",
"$",
"delimiter",
"=",
"' '",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"trim",
"(",
"$"... | parse the details related to remote branch references
@param array $lines
@return array | [
"parse",
"the",
"details",
"related",
"to",
"remote",
"branch",
"references"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L299-L313 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.parseLocalPushRefs | public function parseLocalPushRefs($lines)
{
$branches = [];
$delimiter = ' pushes to ';
foreach ($lines as $line) {
$line = trim($line);
$line = preg_replace('/\s+/', ' ', $line);
$parts = explode($delimiter, $line);
if (count($parts) > 1) {
$value = explode(' ', $parts[1], 2);
$branches[$parts[0]] = ['pushes_to' => $value[0], 'local_state' => $value[1]];
}
}
return $branches;
} | php | public function parseLocalPushRefs($lines)
{
$branches = [];
$delimiter = ' pushes to ';
foreach ($lines as $line) {
$line = trim($line);
$line = preg_replace('/\s+/', ' ', $line);
$parts = explode($delimiter, $line);
if (count($parts) > 1) {
$value = explode(' ', $parts[1], 2);
$branches[$parts[0]] = ['pushes_to' => $value[0], 'local_state' => $value[1]];
}
}
return $branches;
} | [
"public",
"function",
"parseLocalPushRefs",
"(",
"$",
"lines",
")",
"{",
"$",
"branches",
"=",
"[",
"]",
";",
"$",
"delimiter",
"=",
"' pushes to '",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"trim",
"(",
"$",
... | parse the details related to local branches and the remotes that they
push to
@param array $lines
@return array | [
"parse",
"the",
"details",
"related",
"to",
"local",
"branches",
"and",
"the",
"remotes",
"that",
"they",
"push",
"to"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L347-L362 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.parseName | public function parseName($line)
{
$matches = [];
$pattern = '/^\*\s+remote\s+(.*)$/';
preg_match($pattern, trim($line), $matches);
if (!isset($matches[1])) {
return '';
}
return $matches[1];
} | php | public function parseName($line)
{
$matches = [];
$pattern = '/^\*\s+remote\s+(.*)$/';
preg_match($pattern, trim($line), $matches);
if (!isset($matches[1])) {
return '';
}
return $matches[1];
} | [
"public",
"function",
"parseName",
"(",
"$",
"line",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"'/^\\*\\s+remote\\s+(.*)$/'",
";",
"preg_match",
"(",
"$",
"pattern",
",",
"trim",
"(",
"$",
"line",
")",
",",
"$",
"matches",
")",... | parse remote name from git-remote show [name] output line
@param string $line
@return string remote name or blank if invalid | [
"parse",
"remote",
"name",
"from",
"git",
"-",
"remote",
"show",
"[",
"name",
"]",
"output",
"line"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L371-L381 |
matteosister/GitElephant | src/GitElephant/Objects/Remote.php | Remote.getMatches | public static function getMatches($remoteString)
{
$matches = [];
preg_match('/^(\S+)\s*(\S[^\( ]+)\s*\((.+)\)$/', trim($remoteString), $matches);
if (!count($matches)) {
throw new \InvalidArgumentException(sprintf('the remote string is not valid: %s', $remoteString));
}
return array_map('trim', $matches);
} | php | public static function getMatches($remoteString)
{
$matches = [];
preg_match('/^(\S+)\s*(\S[^\( ]+)\s*\((.+)\)$/', trim($remoteString), $matches);
if (!count($matches)) {
throw new \InvalidArgumentException(sprintf('the remote string is not valid: %s', $remoteString));
}
return array_map('trim', $matches);
} | [
"public",
"static",
"function",
"getMatches",
"(",
"$",
"remoteString",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"preg_match",
"(",
"'/^(\\S+)\\s*(\\S[^\\( ]+)\\s*\\((.+)\\)$/'",
",",
"trim",
"(",
"$",
"remoteString",
")",
",",
"$",
"matches",
")",
";",
... | get the matches from an output line
@param string $remoteString remote line output
@throws \InvalidArgumentException
@return array | [
"get",
"the",
"matches",
"from",
"an",
"output",
"line"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Remote.php#L391-L400 |
matteosister/GitElephant | src/GitElephant/Objects/Diff/DiffObject.php | DiffObject.findChunks | private function findChunks(array $lines)
{
$arrayChunks = Utilities::pregSplitArray(
$lines,
'/^@@ -(\d+,\d+)|(\d+) \+(\d+,\d+)|(\d+) @@(.*)$/'
);
foreach ($arrayChunks as $chunkLines) {
$this->chunks[] = new DiffChunk($chunkLines);
}
} | php | private function findChunks(array $lines)
{
$arrayChunks = Utilities::pregSplitArray(
$lines,
'/^@@ -(\d+,\d+)|(\d+) \+(\d+,\d+)|(\d+) @@(.*)$/'
);
foreach ($arrayChunks as $chunkLines) {
$this->chunks[] = new DiffChunk($chunkLines);
}
} | [
"private",
"function",
"findChunks",
"(",
"array",
"$",
"lines",
")",
"{",
"$",
"arrayChunks",
"=",
"Utilities",
"::",
"pregSplitArray",
"(",
"$",
"lines",
",",
"'/^@@ -(\\d+,\\d+)|(\\d+) \\+(\\d+,\\d+)|(\\d+) @@(.*)$/'",
")",
";",
"foreach",
"(",
"$",
"arrayChunks"... | Find the diff chunks
@param array $lines output lines for the diff
@throws \InvalidArgumentException | [
"Find",
"the",
"diff",
"chunks"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Diff/DiffObject.php#L131-L140 |
matteosister/GitElephant | src/GitElephant/Objects/Diff/DiffObject.php | DiffObject.findPath | private function findPath(string $line)
{
$matches = [];
if (preg_match('/^diff --git SRC\/(.*) DST\/(.*)$/', $line, $matches)) {
$this->originalPath = $matches[1];
$this->destinationPath = $matches[2];
}
} | php | private function findPath(string $line)
{
$matches = [];
if (preg_match('/^diff --git SRC\/(.*) DST\/(.*)$/', $line, $matches)) {
$this->originalPath = $matches[1];
$this->destinationPath = $matches[2];
}
} | [
"private",
"function",
"findPath",
"(",
"string",
"$",
"line",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"'/^diff --git SRC\\/(.*) DST\\/(.*)$/'",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"$",
"this",
"->",
... | look for the path in the line
@param string $line line content | [
"look",
"for",
"the",
"path",
"in",
"the",
"line"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Diff/DiffObject.php#L147-L154 |
matteosister/GitElephant | src/GitElephant/Objects/Diff/DiffObject.php | DiffObject.findMode | private function findMode(string $line)
{
if (preg_match('/^index (.*)\.\.(.*) (.*)$/', $line)) {
$this->mode = self::MODE_INDEX;
}
if (preg_match('/^mode (.*)\.\.(.*) (.*)$/', $line)) {
$this->mode = self::MODE_MODE;
}
if (preg_match('/^new file mode (.*)/', $line)) {
$this->mode = self::MODE_NEW_FILE;
}
if (preg_match('/^deleted file mode (.*)/', $line)) {
$this->mode = self::MODE_DELETED_FILE;
}
} | php | private function findMode(string $line)
{
if (preg_match('/^index (.*)\.\.(.*) (.*)$/', $line)) {
$this->mode = self::MODE_INDEX;
}
if (preg_match('/^mode (.*)\.\.(.*) (.*)$/', $line)) {
$this->mode = self::MODE_MODE;
}
if (preg_match('/^new file mode (.*)/', $line)) {
$this->mode = self::MODE_NEW_FILE;
}
if (preg_match('/^deleted file mode (.*)/', $line)) {
$this->mode = self::MODE_DELETED_FILE;
}
} | [
"private",
"function",
"findMode",
"(",
"string",
"$",
"line",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^index (.*)\\.\\.(.*) (.*)$/'",
",",
"$",
"line",
")",
")",
"{",
"$",
"this",
"->",
"mode",
"=",
"self",
"::",
"MODE_INDEX",
";",
"}",
"if",
"(",
... | find the line mode
@param string $line line content | [
"find",
"the",
"line",
"mode"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Diff/DiffObject.php#L161-L178 |
matteosister/GitElephant | src/GitElephant/Objects/Diff/DiffObject.php | DiffObject.findSimilarityIndex | private function findSimilarityIndex(string $line)
{
$matches = [];
if (preg_match('/^similarity index (.*)\%$/', $line, $matches)) {
$this->similarityIndex = $matches[1];
}
} | php | private function findSimilarityIndex(string $line)
{
$matches = [];
if (preg_match('/^similarity index (.*)\%$/', $line, $matches)) {
$this->similarityIndex = $matches[1];
}
} | [
"private",
"function",
"findSimilarityIndex",
"(",
"string",
"$",
"line",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"'/^similarity index (.*)\\%$/'",
",",
"$",
"line",
",",
"$",
"matches",
")",
")",
"{",
"$",
"this",
"->... | look for similarity index in the line
@param string $line line content | [
"look",
"for",
"similarity",
"index",
"in",
"the",
"line"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Diff/DiffObject.php#L185-L191 |
matteosister/GitElephant | src/GitElephant/Objects/Diff/DiffObject.php | DiffObject.offsetGet | public function offsetGet($offset)
{
return isset($this->chunks[$offset]) ? $this->chunks[$offset] : null;
} | php | public function offsetGet($offset)
{
return isset($this->chunks[$offset]) ? $this->chunks[$offset] : null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"chunks",
"[",
"$",
"offset",
"]",
")",
"?",
"$",
"this",
"->",
"chunks",
"[",
"$",
"offset",
"]",
":",
"null",
";",
"}"
] | ArrayAccess interface
@param int $offset offset
@return null | [
"ArrayAccess",
"interface"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Objects/Diff/DiffObject.php#L277-L280 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.open | public static function open($repositoryPath, string $binary = null, $name = null)
{
return new self($repositoryPath, $binary, $name);
} | php | public static function open($repositoryPath, string $binary = null, $name = null)
{
return new self($repositoryPath, $binary, $name);
} | [
"public",
"static",
"function",
"open",
"(",
"$",
"repositoryPath",
",",
"string",
"$",
"binary",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"repositoryPath",
",",
"$",
"binary",
",",
"$",
"name",
")",
";... | Factory method
@param string $repositoryPath the path of the git repository
@param string|null $binary the path to the git binary
@param string $name a repository name
@return \GitElephant\Repository | [
"Factory",
"method"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L137-L140 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.createFromRemote | public static function createFromRemote($git, $repositoryPath = null, string $binary = null, $name = null)
{
if (null === $repositoryPath) {
$tempDir = realpath(sys_get_temp_dir());
$repositoryPath = sprintf('%s%s%s', $tempDir, DIRECTORY_SEPARATOR, sha1(uniqid()));
$fs = new Filesystem();
$fs->mkdir($repositoryPath);
}
$repository = new Repository($repositoryPath, $binary, $name);
if ($git instanceof Repository) {
$git = $git->getPath();
}
$repository->cloneFrom($git, $repositoryPath);
$repository->checkoutAllRemoteBranches();
return $repository;
} | php | public static function createFromRemote($git, $repositoryPath = null, string $binary = null, $name = null)
{
if (null === $repositoryPath) {
$tempDir = realpath(sys_get_temp_dir());
$repositoryPath = sprintf('%s%s%s', $tempDir, DIRECTORY_SEPARATOR, sha1(uniqid()));
$fs = new Filesystem();
$fs->mkdir($repositoryPath);
}
$repository = new Repository($repositoryPath, $binary, $name);
if ($git instanceof Repository) {
$git = $git->getPath();
}
$repository->cloneFrom($git, $repositoryPath);
$repository->checkoutAllRemoteBranches();
return $repository;
} | [
"public",
"static",
"function",
"createFromRemote",
"(",
"$",
"git",
",",
"$",
"repositoryPath",
"=",
"null",
",",
"string",
"$",
"binary",
"=",
"null",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"repositoryPath",
")",
"{",... | create a repository from a remote git url, or a local filesystem
and save it in a temp folder
@param string|Repository $git the git remote url, or the filesystem path
@param null $repositoryPath path
@param string|null $binary the path to the git binary
@param null $name repository name
@throws \RuntimeException
@throws \Symfony\Component\Filesystem\Exception\IOException
@return Repository | [
"create",
"a",
"repository",
"from",
"a",
"remote",
"git",
"url",
"or",
"a",
"local",
"filesystem",
"and",
"save",
"it",
"in",
"a",
"temp",
"folder"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L155-L171 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.init | public function init($bare = false)
{
$this->caller->execute(MainCommand::getInstance($this)->init($bare));
return $this;
} | php | public function init($bare = false)
{
$this->caller->execute(MainCommand::getInstance($this)->init($bare));
return $this;
} | [
"public",
"function",
"init",
"(",
"$",
"bare",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"init",
"(",
"$",
"bare",
")",
")",
";",
"return",
"$",
"thi... | Init the repository
@param bool $bare created a bare repository
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Init",
"the",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L184-L189 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.stage | public function stage($path = '.')
{
$this->caller->execute(MainCommand::getInstance($this)->add($path));
return $this;
} | php | public function stage($path = '.')
{
$this->caller->execute(MainCommand::getInstance($this)->add($path));
return $this;
} | [
"public",
"function",
"stage",
"(",
"$",
"path",
"=",
"'.'",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"add",
"(",
"$",
"path",
")",
")",
";",
"return",
"$",
"this"... | Stage the working tree content
@param string|NodeObject $path the path to store
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Stage",
"the",
"working",
"tree",
"content"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L202-L207 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.unstage | public function unstage($path)
{
$this->caller->execute(MainCommand::getInstance($this)->unstage($path), true, null, [0, 1]);
return $this;
} | php | public function unstage($path)
{
$this->caller->execute(MainCommand::getInstance($this)->unstage($path), true, null, [0, 1]);
return $this;
} | [
"public",
"function",
"unstage",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"unstage",
"(",
"$",
"path",
")",
",",
"true",
",",
"null",
",",
"[",
"... | Unstage a tree content
@param string|NodeObject $path the path to unstage
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Unstage",
"a",
"tree",
"content"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L220-L225 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.move | public function move($from, $to)
{
$this->caller->execute(MainCommand::getInstance($this)->move($from, $to));
return $this;
} | php | public function move($from, $to)
{
$this->caller->execute(MainCommand::getInstance($this)->move($from, $to));
return $this;
} | [
"public",
"function",
"move",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"move",
"(",
"$",
"from",
",",
"$",
"to",
")",
")",
";",... | Move a file/directory
@param string|NodeObject $from source path
@param string|NodeObject $to destination path
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \InvalidArgumentException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Move",
"a",
"file",
"/",
"directory"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L240-L245 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.remove | public function remove($path, $recursive = false, $force = false)
{
$this->caller->execute(MainCommand::getInstance($this)->remove($path, $recursive, $force));
return $this;
} | php | public function remove($path, $recursive = false, $force = false)
{
$this->caller->execute(MainCommand::getInstance($this)->remove($path, $recursive, $force));
return $this;
} | [
"public",
"function",
"remove",
"(",
"$",
"path",
",",
"$",
"recursive",
"=",
"false",
",",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"rem... | Remove a file/directory
@param string|NodeObject $path the path to remove
@param bool $recursive recurse
@param bool $force force
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \InvalidArgumentException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Remove",
"a",
"file",
"/",
"directory"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L261-L266 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.commit | public function commit(string $message, $stageAll = false, $ref = null, $author = null, $allowEmpty = false)
{
$currentBranch = null;
if (!is_null($ref)) {
$currentBranch = $this->getMainBranch();
$this->checkout($ref);
}
if ($stageAll) {
$this->stage();
}
$this->caller->execute(MainCommand::getInstance($this)->commit($message, $stageAll, $author, $allowEmpty));
if (!is_null($ref)) {
$this->checkout($currentBranch);
}
return $this;
} | php | public function commit(string $message, $stageAll = false, $ref = null, $author = null, $allowEmpty = false)
{
$currentBranch = null;
if (!is_null($ref)) {
$currentBranch = $this->getMainBranch();
$this->checkout($ref);
}
if ($stageAll) {
$this->stage();
}
$this->caller->execute(MainCommand::getInstance($this)->commit($message, $stageAll, $author, $allowEmpty));
if (!is_null($ref)) {
$this->checkout($currentBranch);
}
return $this;
} | [
"public",
"function",
"commit",
"(",
"string",
"$",
"message",
",",
"$",
"stageAll",
"=",
"false",
",",
"$",
"ref",
"=",
"null",
",",
"$",
"author",
"=",
"null",
",",
"$",
"allowEmpty",
"=",
"false",
")",
"{",
"$",
"currentBranch",
"=",
"null",
";",
... | Commit content to the repository, eventually staging all unstaged content
@param string $message the commit message
@param bool $stageAll whether to stage on not everything before commit
@param string|null $ref the reference to commit to (checkout -> commit -> checkout previous)
@param string|Author $author override the author for this commit
@param bool $allowEmpty override the author for this commit
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Commit",
"content",
"to",
"the",
"repository",
"eventually",
"staging",
"all",
"unstaged",
"content"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L282-L298 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.revParse | public function revParse(string $arg = null, array $options = [])
{
$this->caller->execute(RevParseCommand::getInstance()->revParse($arg, $options));
return array_map('trim', $this->caller->getOutputLines(true));
} | php | public function revParse(string $arg = null, array $options = [])
{
$this->caller->execute(RevParseCommand::getInstance()->revParse($arg, $options));
return array_map('trim', $this->caller->getOutputLines(true));
} | [
"public",
"function",
"revParse",
"(",
"string",
"$",
"arg",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"RevParseCommand",
"::",
"getInstance",
"(",
")",
"->",
"revParse",
"(",... | rev-parse command - often used to return a commit tag.
@param array $options the options to apply to rev-parse
@param string|NodeObject|Commit $arg the argument (may be a branch head, etc)
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"rev",
"-",
"parse",
"command",
"-",
"often",
"used",
"to",
"return",
"a",
"commit",
"tag",
"."
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L311-L316 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.isBare | public function isBare()
{
$options = [RevParseCommand::OPTION_IS_BARE_REPOSIORY];
$this->caller->execute(RevParseCommand::getInstance()->revParse(null, $options));
return trim($this->caller->getOutput()) === 'true';
} | php | public function isBare()
{
$options = [RevParseCommand::OPTION_IS_BARE_REPOSIORY];
$this->caller->execute(RevParseCommand::getInstance()->revParse(null, $options));
return trim($this->caller->getOutput()) === 'true';
} | [
"public",
"function",
"isBare",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"RevParseCommand",
"::",
"OPTION_IS_BARE_REPOSIORY",
"]",
";",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"RevParseCommand",
"::",
"getInstance",
"(",
")",
"->",
"revParse",
"("... | Check if this is a bare repository
@return boolean | [
"Check",
"if",
"this",
"is",
"a",
"bare",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L323-L329 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getStatusOutput | public function getStatusOutput()
{
$this->caller->execute(MainCommand::getInstance($this)->status());
return array_map('trim', $this->caller->getOutputLines());
} | php | public function getStatusOutput()
{
$this->caller->execute(MainCommand::getInstance($this)->status());
return array_map('trim', $this->caller->getOutputLines());
} | [
"public",
"function",
"getStatusOutput",
"(",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"MainCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"status",
"(",
")",
")",
";",
"return",
"array_map",
"(",
"'trim'",
",",
"$",
"t... | Get the repository status as a string
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"Get",
"the",
"repository",
"status",
"as",
"a",
"string"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L395-L400 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.createBranch | public function createBranch(string $name, $startPoint = null)
{
Branch::create($this, $name, $startPoint);
return $this;
} | php | public function createBranch(string $name, $startPoint = null)
{
Branch::create($this, $name, $startPoint);
return $this;
} | [
"public",
"function",
"createBranch",
"(",
"string",
"$",
"name",
",",
"$",
"startPoint",
"=",
"null",
")",
"{",
"Branch",
"::",
"create",
"(",
"$",
"this",
",",
"$",
"name",
",",
"$",
"startPoint",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Create a new branch
@param string $name the new branch name
@param null $startPoint the reference to create the branch from
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Create",
"a",
"new",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L412-L417 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.deleteBranch | public function deleteBranch(string $name, bool $force = false)
{
$this->caller->execute(BranchCommand::getInstance($this)->delete($name, $force));
return $this;
} | php | public function deleteBranch(string $name, bool $force = false)
{
$this->caller->execute(BranchCommand::getInstance($this)->delete($name, $force));
return $this;
} | [
"public",
"function",
"deleteBranch",
"(",
"string",
"$",
"name",
",",
"bool",
"$",
"force",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"BranchCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"delete",
"(",
"$... | Delete a branch by its name
This function change the state of the repository on the filesystem
@param string $name The branch to delete
@param bool $force Force the delete
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Delete",
"a",
"branch",
"by",
"its",
"name",
"This",
"function",
"change",
"the",
"state",
"of",
"the",
"repository",
"on",
"the",
"filesystem"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L432-L437 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getBranches | public function getBranches(bool $namesOnly = false, bool $all = false)
{
$branches = [];
if ($namesOnly) {
$outputLines = $this->caller
->execute(BranchCommand::getInstance($this)->listBranches($all, true))
->getOutputLines(true);
$branches = array_map(
function ($v) {
return ltrim($v, '* ');
},
$outputLines
);
} else {
$outputLines = $this->caller
->execute(BranchCommand::getInstance($this)->listBranches($all))
->getOutputLines(true);
foreach ($outputLines as $branchLine) {
$branches[] = Branch::createFromOutputLine($this, $branchLine);
}
}
return $branches;
} | php | public function getBranches(bool $namesOnly = false, bool $all = false)
{
$branches = [];
if ($namesOnly) {
$outputLines = $this->caller
->execute(BranchCommand::getInstance($this)->listBranches($all, true))
->getOutputLines(true);
$branches = array_map(
function ($v) {
return ltrim($v, '* ');
},
$outputLines
);
} else {
$outputLines = $this->caller
->execute(BranchCommand::getInstance($this)->listBranches($all))
->getOutputLines(true);
foreach ($outputLines as $branchLine) {
$branches[] = Branch::createFromOutputLine($this, $branchLine);
}
}
return $branches;
} | [
"public",
"function",
"getBranches",
"(",
"bool",
"$",
"namesOnly",
"=",
"false",
",",
"bool",
"$",
"all",
"=",
"false",
")",
"{",
"$",
"branches",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"namesOnly",
")",
"{",
"$",
"outputLines",
"=",
"$",
"this",
"->... | An array of Branch objects
@param bool $namesOnly return an array of branch names as a string
@param bool $all lists also remote branches
@throws \RuntimeException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"An",
"array",
"of",
"Branch",
"objects"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L452-L477 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getMainBranch | public function getMainBranch()
{
$filtered = array_filter(
$this->getBranches(),
function (Branch $branch) {
return $branch->getCurrent();
}
);
sort($filtered);
return $filtered[0];
} | php | public function getMainBranch()
{
$filtered = array_filter(
$this->getBranches(),
function (Branch $branch) {
return $branch->getCurrent();
}
);
sort($filtered);
return $filtered[0];
} | [
"public",
"function",
"getMainBranch",
"(",
")",
"{",
"$",
"filtered",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"getBranches",
"(",
")",
",",
"function",
"(",
"Branch",
"$",
"branch",
")",
"{",
"return",
"$",
"branch",
"->",
"getCurrent",
"(",
")",
... | Return the actually checked out branch
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Objects\Branch | [
"Return",
"the",
"actually",
"checked",
"out",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L487-L498 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getBranch | public function getBranch(string $name)
{
/** @var Branch $branch */
foreach ($this->getBranches() as $branch) {
if ($branch->getName() === $name) {
return $branch;
}
}
return null;
} | php | public function getBranch(string $name)
{
/** @var Branch $branch */
foreach ($this->getBranches() as $branch) {
if ($branch->getName() === $name) {
return $branch;
}
}
return null;
} | [
"public",
"function",
"getBranch",
"(",
"string",
"$",
"name",
")",
"{",
"/** @var Branch $branch */",
"foreach",
"(",
"$",
"this",
"->",
"getBranches",
"(",
")",
"as",
"$",
"branch",
")",
"{",
"if",
"(",
"$",
"branch",
"->",
"getName",
"(",
")",
"===",
... | Retrieve a Branch object by a branch name
@param string $name The branch name
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return null|Branch | [
"Retrieve",
"a",
"Branch",
"object",
"by",
"a",
"branch",
"name"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L510-L520 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.checkoutAllRemoteBranches | public function checkoutAllRemoteBranches($remote = 'origin')
{
$actualBranch = $this->getMainBranch();
$actualBranches = $this->getBranches(true, false);
$allBranches = $this->getBranches(true, true);
$realBranches = array_filter(
$allBranches,
function (string $branch) use ($actualBranches) {
return !in_array($branch, $actualBranches)
&& preg_match('/^remotes(.+)$/', $branch)
&& !preg_match('/^(.+)(HEAD)(.*?)$/', $branch);
}
);
foreach ($realBranches as $realBranch) {
$this->checkout(str_replace(sprintf('remotes/%s/', $remote), '', $realBranch));
}
$this->checkout($actualBranch);
return $this;
} | php | public function checkoutAllRemoteBranches($remote = 'origin')
{
$actualBranch = $this->getMainBranch();
$actualBranches = $this->getBranches(true, false);
$allBranches = $this->getBranches(true, true);
$realBranches = array_filter(
$allBranches,
function (string $branch) use ($actualBranches) {
return !in_array($branch, $actualBranches)
&& preg_match('/^remotes(.+)$/', $branch)
&& !preg_match('/^(.+)(HEAD)(.*?)$/', $branch);
}
);
foreach ($realBranches as $realBranch) {
$this->checkout(str_replace(sprintf('remotes/%s/', $remote), '', $realBranch));
}
$this->checkout($actualBranch);
return $this;
} | [
"public",
"function",
"checkoutAllRemoteBranches",
"(",
"$",
"remote",
"=",
"'origin'",
")",
"{",
"$",
"actualBranch",
"=",
"$",
"this",
"->",
"getMainBranch",
"(",
")",
";",
"$",
"actualBranches",
"=",
"$",
"this",
"->",
"getBranches",
"(",
"true",
",",
"... | Checkout all branches from the remote and make them local
@param string $remote remote to fetch from
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Checkout",
"all",
"branches",
"from",
"the",
"remote",
"and",
"make",
"them",
"local"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L532-L553 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.merge | public function merge(Branch $branch, string $message = '', string $mode = 'auto')
{
$valid_modes = [
'auto', // deafult git behavior
'ff-only', // force fast forward merge
'no-ff', // force 3-way merge
];
if (!in_array($mode, $valid_modes)) {
throw new InvalidArgumentException("Invalid merge mode: $mode.");
}
$options = [];
switch ($mode) {
case 'ff-only':
$options[] = MergeCommand::MERGE_OPTION_FF_ONLY;
break;
case 'no-ff':
$options[] = MergeCommand::MERGE_OPTION_NO_FF;
break;
}
$this->caller->execute(MergeCommand::getInstance($this)->merge($branch, $message, $options));
return $this;
} | php | public function merge(Branch $branch, string $message = '', string $mode = 'auto')
{
$valid_modes = [
'auto', // deafult git behavior
'ff-only', // force fast forward merge
'no-ff', // force 3-way merge
];
if (!in_array($mode, $valid_modes)) {
throw new InvalidArgumentException("Invalid merge mode: $mode.");
}
$options = [];
switch ($mode) {
case 'ff-only':
$options[] = MergeCommand::MERGE_OPTION_FF_ONLY;
break;
case 'no-ff':
$options[] = MergeCommand::MERGE_OPTION_NO_FF;
break;
}
$this->caller->execute(MergeCommand::getInstance($this)->merge($branch, $message, $options));
return $this;
} | [
"public",
"function",
"merge",
"(",
"Branch",
"$",
"branch",
",",
"string",
"$",
"message",
"=",
"''",
",",
"string",
"$",
"mode",
"=",
"'auto'",
")",
"{",
"$",
"valid_modes",
"=",
"[",
"'auto'",
",",
"// deafult git behavior",
"'ff-only'",
",",
"// force ... | Merge a Branch in the current checked out branch
@param Objects\Branch $branch The branch to merge in the current checked out branch
@param string $message The message for the merge commit, if merge is 3-way
@param string $mode The merge mode: ff-only, no-ff or auto
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Merge",
"a",
"Branch",
"in",
"the",
"current",
"checked",
"out",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L568-L592 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.createTag | public function createTag(string $name, $startPoint = null, string $message = null)
{
Tag::create($this, $name, $startPoint, $message);
return $this;
} | php | public function createTag(string $name, $startPoint = null, string $message = null)
{
Tag::create($this, $name, $startPoint, $message);
return $this;
} | [
"public",
"function",
"createTag",
"(",
"string",
"$",
"name",
",",
"$",
"startPoint",
"=",
"null",
",",
"string",
"$",
"message",
"=",
"null",
")",
"{",
"Tag",
"::",
"create",
"(",
"$",
"this",
",",
"$",
"name",
",",
"$",
"startPoint",
",",
"$",
"... | Create a new tag
This function change the state of the repository on the filesystem
@param string $name The new tag name
@param null $startPoint The reference to create the tag from
@param null $message the tag message
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Create",
"a",
"new",
"tag",
"This",
"function",
"change",
"the",
"state",
"of",
"the",
"repository",
"on",
"the",
"filesystem"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L606-L611 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.deleteTag | public function deleteTag($tag)
{
if ($tag instanceof Tag) {
$tag->delete();
} else {
Tag::pick($this, $tag)->delete();
}
return $this;
} | php | public function deleteTag($tag)
{
if ($tag instanceof Tag) {
$tag->delete();
} else {
Tag::pick($this, $tag)->delete();
}
return $this;
} | [
"public",
"function",
"deleteTag",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"$",
"tag",
"instanceof",
"Tag",
")",
"{",
"$",
"tag",
"->",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"Tag",
"::",
"pick",
"(",
"$",
"this",
",",
"$",
"tag",
")",
"->",
... | Delete a tag by it's name or by passing a Tag object
This function change the state of the repository on the filesystem
@param string|Tag $tag The tag name or the Tag object
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Delete",
"a",
"tag",
"by",
"it",
"s",
"name",
"or",
"by",
"passing",
"a",
"Tag",
"object",
"This",
"function",
"change",
"the",
"state",
"of",
"the",
"repository",
"on",
"the",
"filesystem"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L623-L632 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.addSubmodule | public function addSubmodule(string $gitUrl, $path = null)
{
$this->caller->execute(SubmoduleCommand::getInstance($this)->add($gitUrl, $path));
return $this;
} | php | public function addSubmodule(string $gitUrl, $path = null)
{
$this->caller->execute(SubmoduleCommand::getInstance($this)->add($gitUrl, $path));
return $this;
} | [
"public",
"function",
"addSubmodule",
"(",
"string",
"$",
"gitUrl",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"SubmoduleCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"add",
"(",
"$",
"gitU... | add a git submodule to the repository
@param string $gitUrl git url of the submodule
@param string $path path to register the submodule to
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"add",
"a",
"git",
"submodule",
"to",
"the",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L646-L651 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.initSubmodule | public function initSubmodule($path = null)
{
$this->caller->execute(SubmoduleCommand::getInstance($this)->init($path));
return $this;
} | php | public function initSubmodule($path = null)
{
$this->caller->execute(SubmoduleCommand::getInstance($this)->init($path));
return $this;
} | [
"public",
"function",
"initSubmodule",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"SubmoduleCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"init",
"(",
"$",
"path",
")",
")",
";",
"return",
... | initialize submodules
@param string $path init only submodules at the specified path
@return Repository | [
"initialize",
"submodules"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L660-L665 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.updateSubmodule | public function updateSubmodule(
bool $recursive = false,
bool $init = false,
bool $force = false,
$path = null
) {
$this->caller->execute(SubmoduleCommand::getInstance($this)->update($recursive, $init, $force, $path));
return $this;
} | php | public function updateSubmodule(
bool $recursive = false,
bool $init = false,
bool $force = false,
$path = null
) {
$this->caller->execute(SubmoduleCommand::getInstance($this)->update($recursive, $init, $force, $path));
return $this;
} | [
"public",
"function",
"updateSubmodule",
"(",
"bool",
"$",
"recursive",
"=",
"false",
",",
"bool",
"$",
"init",
"=",
"false",
",",
"bool",
"$",
"force",
"=",
"false",
",",
"$",
"path",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execut... | update submodules
@param bool $recursive update recursively
@param bool $init init before update
@param bool $force force the checkout as part of update
@param string $path update only a specific submodule path
@return Repository | [
"update",
"submodules"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L677-L686 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getTags | public function getTags()
{
$tags = [];
$this->caller->execute(TagCommand::getInstance($this)->listTags());
foreach ($this->caller->getOutputLines() as $tagString) {
if ($tagString != '') {
$tags[] = new Tag($this, trim($tagString));
}
}
return $tags;
} | php | public function getTags()
{
$tags = [];
$this->caller->execute(TagCommand::getInstance($this)->listTags());
foreach ($this->caller->getOutputLines() as $tagString) {
if ($tagString != '') {
$tags[] = new Tag($this, trim($tagString));
}
}
return $tags;
} | [
"public",
"function",
"getTags",
"(",
")",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"TagCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"listTags",
"(",
")",
")",
";",
"foreach",
"(",
"$",... | Gets an array of Tag objects
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"Gets",
"an",
"array",
"of",
"Tag",
"objects"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L697-L708 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getTag | public function getTag(string $name)
{
$tagFinderOutput = $this->caller
->execute(TagCommand::getInstance()->listTags())
->getOutputLines(true);
foreach ($tagFinderOutput as $line) {
if ($line === $name) {
return new Tag($this, $name);
}
}
return null;
} | php | public function getTag(string $name)
{
$tagFinderOutput = $this->caller
->execute(TagCommand::getInstance()->listTags())
->getOutputLines(true);
foreach ($tagFinderOutput as $line) {
if ($line === $name) {
return new Tag($this, $name);
}
}
return null;
} | [
"public",
"function",
"getTag",
"(",
"string",
"$",
"name",
")",
"{",
"$",
"tagFinderOutput",
"=",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"TagCommand",
"::",
"getInstance",
"(",
")",
"->",
"listTags",
"(",
")",
")",
"->",
"getOutputLines",
"(... | Return a tag object
@param string $name The tag name
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Tag|null | [
"Return",
"a",
"tag",
"object"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L719-L732 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getLastTag | public function getLastTag()
{
$finder = Finder::create()
->files()
->in(sprintf('%s/.git/refs/tags', $this->path))
->sortByChangedTime();
if ($finder->count() == 0) {
return null;
}
$files = iterator_to_array($finder->getIterator(), false);
$files = array_reverse($files);
/** @var $firstFile SplFileInfo */
$firstFile = $files[0];
$tagName = $firstFile->getFilename();
return Tag::pick($this, $tagName);
} | php | public function getLastTag()
{
$finder = Finder::create()
->files()
->in(sprintf('%s/.git/refs/tags', $this->path))
->sortByChangedTime();
if ($finder->count() == 0) {
return null;
}
$files = iterator_to_array($finder->getIterator(), false);
$files = array_reverse($files);
/** @var $firstFile SplFileInfo */
$firstFile = $files[0];
$tagName = $firstFile->getFilename();
return Tag::pick($this, $tagName);
} | [
"public",
"function",
"getLastTag",
"(",
")",
"{",
"$",
"finder",
"=",
"Finder",
"::",
"create",
"(",
")",
"->",
"files",
"(",
")",
"->",
"in",
"(",
"sprintf",
"(",
"'%s/.git/refs/tags'",
",",
"$",
"this",
"->",
"path",
")",
")",
"->",
"sortByChangedTi... | Return the last created tag
@throws \LogicException
@throws \RuntimeException
@throws \InvalidArgumentException
@return Tag|null | [
"Return",
"the",
"last",
"created",
"tag"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L742-L760 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getBranchOrTag | public function getBranchOrTag(string $name)
{
if (in_array($name, $this->getBranches(true))) {
return new Branch($this, $name);
}
$tagFinderOutput = $this->caller->execute(TagCommand::getInstance($this)->listTags())->getOutputLines(true);
foreach ($tagFinderOutput as $line) {
if ($line === $name) {
return new Tag($this, $name);
}
}
return null;
} | php | public function getBranchOrTag(string $name)
{
if (in_array($name, $this->getBranches(true))) {
return new Branch($this, $name);
}
$tagFinderOutput = $this->caller->execute(TagCommand::getInstance($this)->listTags())->getOutputLines(true);
foreach ($tagFinderOutput as $line) {
if ($line === $name) {
return new Tag($this, $name);
}
}
return null;
} | [
"public",
"function",
"getBranchOrTag",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"getBranches",
"(",
"true",
")",
")",
")",
"{",
"return",
"new",
"Branch",
"(",
"$",
"this",
",",
"$",
"n... | Try to get a branch or a tag by its name.
@param string $name the reference name (a tag name or a branch name)
@throws \RuntimeException
@throws \InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return \GitElephant\Objects\Tag|\GitElephant\Objects\Branch|null | [
"Try",
"to",
"get",
"a",
"branch",
"or",
"a",
"tag",
"by",
"its",
"name",
"."
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L772-L785 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getLog | public function getLog(
$ref = 'HEAD',
$path = null,
int $limit = 10,
int $offset = null,
bool $firstParent = false
) {
return new Log($this, $ref, $path, $limit, $offset, $firstParent);
} | php | public function getLog(
$ref = 'HEAD',
$path = null,
int $limit = 10,
int $offset = null,
bool $firstParent = false
) {
return new Log($this, $ref, $path, $limit, $offset, $firstParent);
} | [
"public",
"function",
"getLog",
"(",
"$",
"ref",
"=",
"'HEAD'",
",",
"$",
"path",
"=",
"null",
",",
"int",
"$",
"limit",
"=",
"10",
",",
"int",
"$",
"offset",
"=",
"null",
",",
"bool",
"$",
"firstParent",
"=",
"false",
")",
"{",
"return",
"new",
... | Get a log for a ref
@param string|TreeishInterface|array $ref the treeish to check, as a string, as an object or as an array
@param string|NodeObject $path the physical path to the tree relative to the repository root
@param int|null $limit limit to n entries
@param int|null $offset skip n entries
@param boolean|false $firstParent skip commits brought in to branch by a merge
@return \GitElephant\Objects\Log | [
"Get",
"a",
"log",
"for",
"a",
"ref"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L829-L837 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getLogRange | public function getLogRange(
$refStart,
$refEnd,
$path = null,
int $limit = 10,
int $offset = null,
bool $firstParent = false
) {
// Handle when clients provide bad start reference on branch creation
if (preg_match('~^[0]+$~', $refStart)) {
return new Log($this, $refEnd, $path, $limit, $offset, $firstParent);
}
// Handle when clients provide bad end reference on branch deletion
if (preg_match('~^[0]+$~', $refEnd)) {
$refEnd = $refStart;
}
return new LogRange($this, $refStart, $refEnd, $path, $limit, $offset, $firstParent);
} | php | public function getLogRange(
$refStart,
$refEnd,
$path = null,
int $limit = 10,
int $offset = null,
bool $firstParent = false
) {
// Handle when clients provide bad start reference on branch creation
if (preg_match('~^[0]+$~', $refStart)) {
return new Log($this, $refEnd, $path, $limit, $offset, $firstParent);
}
// Handle when clients provide bad end reference on branch deletion
if (preg_match('~^[0]+$~', $refEnd)) {
$refEnd = $refStart;
}
return new LogRange($this, $refStart, $refEnd, $path, $limit, $offset, $firstParent);
} | [
"public",
"function",
"getLogRange",
"(",
"$",
"refStart",
",",
"$",
"refEnd",
",",
"$",
"path",
"=",
"null",
",",
"int",
"$",
"limit",
"=",
"10",
",",
"int",
"$",
"offset",
"=",
"null",
",",
"bool",
"$",
"firstParent",
"=",
"false",
")",
"{",
"// ... | Get a log for a range ref
@param string $refStart
@param string $refEnd
@param string|NodeObject $path the physical path to the tree relative to the repository root
@param int|null $limit limit to n entries
@param int|null $offset skip n entries
@param boolean|false $firstParent skip commits brought in to branch by a merge
@return \GitElephant\Objects\LogRange|\GitElephant\Objects\Log | [
"Get",
"a",
"log",
"for",
"a",
"range",
"ref"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L851-L870 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getObjectLog | public function getObjectLog(NodeObject $obj, $branch = null, int $limit = 1, int $offset = null)
{
$command = LogCommand::getInstance($this)->showObjectLog($obj, $branch, $limit, $offset);
return Log::createFromOutputLines($this, $this->caller->execute($command)->getOutputLines());
} | php | public function getObjectLog(NodeObject $obj, $branch = null, int $limit = 1, int $offset = null)
{
$command = LogCommand::getInstance($this)->showObjectLog($obj, $branch, $limit, $offset);
return Log::createFromOutputLines($this, $this->caller->execute($command)->getOutputLines());
} | [
"public",
"function",
"getObjectLog",
"(",
"NodeObject",
"$",
"obj",
",",
"$",
"branch",
"=",
"null",
",",
"int",
"$",
"limit",
"=",
"1",
",",
"int",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"command",
"=",
"LogCommand",
"::",
"getInstance",
"(",
"... | Get a log for an object
@param \GitElephant\Objects\NodeObject $obj The Object instance
@param null|string|\GitElephant\Objects\Branch $branch The branch to read from
@param int $limit Limit to n entries
@param int|null $offset Skip n entries
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return \GitElephant\Objects\Log | [
"Get",
"a",
"log",
"for",
"an",
"object"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L886-L891 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.checkout | public function checkout($ref, bool $create = false)
{
if ($create && is_null($this->getBranch($ref))) {
$this->createBranch($ref);
}
$this->caller->execute(MainCommand::getInstance($this)->checkout($ref));
return $this;
} | php | public function checkout($ref, bool $create = false)
{
if ($create && is_null($this->getBranch($ref))) {
$this->createBranch($ref);
}
$this->caller->execute(MainCommand::getInstance($this)->checkout($ref));
return $this;
} | [
"public",
"function",
"checkout",
"(",
"$",
"ref",
",",
"bool",
"$",
"create",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"create",
"&&",
"is_null",
"(",
"$",
"this",
"->",
"getBranch",
"(",
"$",
"ref",
")",
")",
")",
"{",
"$",
"this",
"->",
"create... | Checkout a branch
This function change the state of the repository on the filesystem
@param string|TreeishInterface $ref the reference to checkout
@param bool $create like -b on the command line
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Checkout",
"a",
"branch",
"This",
"function",
"change",
"the",
"state",
"of",
"the",
"repository",
"on",
"the",
"filesystem"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L906-L914 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getTree | public function getTree($ref = 'HEAD', $path = null)
{
if (is_string($path) && '' !== $path) {
$outputLines = $this
->getCaller()
->execute(LsTreeCommand::getInstance($this)->tree($ref, $path))
->getOutputLines(true);
$path = TreeObject::createFromOutputLine($this, $outputLines[0]);
}
return new Tree($this, $ref, $path);
} | php | public function getTree($ref = 'HEAD', $path = null)
{
if (is_string($path) && '' !== $path) {
$outputLines = $this
->getCaller()
->execute(LsTreeCommand::getInstance($this)->tree($ref, $path))
->getOutputLines(true);
$path = TreeObject::createFromOutputLine($this, $outputLines[0]);
}
return new Tree($this, $ref, $path);
} | [
"public",
"function",
"getTree",
"(",
"$",
"ref",
"=",
"'HEAD'",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"path",
")",
"&&",
"''",
"!==",
"$",
"path",
")",
"{",
"$",
"outputLines",
"=",
"$",
"this",
"->",
"getCal... | Retrieve an instance of Tree
Tree Object is Countable, Iterable and has ArrayAccess for easy manipulation
@param string|TreeishInterface $ref the treeish to check
@param string|NodeObject $path Object or null for root
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Objects\Tree | [
"Retrieve",
"an",
"instance",
"of",
"Tree",
"Tree",
"Object",
"is",
"Countable",
"Iterable",
"and",
"has",
"ArrayAccess",
"for",
"easy",
"manipulation"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L929-L941 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getDiff | public function getDiff(string $commit1 = null, string $commit2 = null, string $path = null)
{
return Diff::create($this, $commit1, $commit2, $path);
} | php | public function getDiff(string $commit1 = null, string $commit2 = null, string $path = null)
{
return Diff::create($this, $commit1, $commit2, $path);
} | [
"public",
"function",
"getDiff",
"(",
"string",
"$",
"commit1",
"=",
"null",
",",
"string",
"$",
"commit2",
"=",
"null",
",",
"string",
"$",
"path",
"=",
"null",
")",
"{",
"return",
"Diff",
"::",
"create",
"(",
"$",
"this",
",",
"$",
"commit1",
",",
... | Get a Diff object for a commit with its parent, by default the diff is between the current head and its parent
@param \GitElephant\Objects\Commit|string $commit1 A TreeishInterface instance
@param \GitElephant\Objects\Commit|string|null $commit2 A TreeishInterface instance
@param null|string|NodeObject $path The path to get the diff for or a Object instance
@throws \RuntimeException
@throws \InvalidArgumentException
@return Objects\Diff\Diff | [
"Get",
"a",
"Diff",
"object",
"for",
"a",
"commit",
"with",
"its",
"parent",
"by",
"default",
"the",
"diff",
"is",
"between",
"the",
"current",
"head",
"and",
"its",
"parent"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L954-L957 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.cloneFrom | public function cloneFrom(string $url, string $to = null, string $repoReference = null, int $depth = null, bool $recursive = false)
{
$command = (Command\CloneCommand::getInstance($this))->cloneUrl($url, $to, $repoReference, $depth, $recursive);
$this->caller->execute($command);
return $this;
} | php | public function cloneFrom(string $url, string $to = null, string $repoReference = null, int $depth = null, bool $recursive = false)
{
$command = (Command\CloneCommand::getInstance($this))->cloneUrl($url, $to, $repoReference, $depth, $recursive);
$this->caller->execute($command);
return $this;
} | [
"public",
"function",
"cloneFrom",
"(",
"string",
"$",
"url",
",",
"string",
"$",
"to",
"=",
"null",
",",
"string",
"$",
"repoReference",
"=",
"null",
",",
"int",
"$",
"depth",
"=",
"null",
",",
"bool",
"$",
"recursive",
"=",
"false",
")",
"{",
"$",
... | Clone a repository
@param string $url the repository url (i.e. git://github.com/matteosister/GitElephant.git)
@param null $to where to clone the repo
@param string|null $repoReference Repo reference to clone. Required if performing a shallow clone.
@param int|null $depth Depth to clone repo. Specify 1 to perform a shallow clone
@param bool $recursive Whether to recursively clone child repos.
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws \Symfony\Component\Process\Exception\InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"Clone",
"a",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L974-L979 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.addRemote | public function addRemote(string $name, string $url)
{
$this->caller->execute(RemoteCommand::getInstance($this)->add($name, $url));
return $this;
} | php | public function addRemote(string $name, string $url)
{
$this->caller->execute(RemoteCommand::getInstance($this)->add($name, $url));
return $this;
} | [
"public",
"function",
"addRemote",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"RemoteCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"add",
"(",
"$",
"name",
",",
"$... | @param string $name remote name
@param string $url remote url
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return Repository | [
"@param",
"string",
"$name",
"remote",
"name",
"@param",
"string",
"$url",
"remote",
"url"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L991-L996 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getRemote | public function getRemote(string $name, bool $queryRemotes = true)
{
return Remote::pick($this, $name, $queryRemotes);
} | php | public function getRemote(string $name, bool $queryRemotes = true)
{
return Remote::pick($this, $name, $queryRemotes);
} | [
"public",
"function",
"getRemote",
"(",
"string",
"$",
"name",
",",
"bool",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"return",
"Remote",
"::",
"pick",
"(",
"$",
"this",
",",
"$",
"name",
",",
"$",
"queryRemotes",
")",
";",
"}"
] | @param string $name remote name
@param bool $queryRemotes Fetch new information from remotes
@return \GitElephant\Objects\Remote | [
"@param",
"string",
"$name",
"remote",
"name",
"@param",
"bool",
"$queryRemotes",
"Fetch",
"new",
"information",
"from",
"remotes"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1004-L1007 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getRemotes | public function getRemotes(bool $queryRemotes = true)
{
$remoteNames = $this->caller
->execute(RemoteCommand::getInstance($this)->show(null, $queryRemotes))
->getOutputLines(true);
$remotes = [];
foreach ($remoteNames as $remoteName) {
$remotes[] = $this->getRemote($remoteName, $queryRemotes);
}
return $remotes;
} | php | public function getRemotes(bool $queryRemotes = true)
{
$remoteNames = $this->caller
->execute(RemoteCommand::getInstance($this)->show(null, $queryRemotes))
->getOutputLines(true);
$remotes = [];
foreach ($remoteNames as $remoteName) {
$remotes[] = $this->getRemote($remoteName, $queryRemotes);
}
return $remotes;
} | [
"public",
"function",
"getRemotes",
"(",
"bool",
"$",
"queryRemotes",
"=",
"true",
")",
"{",
"$",
"remoteNames",
"=",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"RemoteCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"show",
"(",
"null... | gets a list of remote objects
@param bool $queryRemotes Fetch new information from remotes
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"gets",
"a",
"list",
"of",
"remote",
"objects"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1020-L1032 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.fetch | public function fetch($from = null, $ref = null, bool $tags = false)
{
$options = [];
if ($tags === true) {
$options = ['--tags'];
}
$this->caller->execute(FetchCommand::getInstance($this)->fetch($from, $ref, $options));
} | php | public function fetch($from = null, $ref = null, bool $tags = false)
{
$options = [];
if ($tags === true) {
$options = ['--tags'];
}
$this->caller->execute(FetchCommand::getInstance($this)->fetch($from, $ref, $options));
} | [
"public",
"function",
"fetch",
"(",
"$",
"from",
"=",
"null",
",",
"$",
"ref",
"=",
"null",
",",
"bool",
"$",
"tags",
"=",
"false",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"tags",
"===",
"true",
")",
"{",
"$",
"options",
... | Download objects and refs from another repository
@param string $from
@param string $ref
@param bool $tags
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException | [
"Download",
"objects",
"and",
"refs",
"from",
"another",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1046-L1053 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.pull | public function pull($from = null, $ref = null, bool $rebase = true)
{
$this->caller->execute(PullCommand::getInstance($this)->pull($from, $ref, $rebase));
} | php | public function pull($from = null, $ref = null, bool $rebase = true)
{
$this->caller->execute(PullCommand::getInstance($this)->pull($from, $ref, $rebase));
} | [
"public",
"function",
"pull",
"(",
"$",
"from",
"=",
"null",
",",
"$",
"ref",
"=",
"null",
",",
"bool",
"$",
"rebase",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"PullCommand",
"::",
"getInstance",
"(",
"$",
"this",
"... | Fetch from and merge with another repository or a local branch
@param string $from
@param string $ref
@param bool $rebase
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException | [
"Fetch",
"from",
"and",
"merge",
"with",
"another",
"repository",
"or",
"a",
"local",
"branch"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1067-L1070 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.push | public function push($to = null, $ref = null, string $args = null)
{
$this->caller->execute(PushCommand::getInstance($this)->push($to, $ref, $args));
} | php | public function push($to = null, $ref = null, string $args = null)
{
$this->caller->execute(PushCommand::getInstance($this)->push($to, $ref, $args));
} | [
"public",
"function",
"push",
"(",
"$",
"to",
"=",
"null",
",",
"$",
"ref",
"=",
"null",
",",
"string",
"$",
"args",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"caller",
"->",
"execute",
"(",
"PushCommand",
"::",
"getInstance",
"(",
"$",
"this",
")"... | Push changes to remote repository
@param string $to
@param string $ref
@param string $args
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException | [
"Push",
"changes",
"to",
"remote",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1084-L1087 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.getHumanishName | public function getHumanishName()
{
$name = substr($this->getPath(), strrpos($this->getPath(), '/') + 1);
$name = str_replace('.git', '.', $name);
$name = str_replace('.bundle', '.', $name);
return $name;
} | php | public function getHumanishName()
{
$name = substr($this->getPath(), strrpos($this->getPath(), '/') + 1);
$name = str_replace('.git', '.', $name);
$name = str_replace('.bundle', '.', $name);
return $name;
} | [
"public",
"function",
"getHumanishName",
"(",
")",
"{",
"$",
"name",
"=",
"substr",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"strrpos",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"'/'",
")",
"+",
"1",
")",
";",
"$",
"name",
"=",
... | get the humanish name of the repository
@return string | [
"get",
"the",
"humanish",
"name",
"of",
"the",
"repository"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1094-L1101 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.outputContent | public function outputContent(NodeObject $obj, $treeish)
{
$command = CatFileCommand::getInstance($this)->content($obj, $treeish);
return $this->caller->execute($command)->getOutputLines();
} | php | public function outputContent(NodeObject $obj, $treeish)
{
$command = CatFileCommand::getInstance($this)->content($obj, $treeish);
return $this->caller->execute($command)->getOutputLines();
} | [
"public",
"function",
"outputContent",
"(",
"NodeObject",
"$",
"obj",
",",
"$",
"treeish",
")",
"{",
"$",
"command",
"=",
"CatFileCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"content",
"(",
"$",
"obj",
",",
"$",
"treeish",
")",
";",
"re... | output a node content as an array of lines
@param \GitElephant\Objects\NodeObject $obj The Object of type BLOB
@param \GitElephant\Objects\TreeishInterface|string $treeish A treeish object
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return array | [
"output",
"a",
"node",
"content",
"as",
"an",
"array",
"of",
"lines"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1115-L1120 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.outputRawContent | public function outputRawContent(NodeObject $obj, $treeish)
{
$command = CatFileCommand::getInstance($this)->content($obj, $treeish);
return $this->caller->execute($command)->getRawOutput();
} | php | public function outputRawContent(NodeObject $obj, $treeish)
{
$command = CatFileCommand::getInstance($this)->content($obj, $treeish);
return $this->caller->execute($command)->getRawOutput();
} | [
"public",
"function",
"outputRawContent",
"(",
"NodeObject",
"$",
"obj",
",",
"$",
"treeish",
")",
"{",
"$",
"command",
"=",
"CatFileCommand",
"::",
"getInstance",
"(",
"$",
"this",
")",
"->",
"content",
"(",
"$",
"obj",
",",
"$",
"treeish",
")",
";",
... | output a node raw content
@param \GitElephant\Objects\NodeObject $obj The Object of type BLOB
@param \GitElephant\Objects\TreeishInterface|string $treeish A treeish object
@throws \RuntimeException
@throws \Symfony\Component\Process\Exception\LogicException
@throws InvalidArgumentException
@throws \Symfony\Component\Process\Exception\RuntimeException
@return string | [
"output",
"a",
"node",
"raw",
"content"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1134-L1139 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.removeGlobalConfig | public function removeGlobalConfig(string $name)
{
if (isset($this->globalConfigs[$name])) {
unset($this->globalConfigs[$name]);
}
} | php | public function removeGlobalConfig(string $name)
{
if (isset($this->globalConfigs[$name])) {
unset($this->globalConfigs[$name]);
}
} | [
"public",
"function",
"removeGlobalConfig",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"globalConfigs",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"globalConfigs",
"[",
"$",
"name",
"... | remove an element form the global config list, identified by key
@param string $name The config name | [
"remove",
"an",
"element",
"form",
"the",
"global",
"config",
"list",
"identified",
"by",
"key"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1217-L1222 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.removeGlobalOption | public function removeGlobalOption(string $name)
{
if (isset($this->globalOptions[$name])) {
unset($this->globalOptions[$name]);
}
} | php | public function removeGlobalOption(string $name)
{
if (isset($this->globalOptions[$name])) {
unset($this->globalOptions[$name]);
}
} | [
"public",
"function",
"removeGlobalOption",
"(",
"string",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"globalOptions",
"[",
"$",
"name",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"globalOptions",
"[",
"$",
"name",
"... | remove an element form the global option list, identified by key
@param string $name The option name | [
"remove",
"an",
"element",
"form",
"the",
"global",
"option",
"list",
"identified",
"by",
"key"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1250-L1255 |
matteosister/GitElephant | src/GitElephant/Repository.php | Repository.addGlobalCommandArgument | public function addGlobalCommandArgument($value)
{
if (!in_array($value, $this->globalCommandArguments, true)) {
$this->globalCommandArguments[] = $value;
}
} | php | public function addGlobalCommandArgument($value)
{
if (!in_array($value, $this->globalCommandArguments, true)) {
$this->globalCommandArguments[] = $value;
}
} | [
"public",
"function",
"addGlobalCommandArgument",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"globalCommandArguments",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"globalCommandArguments",
"[",
"]... | add a value to the global command argument list
@param string $value The command argument | [
"add",
"a",
"value",
"to",
"the",
"global",
"command",
"argument",
"list"
] | train | https://github.com/matteosister/GitElephant/blob/b29d0d3efdadd09386e1d6dace0b56f6fa994f72/src/GitElephant/Repository.php#L1272-L1277 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.