Пример #1
0
 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();
     }
 }
Пример #2
0
 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);
     }
 }