protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Tag($dialoger); $tag = $picker->pickOne('Pick one tag to <b>checkout</b>:'); $dialoger->runGit('checkout ' . $tag); $dialoger->dialogInfo('HEAD is now on tag <b>' . $tag . '</b>'); }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Stash($dialoger); $stash = $picker->pickOne('Pick one stash to <b>apply</b>:'); $dialoger->dialogConfirm('Are you sure that you wish to <b>apply</b> this stash?\\n\\n' . $stash); $dialoger->runGit('stash apply "' . $stash . '"'); }
protected function run(\DialoGit\Dialoger $dialoger) { $remotesPicker = new \DialoGit\Picker\Remote($dialoger); $remote = $remotesPicker->pickOne('Pick one remote repository from to <b>pull</b>:'); $branchesPicker = new \DialoGit\Picker\Branch($dialoger); $branch = $branchesPicker->pickOne('Pick one branch to <b>pull</b>:'); $dialoger->runGitOnNewShell('pull ' . $remote . ' ' . $branch); }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $currentBranch = $picker->getCurrent(); $branch = $picker->pickOneBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one branch to <b>checkout</b>:', $currentBranch); $dialoger->runGit('checkout ' . $branch); $dialoger->dialogInfo('HEAD is now on branch <b>' . $branch . '</b>'); }
protected function run(\DialoGit\Dialoger $dialoger) { $params = new \DialoGit\ScriptParams(); $files = $params->requireSelectedFiles(); $quotedFiles = $params->requireSelectedFilesQuoted(); $thisThese = count($files) == 1 ? 'this file' : 'these files'; $dialoger->dialogConfirm('Are you sure you want to <b>delete</b> the <b>staged changes</b> for ' . $thisThese . '?\\n\\n' . addslashes(implode('\\n', $files))); $dialoger->runGit('checkout -- ' . implode(' ', $quotedFiles)); }
protected function run(\DialoGit\Dialoger $dialoger) { $params = new \DialoGit\ScriptParams(); $files = $params->requireSelectedFiles(); $quotedFiles = $params->requireSelectedFilesQuoted(); $fileFiles = count($files) == 1 ? 'this file' : 'these files'; $dialoger->dialogConfirm('Do you wish to <b>remove</b> ' . $fileFiles . ' from the <b>git repository</b> and from the <b>disk</b> for sure?\\n\\n' . addslashes(implode('\\n', $files))); $dialoger->runGit('rm -r -f ' . implode(' ', $quotedFiles)); }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Stash($dialoger); $stashes = $picker->pickMany('Pick one or more stashes to <b>drop</b>:'); $thisThese = count($stashes) == 1 ? 'this stash' : 'these stashes'; $dialoger->dialogConfirm('Do you wish to <b>drop</b> ' . $thisThese . ' for sure?\\n\\n' . implode("\n", $stashes)); foreach ($stashes as $stash) { $dialoger->runGit('stash drop "' . $stash . '"'); } }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Remote($dialoger); $remotes = $picker->pickMany('Select one or more remote repositories to <b>remove</b>:'); $thisThese = count($remotes) == 1 ? 'this remote repository' : 'these remote repositories'; $dialoger->dialogConfirm('Do you wish to <b>remove</b> ' . $thisThese . ' for sure?\\n\\n' . implode("\n", $remotes)); foreach ($remotes as $remote) { $dialoger->runGit('remote remove ' . $remote); } }
protected function run(\DialoGit\Dialoger $dialoger) { $remotesPicker = new \DialoGit\Picker\Remote($dialoger); $remotes = $remotesPicker->pickMany('Pick one or more remotes repositories on to <b>push</b>:'); $tagsPicker = new \DialoGit\Picker\Tag($dialoger); $tags = $tagsPicker->pickMany('Pick one or more tags to <b>push</b>:'); foreach ($remotes as $remote) { foreach ($tags as $tag) { $dialoger->runGitOnNewShell('push ' . $remote . ' ' . $tag); sleep(1); } } }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $branches = $picker->getStructures(); if (count($branches) == 1) { $dialoger->dialogError('There is only one local branch right now.'); $dialoger->error(); } $currentBranch = $picker->getCurrent(); $branches = $picker->pickManyBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one or more local branches to <b>delete</b>:', $currentBranch); $thisThese = count($branches) == 1 ? 'this local branch' : 'these local branches'; $dialoger->dialogConfirm('Do you wish to <b>delete</b> ' . $thisThese . ' for sure?\\n\\n' . implode("\n", $branches)); foreach ($branches as $branch) { $dialoger->runGit('branch -d ' . $branch); } }
protected function run(\DialoGit\Dialoger $dialoger) { $buffer = new \DialoGit\Buffer(DIALOGIT_BUFFER_FILE_MV); if ($buffer->exists()) { // To $files = $buffer->getFiles(); foreach ($files as $file) { $dialoger->runGit('mv ' . $file . ' .'); } $buffer->remove(); } else { // From $params = new \DialoGit\ScriptParams(); $files = $params->requireSelectedFilesQuoted(); $buffer->saveFiles($files); } }
private function makeStructures() { $listResult = $this->dialoger->runGit($this->getGitListCommand()); $lines = $this->parseOutputAsArray($listResult->getStdOut()); $result = []; foreach ($lines as $line) { if ($this->isListOutputLineValid($line)) { $result[] = $this->parseListOutputLine($line); } } if (empty($result)) { $message = $this->getNoneHasBeenFoundExceptionMessage(); throw new \DialoGit\Exception($message); } return $result; }
protected function run(\DialoGit\Dialoger $dialoger) { $newBranch = $dialoger->dialogInput('New branch name:'); $picker = new \DialoGit\Picker\Branch($dialoger); $currentBranch = $picker->getCurrent(); $dialoger->runGit('branch ' . $newBranch); if ($dialoger->dialogQuestion('HEAD is on <b>' . $currentBranch . '</b>\\n\\nDo you want to checkout the new branch now?')) { $dialoger->runGit('checkout ' . $newBranch); $dialoger->dialogInfo('HEAD is now on branch <b>' . $newBranch . '</b>'); } }
protected function run(\DialoGit\Dialoger $dialoger) { $picker = new \DialoGit\Picker\Branch($dialoger); $branches = $picker->getStructures(); if (count($branches) == 1) { $dialoger->dialogError('There is only one local branch right now.'); $dialoger->error(); } $currentBranch = $picker->getCurrent(); if ($picker->isHeadOnBranch()) { $branch = $picker->pickOneBut('HEAD is on <b>' . $currentBranch . '</b>\\n\\nPick one local branch to <b>merge</b> with:', $currentBranch); $dialoger->dialogConfirm('Do you want to modify <b>' . $currentBranch . '</b> by merging the contents of <b>' . $branch . '</b> into it?'); $dialoger->runGit('merge ' . $branch); } else { $dialoger->dialogError('Merge requires HEAD to be on a branch, but HEAD is on <b>' . $currentBranch . '</b>, which is not a branch.'); $dialoger->error(); } }
protected function run(\DialoGit\Dialoger $dialoger) { $header = $dialoger->dialogInput('New commit header:'); $dialoger->runGit('commit -m "' . $header . '"'); }
protected function run(\DialoGit\Dialoger $dialoger) { $dialoger->run('gitg'); }
protected function run(\DialoGit\Dialoger $dialoger) { $repositoryDir = $this->params->getGitRepositoryBaseDir(); $dialoger->dialogConfirm('Are you sure you want to <b>delete</b> the <b>staged changes</b> for the Git repository base directory?\\n\\n' . $repositoryDir); $dialoger->runGit('checkout -- ' . $repositoryDir); }
protected function run(\DialoGit\Dialoger $dialoger) { $dialoger->runGitOnNewShell('status'); }
protected function run(\DialoGit\Dialoger $dialoger) { $url = $dialoger->dialogInput('URL to clone:'); $dialoger->runGitOnNewShell('clone ' . $url); }
protected function run(\DialoGit\Dialoger $dialoger) { $name = $dialoger->dialogInput('New remote repository name:'); $url = $dialoger->dialogInput('New remote repository URL:'); $dialoger->runGit('remote add ' . $name . ' ' . $url); }
protected function run(\DialoGit\Dialoger $dialoger) { $params = new \DialoGit\ScriptParams(); $files = $params->requireSelectedFilesQuoted(); $dialoger->runGit('add ' . implode(' ', $files)); }
protected function run(\DialoGit\Dialoger $dialoger) { $repositoryDir = $this->params->getGitRepositoryBaseDir(); $dialoger->runGit('add "' . $repositoryDir . '"'); }
protected function run(\DialoGit\Dialoger $dialoger) { $name = $dialoger->dialogInput('New tag name:'); $message = $dialoger->dialogInput('New tag message:'); $dialoger->runGit('tag -m "' . $message . '" "' . $name . '"'); }
protected function run(\DialoGit\Dialoger $dialoger) { $dialoger->dialogConfirm('Are you sure you want to <b>delete</b> the <b>staged changes</b> for this directory?\\n\\n' . $this->params->getWorkingDir()); $dialoger->runGit('checkout -- .'); }
protected function run(\DialoGit\Dialoger $dialoger) { $dialoger->runGit('add .'); }
protected function run(\DialoGit\Dialoger $dialoger) { $dialoger->runGitOnNewShell('mergetool'); }
protected function run(\DialoGit\Dialoger $dialoger) { $message = $dialoger->dialogInput('New stash message:'); $dialoger->runGit('stash save "' . $message . '"'); }