aboutsummaryrefslogtreecommitdiffstats
path: root/library/kzykhys/git/src/PHPGit/Command/Remote
diff options
context:
space:
mode:
Diffstat (limited to 'library/kzykhys/git/src/PHPGit/Command/Remote')
-rw-r--r--library/kzykhys/git/src/PHPGit/Command/Remote/SetBranchesCommand.php98
-rw-r--r--library/kzykhys/git/src/PHPGit/Command/Remote/SetHeadCommand.php120
-rw-r--r--library/kzykhys/git/src/PHPGit/Command/Remote/SetUrlCommand.php175
3 files changed, 0 insertions, 393 deletions
diff --git a/library/kzykhys/git/src/PHPGit/Command/Remote/SetBranchesCommand.php b/library/kzykhys/git/src/PHPGit/Command/Remote/SetBranchesCommand.php
deleted file mode 100644
index 4e17a4d48..000000000
--- a/library/kzykhys/git/src/PHPGit/Command/Remote/SetBranchesCommand.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-namespace PHPGit\Command\Remote;
-
-use PHPGit\Command;
-
-/**
- * Changes the list of branches tracked by the named remote
- *
- * @author Kazuyuki Hayashi
- */
-class SetBranchesCommand extends Command
-{
-
- /**
- * Alias of set()
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->branches('origin', array('master', 'develop'));
- * ```
- *
- * @param string $name The remote name
- * @param array $branches The names of the tracked branch
- *
- * @return bool
- */
- public function __invoke($name, array $branches)
- {
- return $this->set($name, $branches);
- }
-
- /**
- * Changes the list of branches tracked by the named remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->branches->set('origin', array('master', 'develop'));
- * ```
- *
- * @param string $name The remote name
- * @param array $branches The names of the tracked branch
- *
- * @return bool
- */
- public function set($name, array $branches)
- {
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-branches')
- ->add($name);
-
- foreach ($branches as $branch) {
- $builder->add($branch);
- }
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * Adds to the list of branches tracked by the named remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->branches->add('origin', array('master', 'develop'));
- * ```
- *
- * @param string $name The remote name
- * @param array $branches The names of the tracked branch
- *
- * @return bool
- */
- public function add($name, array $branches)
- {
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-branches')
- ->add($name)
- ->add('--add');
-
- foreach ($branches as $branch) {
- $builder->add($branch);
- }
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
-} \ No newline at end of file
diff --git a/library/kzykhys/git/src/PHPGit/Command/Remote/SetHeadCommand.php b/library/kzykhys/git/src/PHPGit/Command/Remote/SetHeadCommand.php
deleted file mode 100644
index 9241ef5b7..000000000
--- a/library/kzykhys/git/src/PHPGit/Command/Remote/SetHeadCommand.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-
-namespace PHPGit\Command\Remote;
-
-use PHPGit\Command;
-
-/**
- * Sets or deletes the default branch (i.e. the target of the symbolic-ref refs/remotes/<name>/HEAD) for the named remote
- *
- * @author Kazuyuki Hayashi
- */
-class SetHeadCommand extends Command
-{
-
- /**
- * Alias of set()
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->head('origin');
- * ```
- *
- * @param string $name The remote name
- * @param string $branch [optional] The symbolic-ref to set
- *
- * @return bool
- */
- public function __invoke($name, $branch = null)
- {
- return $this->set($name, $branch);
- }
-
- /**
- * Sets the default branch for the named remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->head->set('origin');
- * ```
- *
- * @param string $name The remote name
- * @param string $branch [optional] The symbolic-ref to set
- *
- * @return bool
- */
- public function set($name, $branch)
- {
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-head')
- ->add($name);
-
- if ($branch) {
- $builder->add($branch);
- }
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * Deletes the default branch for the named remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->head->delete('origin');
- * ```
- *
- * @param string $name The remote name
- *
- * @return bool
- */
- public function delete($name)
- {
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-head')
- ->add($name)
- ->add('-d');
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * Determine the default branch by querying remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->head->remote('origin');
- * ```
- *
- * @param string $name The remote name
- *
- * @return bool
- */
- public function remote($name)
- {
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-head')
- ->add($name)
- ->add('-a');
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
-} \ No newline at end of file
diff --git a/library/kzykhys/git/src/PHPGit/Command/Remote/SetUrlCommand.php b/library/kzykhys/git/src/PHPGit/Command/Remote/SetUrlCommand.php
deleted file mode 100644
index 7b7d84ff5..000000000
--- a/library/kzykhys/git/src/PHPGit/Command/Remote/SetUrlCommand.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-
-namespace PHPGit\Command\Remote;
-
-use PHPGit\Command;
-use Symfony\Component\OptionsResolver\OptionsResolverInterface;
-
-/**
- * Changes URL remote points to
- *
- * @author Kazuyuki Hayashi
- */
-class SetUrlCommand extends Command
-{
-
- /**
- * Alias of set()
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->url('origin', 'https://github.com/text/Text.git');
- * ```
- *
- * ##### Options
- *
- * - **push** (_boolean_) Push URLs are manipulated instead of fetch URLs
- *
- * @param string $name The name of remote
- * @param string $newUrl The new URL
- * @param string $oldUrl [optional] The old URL
- * @param array $options [optional] An array of options {@see SetUrlCommand::setDefaultOptions}
- *
- * @return bool
- */
- public function __invoke($name, $newUrl, $oldUrl = null, array $options = array())
- {
- return $this->set($name, $newUrl, $oldUrl, $options);
- }
-
- /**
- * Sets the URL remote to $newUrl
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->url->set('origin', 'https://github.com/text/Text.git');
- * ```
- *
- * ##### Options
- *
- * - **push** (_boolean_) Push URLs are manipulated instead of fetch URLs
- *
- * @param string $name The name of remote
- * @param string $newUrl The new URL
- * @param string $oldUrl [optional] The old URL
- * @param array $options [optional] An array of options {@see SetUrlCommand::setDefaultOptions}
- *
- * @return bool
- */
- public function set($name, $newUrl, $oldUrl = null, array $options = array())
- {
- $options = $this->resolve($options);
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-url');
-
- $this->addFlags($builder, $options);
-
- $builder
- ->add($name)
- ->add($newUrl);
-
- if ($oldUrl) {
- $builder->add($oldUrl);
- }
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * Adds new URL to remote
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->url->add('origin', 'https://github.com/text/Text.git');
- * ```
- *
- * ##### Options
- *
- * - **push** (_boolean_) Push URLs are manipulated instead of fetch URLs
- *
- * @param string $name The name of remote
- * @param string $newUrl The new URL
- * @param array $options [optional] An array of options {@see SetUrlCommand::setDefaultOptions}
- *
- * @return bool
- */
- public function add($name, $newUrl, array $options = array())
- {
- $options = $this->resolve($options);
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-url')
- ->add('--add');
-
- $this->addFlags($builder, $options);
-
- $builder
- ->add($name)
- ->add($newUrl);
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * Deletes all URLs matching regex $url
- *
- * ``` php
- * $git = new PHPGit\Git();
- * $git->setRepository('/path/to/repo');
- * $git->remote->add('origin', 'https://github.com/kzykhys/Text.git');
- * $git->remote->url->delete('origin', 'https://github.com');
- * ```
- *
- * ##### Options
- *
- * - **push** (_boolean_) Push URLs are manipulated instead of fetch URLs
- *
- * @param string $name The remote name
- * @param string $url The URL to delete
- * @param array $options [optional] An array of options {@see SetUrlCommand::setDefaultOptions}
- *
- * @return bool
- */
- public function delete($name, $url, array $options = array())
- {
- $options = $this->resolve($options);
- $builder = $this->git->getProcessBuilder()
- ->add('remote')
- ->add('set-url')
- ->add('--delete');
-
- $this->addFlags($builder, $options);
-
- $builder
- ->add($name)
- ->add($url);
-
- $this->git->run($builder->getProcess());
-
- return true;
- }
-
- /**
- * {@inheritdoc}
- *
- * - **push** (_boolean_) Push URLs are manipulated instead of fetch URLs
- */
- public function setDefaultOptions(OptionsResolverInterface $resolver)
- {
- $resolver->setDefaults(array(
- 'push' => false
- ));
- }
-
-} \ No newline at end of file