Пример #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getArgument('path');
     $wc = new WorkingCopy($path);
     $wc->update();
     $output->writeln("'{$path}' updated");
 }
Пример #2
0
 /**
  * Performs an SVN cleanup
  */
 protected function doSVNCleanup()
 {
     $this->out($this->output, "Performing SVN cleanup...");
     $this->wc->cleanup($this->path);
     $this->out($this->output, "SVN cleanup performed");
 }
 /**
  * Get branch
  *
  * @param string          $current_branch Current branch
  * @param WorkingCopy     $wc             Working copy
  * @param OutputInterface $output         Output
  *
  * @return string
  */
 protected function getBranch($current_branch, WorkingCopy $wc, OutputInterface $output)
 {
     $branches_detail = $wc->getBranches();
     $branches = array("trunk");
     foreach ($branches_detail as $_branch) {
         $_branch_name = $_branch['name'];
         if ($_branch['name'] == $current_branch) {
             $_branch_name .= " (current)";
         }
         $branches[] = $_branch_name;
     }
     /** @var \Symfony\Component\Console\Helper\DialogHelper $dialog */
     $dialog = $this->getHelperSet()->get('dialog');
     $branch_index = $dialog->select($output, 'Which branch ?', $branches);
     if ($branch_index == 0) {
         return "trunk";
     }
     return $branches_detail[$branch_index - 1]["name"];
 }
 /**
  * @see parent::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $input->getOption('path');
     if (!is_dir($path)) {
         throw new InvalidArgumentException("'{$path}' is not a valid directory");
     }
     $wc = new WorkingCopy($path);
     $url = $wc->getURL();
     // Find the current branch name
     $current_branch = "trunk";
     $matches = array();
     if (preg_match("@/branches/(.*)@", $url, $matches)) {
         $current_branch = $matches[1];
     }
     $this->out($output, "Current branch: '<b>{$current_branch}</b>'");
     // Make GPL release.xml
     $dom_release = $this->getReleaseXML($wc, $path, $current_branch);
     file_put_contents("{$path}/release.xml", $dom_release->saveXML());
     $this->out($output, "release.xml file written in: '<b>{$path}/release.xml</b>'");
     $wc->add(array("{$path}/release.xml"));
     $this->out($output, "'<b>{$path}/release.xml</b>' added to version control");
     $other = $input->getOption("other");
     if ($other) {
         $base_path = dirname($other);
         $add_files = array();
         $other_wc = new WorkingCopy($base_path);
         $other_url = $other_wc->getURL();
         // Find the current branch name
         $other_branch = "trunk";
         $matches = array();
         if (preg_match("@/branches/(.*)/@", $other_url, $matches)) {
             $other_branch = $matches[1];
         }
         if ($other_branch != $current_branch) {
             $this->out($output, "<error>WARNING: current branch ({$current_branch}) is not the same as other branch ({$other_branch})</error>");
             return;
         }
         $list = glob($other);
         foreach ($list as $_path) {
             $_dom_release = $this->getReleaseXML($other_wc, $_path, $other_branch);
             file_put_contents("{$_path}/release.xml", $_dom_release->saveXML());
             $add_files[] = "{$_path}/release.xml";
             $this->out($output, "release.xml file written in: '<b>{$_path}/release.xml</b>'");
         }
         $other_wc->add($add_files);
         $this->out($output, count($add_files) . " files added to version control, <b>ready to commit</b> !");
     }
 }