protected function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('path'); $wc = new WorkingCopy($path); $wc->update(); $output->writeln("'{$path}' updated"); }
/** * Performs an SVN update * * @throws Exception */ protected function update() { $wc = new WorkingCopy($this->path); $this->out($this->output, "Checking SVN status..."); $out = $wc->status(".", $this->ignore_externals); if ($out) { $this->out($this->output, "<info>SVN status checked</info>"); $modified_files = $this->getModifiedFilesByXML($out); if ($modified_files) { $this->out($this->output, "<comment>These files are modified locally:</comment>"); foreach ($modified_files as $_file) { $this->output->writeln("- <fg=red;>{$_file}</fg=red;>"); } $dialog = $this->getHelperSet()->get('dialog'); if (!$dialog->askConfirmation($this->output, '<question>In order to update, you need to revert these files, otherwise update will be skipped. Revert? [Y/n]</question> ', true)) { return false; } // Files have to be reverted $this->out($this->output, "Reverting files..."); // /!\ Long list may handle an exception $wc->revert($modified_files); $this->out($this->output, "<info>Files reverted</info>"); } } // SVN update $this->out($this->output, "SVN update in progress..."); $wc->update(array(), "HEAD"); $this->out($this->output, "<info>SVN update completed</info>\n"); // SVN status file writing $this->writeSVNStatusFile(); }