@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function setCache($name, $value, $invalidator = null, $duration = null) |
| 45 | 45 | { |
| 46 | - if ( is_numeric($duration) ) { |
|
| 46 | + if (is_numeric($duration)) { |
|
| 47 | 47 | $duration .= ' seconds'; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | $storage = $this->_getStorage($name); |
| 70 | 70 | $cache = $storage->get(); |
| 71 | 71 | |
| 72 | - if ( !is_array($cache) || $cache['invalidator'] !== $invalidator ) { |
|
| 72 | + if (!is_array($cache) || $cache['invalidator'] !== $invalidator) { |
|
| 73 | 73 | $storage->invalidate(); |
| 74 | 74 | |
| 75 | 75 | return null; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ( $cache['expiration'] && $cache['expiration'] < time() ) { |
|
| 78 | + if ($cache['expiration'] && $cache['expiration'] < time()) { |
|
| 79 | 79 | $storage->invalidate(); |
| 80 | 80 | |
| 81 | 81 | return null; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $parts = explode(':', $name, 2); |
| 98 | 98 | |
| 99 | - if ( count($parts) != 2 ) { |
|
| 99 | + if (count($parts) != 2) { |
|
| 100 | 100 | throw new \InvalidArgumentException('The $name parameter must be in "namespace:name" format.'); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function get() |
| 43 | 43 | { |
| 44 | - if ( !file_exists($this->_file) ) { |
|
| 44 | + if (!file_exists($this->_file)) { |
|
| 45 | 45 | return null; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $file_contents = file_get_contents($this->_file); |
| 49 | 49 | |
| 50 | - if ( strpos($this->_file, '/log_') !== false ) { |
|
| 50 | + if (strpos($this->_file, '/log_') !== false) { |
|
| 51 | 51 | $file_contents = gzuncompress($file_contents); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $cache = json_decode($file_contents, true); |
| 55 | 55 | |
| 56 | - if ( $cache ) { |
|
| 56 | + if ($cache) { |
|
| 57 | 57 | return $cache; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $file_contents = json_encode($cache); |
| 73 | 73 | |
| 74 | - if ( strpos($this->_file, '/log_') !== false ) { |
|
| 74 | + if (strpos($this->_file, '/log_') !== false) { |
|
| 75 | 75 | $file_contents = gzcompress($file_contents); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function invalidate() |
| 87 | 87 | { |
| 88 | - if ( file_exists($this->_file) ) { |
|
| 88 | + if (file_exists($this->_file)) { |
|
| 89 | 89 | unlink($this->_file); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function _getConfigSetting($name) |
| 127 | 127 | { |
| 128 | - if ( !($this instanceof IConfigAwareCommand) ) { |
|
| 128 | + if (!($this instanceof IConfigAwareCommand)) { |
|
| 129 | 129 | throw new \LogicException('Command does not have any settings.'); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - foreach ( $this->getConfigSettings() as $config_setting ) { |
|
| 133 | - if ( $config_setting->getName() === $name ) { |
|
| 134 | - if ( $config_setting->isWithinScope(AbstractConfigSetting::SCOPE_WORKING_COPY) ) { |
|
| 132 | + foreach ($this->getConfigSettings() as $config_setting) { |
|
| 133 | + if ($config_setting->getName() === $name) { |
|
| 134 | + if ($config_setting->isWithinScope(AbstractConfigSetting::SCOPE_WORKING_COPY)) { |
|
| 135 | 135 | $config_setting->setWorkingCopyUrl($this->getWorkingCopyUrl()); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | protected function getConfigScope($is_global) |
| 155 | 155 | { |
| 156 | - if ( $is_global ) { |
|
| 156 | + if ($is_global) { |
|
| 157 | 157 | return 'global-settings.'; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | protected function getRevisionLog($repository_url) |
| 175 | 175 | { |
| 176 | - if ( !isset($this->_revisionLogs[$repository_url]) ) { |
|
| 176 | + if (!isset($this->_revisionLogs[$repository_url])) { |
|
| 177 | 177 | $this->_revisionLogs[$repository_url] = $this->_revisionLogFactory->getRevisionLog($repository_url); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | { |
| 214 | 214 | $path = $this->getPath(); |
| 215 | 215 | |
| 216 | - if ( !in_array($path, $this->_workingCopyPaths) ) { |
|
| 217 | - if ( !$this->repositoryConnector->isUrl($path) |
|
| 216 | + if (!in_array($path, $this->_workingCopyPaths)) { |
|
| 217 | + if (!$this->repositoryConnector->isUrl($path) |
|
| 218 | 218 | && !$this->repositoryConnector->isWorkingCopy($path) |
| 219 | 219 | ) { |
| 220 | 220 | throw new \RuntimeException('The "' . $path . '" isn\'t a working copy.'); |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | $path = $this->io->getArgument('path'); |
| 238 | 238 | |
| 239 | - if ( !$this->repositoryConnector->isUrl($path) ) { |
|
| 239 | + if (!$this->repositoryConnector->isUrl($path)) { |
|
| 240 | 240 | $path = realpath($path); |
| 241 | 241 | } |
| 242 | - elseif ( !$this->pathAcceptsUrl ) { |
|
| 242 | + elseif (!$this->pathAcceptsUrl) { |
|
| 243 | 243 | throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -238,8 +238,7 @@ |
||
| 238 | 238 | |
| 239 | 239 | if ( !$this->repositoryConnector->isUrl($path) ) { |
| 240 | 240 | $path = realpath($path); |
| 241 | - } |
|
| 242 | - elseif ( !$this->pathAcceptsUrl ) { |
|
| 241 | + } elseif ( !$this->pathAcceptsUrl ) { |
|
| 243 | 242 | throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); |
| 244 | 243 | } |
| 245 | 244 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $ret = parent::completeArgumentValues($argumentName, $context); |
| 99 | 99 | |
| 100 | - if ( $argumentName == 'sub-command' ) { |
|
| 100 | + if ($argumentName == 'sub-command') { |
|
| 101 | 101 | return $this->getSubCommands(); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $ret = array(); |
| 115 | 115 | |
| 116 | - foreach ( $this->getApplication()->all() as $command ) { |
|
| 117 | - if ( $command instanceof IAggregatorAwareCommand ) { |
|
| 116 | + foreach ($this->getApplication()->all() as $command) { |
|
| 117 | + if ($command instanceof IAggregatorAwareCommand) { |
|
| 118 | 118 | $ret[] = $command->getName(); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $sub_command = $this->io->getArgument('sub-command'); |
| 131 | 131 | |
| 132 | - if ( !in_array($sub_command, $this->getSubCommands()) ) { |
|
| 132 | + if (!in_array($sub_command, $this->getSubCommands())) { |
|
| 133 | 133 | throw new \RuntimeException( |
| 134 | 134 | 'The "' . $sub_command . '" sub-command is unknown or doesn\'t support aggregation.' |
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if ( $this->processIgnoreAdd() || $this->processIgnoreRemove() || $this->processIgnoreShow() ) { |
|
| 138 | + if ($this->processIgnoreAdd() || $this->processIgnoreRemove() || $this->processIgnoreShow()) { |
|
| 139 | 139 | return; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $raw_ignore_add = $this->io->getOption('ignore-add'); |
| 155 | 155 | |
| 156 | - if ( $raw_ignore_add === null ) { |
|
| 156 | + if ($raw_ignore_add === null) { |
|
| 157 | 157 | return false; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $ignored = $this->getIgnored(); |
| 161 | 161 | $ignore_add = realpath($this->getPath() . '/' . $raw_ignore_add); |
| 162 | 162 | |
| 163 | - if ( $ignore_add === false ) { |
|
| 163 | + if ($ignore_add === false) { |
|
| 164 | 164 | throw new CommandException('The "' . $raw_ignore_add . '" path does not exist.'); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( in_array($ignore_add, $ignored) ) { |
|
| 167 | + if (in_array($ignore_add, $ignored)) { |
|
| 168 | 168 | throw new CommandException('The "' . $ignore_add . '" directory is already ignored.'); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -184,18 +184,18 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | $raw_ignore_remove = $this->io->getOption('ignore-remove'); |
| 186 | 186 | |
| 187 | - if ( $raw_ignore_remove === null ) { |
|
| 187 | + if ($raw_ignore_remove === null) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $ignored = $this->getIgnored(); |
| 192 | 192 | $ignore_remove = realpath($this->getPath() . '/' . $raw_ignore_remove); |
| 193 | 193 | |
| 194 | - if ( $ignore_remove === false ) { |
|
| 194 | + if ($ignore_remove === false) { |
|
| 195 | 195 | throw new CommandException('The "' . $raw_ignore_remove . '" path does not exist.'); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( !in_array($ignore_remove, $ignored) ) { |
|
| 198 | + if (!in_array($ignore_remove, $ignored)) { |
|
| 199 | 199 | throw new CommandException('The "' . $ignore_remove . '" directory is not ignored.'); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function processIgnoreShow() |
| 214 | 214 | { |
| 215 | - if ( !$this->io->getOption('ignore-show') ) { |
|
| 215 | + if (!$this->io->getOption('ignore-show')) { |
|
| 216 | 216 | return false; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $ignored = $this->getIgnored(); |
| 220 | 220 | |
| 221 | - if ( !$ignored ) { |
|
| 221 | + if (!$ignored) { |
|
| 222 | 222 | $this->io->writeln('No paths found in ignored directory list.'); |
| 223 | 223 | |
| 224 | 224 | return true; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $this->io->writeln(array('Paths in ignored directory list:', '')); |
| 228 | 228 | |
| 229 | - foreach ( $ignored as $ignored_path ) { |
|
| 229 | + foreach ($ignored as $ignored_path) { |
|
| 230 | 230 | $this->io->writeln(' * ' . $ignored_path); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | { |
| 258 | 258 | $path = $this->getPath(); |
| 259 | 259 | |
| 260 | - if ( $this->repositoryConnector->isWorkingCopy($path) ) { |
|
| 260 | + if ($this->repositoryConnector->isWorkingCopy($path)) { |
|
| 261 | 261 | throw new \RuntimeException('The "' . $path . '" must not be a working copy.'); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $with_details = $this->io->getOption('details'); |
| 271 | 271 | $with_summary = $this->io->getOption('summary'); |
| 272 | 272 | |
| 273 | - foreach ( $working_copies as $index => $wc_path ) { |
|
| 273 | + foreach ($working_copies as $index => $wc_path) { |
|
| 274 | 274 | $this->io->writeln(array( |
| 275 | 275 | '', |
| 276 | 276 | 'Executing <info>' . $sub_command . '</info> command on <info>' . $wc_path . '</info> path', |
@@ -281,11 +281,11 @@ discard block |
||
| 281 | 281 | 'path' => $wc_path, |
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | - if ( $with_details && in_array($sub_command, array('log', 'merge')) ) { |
|
| 284 | + if ($with_details && in_array($sub_command, array('log', 'merge'))) { |
|
| 285 | 285 | $sub_command_arguments['--details'] = $with_details; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if ( $with_summary && in_array($sub_command, array('log', 'merge')) ) { |
|
| 288 | + if ($with_summary && in_array($sub_command, array('log', 'merge'))) { |
|
| 289 | 289 | $sub_command_arguments['--summary'] = $with_summary; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | $all_working_copies_count = count($all_working_copies); |
| 316 | 316 | $working_copies_count = count($working_copies); |
| 317 | 317 | |
| 318 | - if ( $all_working_copies_count != $working_copies_count ) { |
|
| 318 | + if ($all_working_copies_count != $working_copies_count) { |
|
| 319 | 319 | $ignored_suffix = ' (' . ($all_working_copies_count - $working_copies_count) . ' ignored)'; |
| 320 | 320 | } |
| 321 | 321 | else { |
| 322 | 322 | $ignored_suffix = ''; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( !$working_copies ) { |
|
| 325 | + if (!$working_copies) { |
|
| 326 | 326 | $this->io->writeln('<error>None found' . $ignored_suffix . '</error>'); |
| 327 | 327 | |
| 328 | 328 | throw new CommandException('No working copies found at "' . $path . '" path.'); |
@@ -344,18 +344,18 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | $working_copies = array(); |
| 346 | 346 | |
| 347 | - if ( $this->io->isVerbose() ) { |
|
| 347 | + if ($this->io->isVerbose()) { |
|
| 348 | 348 | $this->io->writeln( |
| 349 | 349 | PHP_EOL . '<fg=white;bg=magenta>scanning: ' . $path . '</>' |
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - foreach ( glob($path . '/*', GLOB_ONLYDIR) as $sub_folder ) { |
|
| 354 | - if ( file_exists($sub_folder . '/.git') || file_exists($sub_folder . '/CVS') ) { |
|
| 353 | + foreach (glob($path . '/*', GLOB_ONLYDIR) as $sub_folder) { |
|
| 354 | + if (file_exists($sub_folder . '/.git') || file_exists($sub_folder . '/CVS')) { |
|
| 355 | 355 | continue; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - if ( $this->repositoryConnector->isWorkingCopy($sub_folder) ) { |
|
| 358 | + if ($this->repositoryConnector->isWorkingCopy($sub_folder)) { |
|
| 359 | 359 | $working_copies[] = $sub_folder; |
| 360 | 360 | } |
| 361 | 361 | else { |
@@ -317,8 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | if ( $all_working_copies_count != $working_copies_count ) { |
| 319 | 319 | $ignored_suffix = ' (' . ($all_working_copies_count - $working_copies_count) . ' ignored)'; |
| 320 | - } |
|
| 321 | - else { |
|
| 320 | + } else { |
|
| 322 | 321 | $ignored_suffix = ''; |
| 323 | 322 | } |
| 324 | 323 | |
@@ -357,8 +356,7 @@ discard block |
||
| 357 | 356 | |
| 358 | 357 | if ( $this->repositoryConnector->isWorkingCopy($sub_folder) ) { |
| 359 | 358 | $working_copies[] = $sub_folder; |
| 360 | - } |
|
| 361 | - else { |
|
| 359 | + } else { |
|
| 362 | 360 | $working_copies = array_merge($working_copies, $this->getWorkingCopiesRecursive($sub_folder)); |
| 363 | 361 | } |
| 364 | 362 | } |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | $wc_path = $this->getWorkingCopyPath(); |
| 87 | 87 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
| 88 | 88 | |
| 89 | - if ( $conflicts ) { |
|
| 89 | + if ($conflicts) { |
|
| 90 | 90 | throw new CommandException('Conflicts detected. Please resolve them before committing.'); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $working_copy_status = $this->repositoryConnector->getCompactWorkingCopyStatus($wc_path, false); |
| 94 | 94 | |
| 95 | - if ( !$working_copy_status ) { |
|
| 95 | + if (!$working_copy_status) { |
|
| 96 | 96 | throw new CommandException('Nothing to commit.'); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $stop_line_pos = strpos($edited_commit_message, self::STOP_LINE); |
| 108 | 108 | |
| 109 | - if ( $stop_line_pos !== false ) { |
|
| 109 | + if ($stop_line_pos !== false) { |
|
| 110 | 110 | $edited_commit_message = trim(substr($edited_commit_message, 0, $stop_line_pos)); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $this->io->writeln(array('<fg=white;options=bold>Commit message:</>', $edited_commit_message, '')); |
| 114 | 114 | |
| 115 | - if ( !$this->io->askConfirmation('Run "svn commit"', false) ) { |
|
| 115 | + if (!$this->io->askConfirmation('Run "svn commit"', false)) { |
|
| 116 | 116 | throw new CommandException('Commit aborted by user.'); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $merged_revisions = $this->getFreshMergedRevisions($wc_path); |
| 150 | 150 | |
| 151 | - if ( !$merged_revisions ) { |
|
| 151 | + if (!$merged_revisions) { |
|
| 152 | 152 | return ''; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
| 157 | 157 | $repository_url = $this->removePathFromURL($wc_url); |
| 158 | 158 | |
| 159 | - foreach ( $merged_revisions as $path => $revisions ) { |
|
| 159 | + foreach ($merged_revisions as $path => $revisions) { |
|
| 160 | 160 | $merged_messages = array(); |
| 161 | 161 | $revision_log = $this->getRevisionLog($repository_url . $path); |
| 162 | 162 | $commit_message .= 'Merging from ' . ucfirst(basename($path)) . ' to ' . ucfirst(basename($wc_url)) . PHP_EOL; |
| 163 | 163 | |
| 164 | - foreach ( $revisions as $revision ) { |
|
| 164 | + foreach ($revisions as $revision) { |
|
| 165 | 165 | $revision_data = $revision_log->getRevisionData('summary', $revision); |
| 166 | 166 | $merged_messages[] = ' * r' . $revision . ': ' . $revision_data['msg']; |
| 167 | 167 | } |
@@ -200,18 +200,18 @@ discard block |
||
| 200 | 200 | $old_paths = $this->getMergedRevisions($wc_path, 'BASE'); |
| 201 | 201 | $new_paths = $this->getMergedRevisions($wc_path); |
| 202 | 202 | |
| 203 | - if ( $old_paths === $new_paths ) { |
|
| 203 | + if ($old_paths === $new_paths) { |
|
| 204 | 204 | return array(); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - foreach ( $new_paths as $new_path => $new_merged_revisions ) { |
|
| 208 | - if ( !isset($old_paths[$new_path]) ) { |
|
| 207 | + foreach ($new_paths as $new_path => $new_merged_revisions) { |
|
| 208 | + if (!isset($old_paths[$new_path])) { |
|
| 209 | 209 | // Merge from new path. |
| 210 | 210 | $final_paths[$new_path] = $this->_revisionListParser->expandRanges( |
| 211 | 211 | explode(',', $new_merged_revisions) |
| 212 | 212 | ); |
| 213 | 213 | } |
| 214 | - elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 214 | + elseif ($new_merged_revisions != $old_paths[$new_path]) { |
|
| 215 | 215 | // Merge on existing path. |
| 216 | 216 | $new_merged_revisions_parsed = $this->_revisionListParser->expandRanges( |
| 217 | 217 | explode(',', $new_merged_revisions) |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $merge_info = $this->repositoryConnector->getProperty('svn:mergeinfo', $wc_path, $revision); |
| 244 | 244 | $merge_info = array_filter(explode("\n", $merge_info)); |
| 245 | 245 | |
| 246 | - foreach ( $merge_info as $merge_info_line ) { |
|
| 246 | + foreach ($merge_info as $merge_info_line) { |
|
| 247 | 247 | list($path, $revisions) = explode(':', $merge_info_line, 2); |
| 248 | 248 | $paths[$path] = $revisions; |
| 249 | 249 | } |
@@ -210,8 +210,7 @@ |
||
| 210 | 210 | $final_paths[$new_path] = $this->_revisionListParser->expandRanges( |
| 211 | 211 | explode(',', $new_merged_revisions) |
| 212 | 212 | ); |
| 213 | - } |
|
| 214 | - elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 213 | + } elseif ( $new_merged_revisions != $old_paths[$new_path] ) { |
|
| 215 | 214 | // Merge on existing path. |
| 216 | 215 | $new_merged_revisions_parsed = $this->_revisionListParser->expandRanges( |
| 217 | 216 | explode(',', $new_merged_revisions) |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $ret = parent::completeOptionValues($optionName, $context); |
| 123 | 123 | |
| 124 | - if ( in_array($optionName, array('show', 'edit', 'delete')) ) { |
|
| 124 | + if (in_array($optionName, array('show', 'edit', 'delete'))) { |
|
| 125 | 125 | return array_keys($this->configSettings); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected function execute(InputInterface $input, OutputInterface $output) |
| 135 | 135 | { |
| 136 | - if ( $this->processShow() || $this->processEdit() || $this->processDelete() ) { |
|
| 136 | + if ($this->processShow() || $this->processEdit() || $this->processDelete()) { |
|
| 137 | 137 | return; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $setting_name = $this->io->getOption('show'); |
| 151 | 151 | |
| 152 | - if ( $setting_name === null ) { |
|
| 152 | + if ($setting_name === null) { |
|
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $setting_name = $this->io->getOption('edit'); |
| 169 | 169 | |
| 170 | - if ( $setting_name === null ) { |
|
| 170 | + if ($setting_name === null) { |
|
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $value = $config_setting->getValue($this->getValueFilter()); |
| 176 | 176 | $retry = false; |
| 177 | 177 | |
| 178 | - if ( $config_setting instanceof ArrayConfigSetting ) { |
|
| 178 | + if ($config_setting instanceof ArrayConfigSetting) { |
|
| 179 | 179 | $value = implode(PHP_EOL, $value); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -186,14 +186,14 @@ discard block |
||
| 186 | 186 | $config_setting->setValue($value, $this->getScopeFilter()); |
| 187 | 187 | $this->io->writeln('Setting <info>' . $setting_name . '</info> was edited.'); |
| 188 | 188 | } |
| 189 | - catch ( \InvalidArgumentException $e ) { |
|
| 189 | + catch (\InvalidArgumentException $e) { |
|
| 190 | 190 | $this->io->writeln(array('<error>' . $e->getMessage() . '</error>', '')); |
| 191 | 191 | |
| 192 | - if ( $this->io->askConfirmation('Retry editing', false) ) { |
|
| 192 | + if ($this->io->askConfirmation('Retry editing', false)) { |
|
| 193 | 193 | $retry = true; |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - } while ( $retry ); |
|
| 196 | + } while ($retry); |
|
| 197 | 197 | |
| 198 | 198 | return true; |
| 199 | 199 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | { |
| 223 | 223 | $setting_name = $this->io->getOption('delete'); |
| 224 | 224 | |
| 225 | - if ( $setting_name === null ) { |
|
| 225 | + if ($setting_name === null) { |
|
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function listSettings($setting_name = null) |
| 244 | 244 | { |
| 245 | - if ( isset($setting_name) ) { |
|
| 245 | + if (isset($setting_name)) { |
|
| 246 | 246 | $this->getConfigSetting($setting_name); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $extra_title = isset($setting_name) ? ' (filtered)' : ''; |
| 250 | 250 | |
| 251 | - if ( $this->isGlobal() ) { |
|
| 251 | + if ($this->isGlobal()) { |
|
| 252 | 252 | $this->io->writeln('Showing global settings' . $extra_title . ':'); |
| 253 | 253 | } |
| 254 | 254 | else { |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | $value_filter = $this->getValueFilter(); |
| 268 | 268 | |
| 269 | - foreach ( $this->getConfigSettingsByScope($this->getScopeFilter()) as $name => $config_setting ) { |
|
| 270 | - if ( isset($setting_name) && $name !== $setting_name ) { |
|
| 269 | + foreach ($this->getConfigSettingsByScope($this->getScopeFilter()) as $name => $config_setting) { |
|
| 270 | + if (isset($setting_name) && $name !== $setting_name) { |
|
| 271 | 271 | continue; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | { |
| 292 | 292 | $ret = array(); |
| 293 | 293 | |
| 294 | - foreach ( $this->configSettings as $name => $config_setting ) { |
|
| 295 | - if ( $config_setting->isWithinScope($scope_filter) ) { |
|
| 294 | + foreach ($this->configSettings as $name => $config_setting) { |
|
| 295 | + if ($config_setting->isWithinScope($scope_filter)) { |
|
| 296 | 296 | $ret[$name] = $config_setting; |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -310,13 +310,13 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | protected function getConfigSetting($name) |
| 312 | 312 | { |
| 313 | - if ( !array_key_exists($name, $this->configSettings) ) { |
|
| 313 | + if (!array_key_exists($name, $this->configSettings)) { |
|
| 314 | 314 | throw new \InvalidArgumentException('The "' . $name . '" setting is unknown.'); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | $config_setting = $this->configSettings[$name]; |
| 318 | 318 | |
| 319 | - if ( !$config_setting->isWithinScope($this->getScopeFilter()) ) { |
|
| 319 | + if (!$config_setting->isWithinScope($this->getScopeFilter())) { |
|
| 320 | 320 | throw new \InvalidArgumentException('The "' . $name . '" setting cannot be used in this scope.'); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -353,9 +353,9 @@ discard block |
||
| 353 | 353 | /** @var AbstractConfigSetting[] $config_settings */ |
| 354 | 354 | $config_settings = array(); |
| 355 | 355 | |
| 356 | - foreach ( $this->getApplication()->all() as $command ) { |
|
| 357 | - if ( $command instanceof IConfigAwareCommand ) { |
|
| 358 | - foreach ( $command->getConfigSettings() as $config_setting ) { |
|
| 356 | + foreach ($this->getApplication()->all() as $command) { |
|
| 357 | + if ($command instanceof IConfigAwareCommand) { |
|
| 358 | + foreach ($command->getConfigSettings() as $config_setting) { |
|
| 359 | 359 | $config_settings[$config_setting->getName()] = $config_setting; |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | // Allow to operate on global settings outside of working copy. |
| 365 | 365 | $wc_url = $this->isGlobal() ? '' : $this->getWorkingCopyUrl(); |
| 366 | 366 | |
| 367 | - foreach ( $config_settings as $config_setting ) { |
|
| 367 | + foreach ($config_settings as $config_setting) { |
|
| 368 | 368 | $config_setting->setWorkingCopyUrl($wc_url); |
| 369 | 369 | $config_setting->setEditor($this->_configEditor); |
| 370 | 370 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | protected function isGlobal() |
| 381 | 381 | { |
| 382 | 382 | // During auto-complete the IO isn't set. |
| 383 | - if ( !isset($this->io) ) { |
|
| 383 | + if (!isset($this->io)) { |
|
| 384 | 384 | return true; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -185,8 +185,7 @@ discard block |
||
| 185 | 185 | $value = $this->openEditor($value); |
| 186 | 186 | $config_setting->setValue($value, $this->getScopeFilter()); |
| 187 | 187 | $this->io->writeln('Setting <info>' . $setting_name . '</info> was edited.'); |
| 188 | - } |
|
| 189 | - catch ( \InvalidArgumentException $e ) { |
|
| 188 | + } catch ( \InvalidArgumentException $e ) { |
|
| 190 | 189 | $this->io->writeln(array('<error>' . $e->getMessage() . '</error>', '')); |
| 191 | 190 | |
| 192 | 191 | if ( $this->io->askConfirmation('Retry editing', false) ) { |
@@ -250,8 +249,7 @@ discard block |
||
| 250 | 249 | |
| 251 | 250 | if ( $this->isGlobal() ) { |
| 252 | 251 | $this->io->writeln('Showing global settings' . $extra_title . ':'); |
| 253 | - } |
|
| 254 | - else { |
|
| 252 | + } else { |
|
| 255 | 253 | $this->io->writeln( |
| 256 | 254 | 'Showing settings' . $extra_title . ' for <info>' . $this->getWorkingCopyPath() . '</info> path:' |
| 257 | 255 | ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $bugs = $this->getList($this->io->getOption('bugs')); |
| 161 | 161 | $revisions = $this->getList($this->io->getOption('revisions')); |
| 162 | 162 | |
| 163 | - if ( $bugs && $revisions ) { |
|
| 163 | + if ($bugs && $revisions) { |
|
| 164 | 164 | throw new \RuntimeException('The "--bugs" and "--revisions" options are mutually exclusive.'); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | $revision_log = $this->getRevisionLog($wc_url); |
| 171 | 171 | $revisions_by_path = $revision_log->find('paths', $this->repositoryConnector->getPathFromUrl($wc_url)); |
| 172 | 172 | |
| 173 | - if ( $revisions ) { |
|
| 173 | + if ($revisions) { |
|
| 174 | 174 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
| 175 | 175 | $revisions_by_path = array_intersect($revisions_by_path, $revisions); |
| 176 | 176 | $missing_revisions = array_diff($revisions, $revisions_by_path); |
| 177 | 177 | } |
| 178 | - elseif ( $bugs ) { |
|
| 178 | + elseif ($bugs) { |
|
| 179 | 179 | // Only show bug-related revisions on given path. The $missing_revisions is always empty. |
| 180 | 180 | $revisions_from_bugs = $revision_log->find('bugs', $bugs); |
| 181 | 181 | $revisions_by_path = array_intersect($revisions_by_path, $revisions_from_bugs); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $merged_by = $this->getList($this->io->getOption('merged-by')); |
| 185 | 185 | |
| 186 | - if ( $merged_by ) { |
|
| 186 | + if ($merged_by) { |
|
| 187 | 187 | // Exclude revisions, that were merged outside of project root folder in repository. |
| 188 | 188 | $merged_by = $this->_revisionListParser->expandRanges($merged_by); |
| 189 | 189 | $revisions_by_path = $revision_log->find( |
@@ -195,32 +195,32 @@ discard block |
||
| 195 | 195 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', $merged_by)); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if ( $this->io->getOption('merges') ) { |
|
| 198 | + if ($this->io->getOption('merges')) { |
|
| 199 | 199 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 200 | 200 | } |
| 201 | - elseif ( $this->io->getOption('no-merges') ) { |
|
| 201 | + elseif ($this->io->getOption('no-merges')) { |
|
| 202 | 202 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if ( $this->io->getOption('merged') ) { |
|
| 205 | + if ($this->io->getOption('merged')) { |
|
| 206 | 206 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 207 | 207 | } |
| 208 | - elseif ( $this->io->getOption('not-merged') ) { |
|
| 208 | + elseif ($this->io->getOption('not-merged')) { |
|
| 209 | 209 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if ( $missing_revisions ) { |
|
| 212 | + if ($missing_revisions) { |
|
| 213 | 213 | throw new CommandException( |
| 214 | 214 | 'No information about ' . implode(', ', $missing_revisions) . ' revision(-s).' |
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | - elseif ( !$revisions_by_path ) { |
|
| 217 | + elseif (!$revisions_by_path) { |
|
| 218 | 218 | throw new CommandException('No matching revisions found.'); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | rsort($revisions_by_path, SORT_NUMERIC); |
| 222 | 222 | |
| 223 | - if ( $bugs || $revisions ) { |
|
| 223 | + if ($bugs || $revisions) { |
|
| 224 | 224 | // Don't limit revisions, when provided explicitly by user. |
| 225 | 225 | $revisions_by_path_with_limit = $revisions_by_path; |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $option_limit = $this->io->getOption('limit'); |
| 252 | 252 | |
| 253 | - if ( $option_limit !== null ) { |
|
| 253 | + if ($option_limit !== null) { |
|
| 254 | 254 | return $option_limit; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -272,14 +272,14 @@ discard block |
||
| 272 | 272 | $headers = array('Revision', 'Author', 'Date', 'Bug-ID', 'Log Message'); |
| 273 | 273 | |
| 274 | 274 | // Add "Summary" header. |
| 275 | - if ( $this->io->getOption('summary') ) { |
|
| 275 | + if ($this->io->getOption('summary')) { |
|
| 276 | 276 | $headers[] = 'Summary'; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | $merge_oracle = $this->io->getOption('merge-oracle'); |
| 280 | 280 | |
| 281 | 281 | // Add "M.O." header. |
| 282 | - if ( $merge_oracle ) { |
|
| 282 | + if ($merge_oracle) { |
|
| 283 | 283 | $headers[] = 'M.O.'; |
| 284 | 284 | $merge_conflict_regexps = $this->getMergeConflictRegExps(); |
| 285 | 285 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | // Add "Merged Via" header. |
| 288 | 288 | $merge_status = $this->io->getOption('merge-status'); |
| 289 | 289 | |
| 290 | - if ( $merge_status ) { |
|
| 290 | + if ($merge_status) { |
|
| 291 | 291 | $headers[] = 'Merged Via'; |
| 292 | 292 | } |
| 293 | 293 | |
@@ -302,18 +302,18 @@ discard block |
||
| 302 | 302 | $revision_log = $this->getRevisionLog($repository_url); |
| 303 | 303 | $repository_path = $this->repositoryConnector->getPathFromUrl($repository_url) . '/'; |
| 304 | 304 | |
| 305 | - foreach ( $revisions as $revision ) { |
|
| 305 | + foreach ($revisions as $revision) { |
|
| 306 | 306 | $revision_data = $revision_log->getRevisionData('summary', $revision); |
| 307 | 307 | list($log_message,) = explode(PHP_EOL, $revision_data['msg']); |
| 308 | 308 | $log_message = preg_replace('/^\[fixes:.*?\]/', "\xE2\x9C\x94", $log_message); |
| 309 | 309 | |
| 310 | - if ( mb_strlen($log_message) > 68 ) { |
|
| 310 | + if (mb_strlen($log_message) > 68) { |
|
| 311 | 311 | $log_message = mb_substr($log_message, 0, 68 - 3) . '...'; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $new_bugs = implode(', ', $revision_log->getRevisionData('bugs', $revision)); |
| 315 | 315 | |
| 316 | - if ( isset($prev_bugs) && $new_bugs <> $prev_bugs ) { |
|
| 316 | + if (isset($prev_bugs) && $new_bugs <> $prev_bugs) { |
|
| 317 | 317 | $last_color = $last_color == 'yellow' ? 'magenta' : 'yellow'; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -328,12 +328,12 @@ discard block |
||
| 328 | 328 | $revision_paths = $revision_log->getRevisionData('paths', $revision); |
| 329 | 329 | |
| 330 | 330 | // Add "Summary" column. |
| 331 | - if ( $this->io->getOption('summary') ) { |
|
| 331 | + if ($this->io->getOption('summary')) { |
|
| 332 | 332 | $row[] = $this->generateChangeSummary($revision_paths); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Add "M.O." column. |
| 336 | - if ( $merge_oracle ) { |
|
| 336 | + if ($merge_oracle) { |
|
| 337 | 337 | $merge_conflict_predication = $this->getMergeConflictPrediction( |
| 338 | 338 | $revision_paths, |
| 339 | 339 | $merge_conflict_regexps |
@@ -345,26 +345,26 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Add "Merged Via" column. |
| 348 | - if ( $merge_status ) { |
|
| 348 | + if ($merge_status) { |
|
| 349 | 349 | $merged_via = $revision_log->getRevisionData('merges', $revision); |
| 350 | 350 | $row[] = $merged_via ? implode(', ', $merged_via) : ''; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $table->addRow($row); |
| 354 | 354 | |
| 355 | - if ( $with_details ) { |
|
| 355 | + if ($with_details) { |
|
| 356 | 356 | $details = '<fg=white;options=bold>Changed Paths:</>'; |
| 357 | 357 | |
| 358 | - foreach ( $revision_paths as $path_data ) { |
|
| 358 | + foreach ($revision_paths as $path_data) { |
|
| 359 | 359 | $path_action = $path_data['action']; |
| 360 | 360 | $relative_path = $this->_getRelativeLogPath($path_data, 'path', $repository_path); |
| 361 | 361 | |
| 362 | 362 | $details .= PHP_EOL . ' * '; |
| 363 | 363 | |
| 364 | - if ( $path_action == 'A' ) { |
|
| 364 | + if ($path_action == 'A') { |
|
| 365 | 365 | $color_format = 'fg=green'; |
| 366 | 366 | } |
| 367 | - elseif ( $path_action == 'D' ) { |
|
| 367 | + elseif ($path_action == 'D') { |
|
| 368 | 368 | $color_format = 'fg=red'; |
| 369 | 369 | } |
| 370 | 370 | else { |
@@ -373,13 +373,13 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $to_colorize = $path_action . ' ' . $relative_path; |
| 375 | 375 | |
| 376 | - if ( isset($path_data['copyfrom-path']) ) { |
|
| 376 | + if (isset($path_data['copyfrom-path'])) { |
|
| 377 | 377 | $copy_from_rev = $path_data['copyfrom-rev']; |
| 378 | 378 | $copy_from_path = $this->_getRelativeLogPath($path_data, 'copyfrom-path', $repository_path); |
| 379 | 379 | $to_colorize .= PHP_EOL . ' (from ' . $copy_from_path . ':' . $copy_from_rev . ')'; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if ( $color_format ) { |
|
| 382 | + if ($color_format) { |
|
| 383 | 383 | $to_colorize = '<' . $color_format . '>' . $to_colorize . '</>'; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $table->addRow(new TableSeparator()); |
| 390 | 390 | $table->addRow(array(new TableCell($details, array('colspan' => 5)))); |
| 391 | 391 | |
| 392 | - if ( $revision != $last_revision ) { |
|
| 392 | + if ($revision != $last_revision) { |
|
| 393 | 393 | $table->addRow(new TableSeparator()); |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | { |
| 412 | 412 | $summary = array('added' => 0, 'changed' => 0, 'removed' => 0); |
| 413 | 413 | |
| 414 | - foreach ( $revision_paths as $path_data ) { |
|
| 414 | + foreach ($revision_paths as $path_data) { |
|
| 415 | 415 | $path_action = $path_data['action']; |
| 416 | 416 | |
| 417 | - if ( $path_action == 'A' ) { |
|
| 417 | + if ($path_action == 'A') { |
|
| 418 | 418 | $summary['added']++; |
| 419 | 419 | } |
| 420 | - elseif ( $path_action == 'D' ) { |
|
| 420 | + elseif ($path_action == 'D') { |
|
| 421 | 421 | $summary['removed']++; |
| 422 | 422 | } |
| 423 | 423 | else { |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if ( $summary['added'] ) { |
|
| 428 | + if ($summary['added']) { |
|
| 429 | 429 | $summary['added'] = '<fg=green>+' . $summary['added'] . '</>'; |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - if ( $summary['removed'] ) { |
|
| 432 | + if ($summary['removed']) { |
|
| 433 | 433 | $summary['removed'] = '<fg=red>-' . $summary['removed'] . '</>'; |
| 434 | 434 | } |
| 435 | 435 | |
@@ -446,15 +446,15 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | protected function getMergeConflictPrediction(array $revision_paths, array $merge_conflict_regexps) |
| 448 | 448 | { |
| 449 | - if ( !$merge_conflict_regexps ) { |
|
| 449 | + if (!$merge_conflict_regexps) { |
|
| 450 | 450 | return array(); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $conflict_paths = array(); |
| 454 | 454 | |
| 455 | - foreach ( $revision_paths as $revision_path ) { |
|
| 456 | - foreach ( $merge_conflict_regexps as $merge_conflict_regexp ) { |
|
| 457 | - if ( preg_match($merge_conflict_regexp, $revision_path['path']) ) { |
|
| 455 | + foreach ($revision_paths as $revision_path) { |
|
| 456 | + foreach ($merge_conflict_regexps as $merge_conflict_regexp) { |
|
| 457 | + if (preg_match($merge_conflict_regexp, $revision_path['path'])) { |
|
| 458 | 458 | $conflict_paths[] = $revision_path['path']; |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | { |
| 487 | 487 | $ret = $path_data[$path_key]; |
| 488 | 488 | |
| 489 | - if ( $path_data['kind'] == 'dir' ) { |
|
| 489 | + if ($path_data['kind'] == 'dir') { |
|
| 490 | 490 | $ret .= '/'; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | $ret = str_replace($repository_path, '', $ret); |
| 494 | 494 | |
| 495 | - if ( $ret === '' ) { |
|
| 495 | + if ($ret === '') { |
|
| 496 | 496 | $ret = '.'; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | { |
| 509 | 509 | $wc_path = $this->getWorkingCopyPath(); |
| 510 | 510 | |
| 511 | - if ( !$this->repositoryConnector->isUrl($wc_path) ) { |
|
| 511 | + if (!$this->repositoryConnector->isUrl($wc_path)) { |
|
| 512 | 512 | return $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
| 513 | 513 | } |
| 514 | 514 | |
@@ -174,8 +174,7 @@ discard block |
||
| 174 | 174 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
| 175 | 175 | $revisions_by_path = array_intersect($revisions_by_path, $revisions); |
| 176 | 176 | $missing_revisions = array_diff($revisions, $revisions_by_path); |
| 177 | - } |
|
| 178 | - elseif ( $bugs ) { |
|
| 177 | + } elseif ( $bugs ) { |
|
| 179 | 178 | // Only show bug-related revisions on given path. The $missing_revisions is always empty. |
| 180 | 179 | $revisions_from_bugs = $revision_log->find('bugs', $bugs); |
| 181 | 180 | $revisions_by_path = array_intersect($revisions_by_path, $revisions_from_bugs); |
@@ -197,15 +196,13 @@ discard block |
||
| 197 | 196 | |
| 198 | 197 | if ( $this->io->getOption('merges') ) { |
| 199 | 198 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 200 | - } |
|
| 201 | - elseif ( $this->io->getOption('no-merges') ) { |
|
| 199 | + } elseif ( $this->io->getOption('no-merges') ) { |
|
| 202 | 200 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merges')); |
| 203 | 201 | } |
| 204 | 202 | |
| 205 | 203 | if ( $this->io->getOption('merged') ) { |
| 206 | 204 | $revisions_by_path = array_intersect($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 207 | - } |
|
| 208 | - elseif ( $this->io->getOption('not-merged') ) { |
|
| 205 | + } elseif ( $this->io->getOption('not-merged') ) { |
|
| 209 | 206 | $revisions_by_path = array_diff($revisions_by_path, $revision_log->find('merges', 'all_merged')); |
| 210 | 207 | } |
| 211 | 208 | |
@@ -213,8 +210,7 @@ discard block |
||
| 213 | 210 | throw new CommandException( |
| 214 | 211 | 'No information about ' . implode(', ', $missing_revisions) . ' revision(-s).' |
| 215 | 212 | ); |
| 216 | - } |
|
| 217 | - elseif ( !$revisions_by_path ) { |
|
| 213 | + } elseif ( !$revisions_by_path ) { |
|
| 218 | 214 | throw new CommandException('No matching revisions found.'); |
| 219 | 215 | } |
| 220 | 216 | |
@@ -223,8 +219,7 @@ discard block |
||
| 223 | 219 | if ( $bugs || $revisions ) { |
| 224 | 220 | // Don't limit revisions, when provided explicitly by user. |
| 225 | 221 | $revisions_by_path_with_limit = $revisions_by_path; |
| 226 | - } |
|
| 227 | - else { |
|
| 222 | + } else { |
|
| 228 | 223 | // Apply limit only, when no explicit bugs/revisions are set. |
| 229 | 224 | $revisions_by_path_with_limit = array_slice($revisions_by_path, 0, $this->getLimit()); |
| 230 | 225 | } |
@@ -339,8 +334,7 @@ discard block |
||
| 339 | 334 | $merge_conflict_regexps |
| 340 | 335 | ); |
| 341 | 336 | $row[] = $merge_conflict_predication ? '<error>' . count($merge_conflict_predication) . '</error>' : ''; |
| 342 | - } |
|
| 343 | - else { |
|
| 337 | + } else { |
|
| 344 | 338 | $merge_conflict_predication = array(); |
| 345 | 339 | } |
| 346 | 340 | |
@@ -363,11 +357,9 @@ discard block |
||
| 363 | 357 | |
| 364 | 358 | if ( $path_action == 'A' ) { |
| 365 | 359 | $color_format = 'fg=green'; |
| 366 | - } |
|
| 367 | - elseif ( $path_action == 'D' ) { |
|
| 360 | + } elseif ( $path_action == 'D' ) { |
|
| 368 | 361 | $color_format = 'fg=red'; |
| 369 | - } |
|
| 370 | - else { |
|
| 362 | + } else { |
|
| 371 | 363 | $color_format = in_array($path_data['path'], $merge_conflict_predication) ? 'error' : ''; |
| 372 | 364 | } |
| 373 | 365 | |
@@ -416,11 +408,9 @@ discard block |
||
| 416 | 408 | |
| 417 | 409 | if ( $path_action == 'A' ) { |
| 418 | 410 | $summary['added']++; |
| 419 | - } |
|
| 420 | - elseif ( $path_action == 'D' ) { |
|
| 411 | + } elseif ( $path_action == 'D' ) { |
|
| 421 | 412 | $summary['removed']++; |
| 422 | - } |
|
| 423 | - else { |
|
| 413 | + } else { |
|
| 424 | 414 | $summary['changed']++; |
| 425 | 415 | } |
| 426 | 416 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $ret = parent::completeOptionValues($optionName, $context); |
| 145 | 145 | |
| 146 | - if ( $optionName === 'revisions' ) { |
|
| 146 | + if ($optionName === 'revisions') { |
|
| 147 | 147 | return array('all'); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $bugs = $this->getList($this->io->getOption('bugs')); |
| 159 | 159 | $revisions = $this->getList($this->io->getOption('revisions')); |
| 160 | 160 | |
| 161 | - if ( $bugs && $revisions ) { |
|
| 161 | + if ($bugs && $revisions) { |
|
| 162 | 162 | throw new \RuntimeException('The "--bugs" and "--revisions" options are mutually exclusive.'); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -170,36 +170,36 @@ discard block |
||
| 170 | 170 | $this->printSourceAndTarget($source_url, $wc_path); |
| 171 | 171 | $this->_unmergedRevisions = $this->getUnmergedRevisions($source_url, $wc_path); |
| 172 | 172 | |
| 173 | - if ( ($bugs || $revisions) && !$this->_unmergedRevisions ) { |
|
| 173 | + if (($bugs || $revisions) && !$this->_unmergedRevisions) { |
|
| 174 | 174 | throw new CommandException('Nothing to merge.'); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $this->ensureWorkingCopyWithoutConflicts($source_url, $wc_path); |
| 178 | 178 | |
| 179 | - if ( $this->shouldMergeAll($revisions) ) { |
|
| 179 | + if ($this->shouldMergeAll($revisions)) { |
|
| 180 | 180 | $revisions = $this->_unmergedRevisions; |
| 181 | 181 | } |
| 182 | 182 | else { |
| 183 | - if ( $revisions ) { |
|
| 183 | + if ($revisions) { |
|
| 184 | 184 | $revisions = $this->getDirectRevisions($revisions, $source_url); |
| 185 | 185 | } |
| 186 | - elseif ( $bugs ) { |
|
| 186 | + elseif ($bugs) { |
|
| 187 | 187 | $revisions = $this->getRevisionLog($source_url)->find('bugs', $bugs); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if ( $revisions ) { |
|
| 190 | + if ($revisions) { |
|
| 191 | 191 | $revisions = array_intersect($revisions, $this->_unmergedRevisions); |
| 192 | 192 | |
| 193 | - if ( !$revisions ) { |
|
| 193 | + if (!$revisions) { |
|
| 194 | 194 | throw new CommandException('Requested revisions are already merged'); |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( $revisions ) { |
|
| 199 | + if ($revisions) { |
|
| 200 | 200 | $this->performMerge($source_url, $wc_path, $revisions); |
| 201 | 201 | } |
| 202 | - elseif ( $this->_unmergedRevisions ) { |
|
| 202 | + elseif ($this->_unmergedRevisions) { |
|
| 203 | 203 | $this->runOtherCommand('log', array( |
| 204 | 204 | 'path' => $this->repositoryConnector->getProjectUrl($source_url), |
| 205 | 205 | '--revisions' => implode(',', $this->_unmergedRevisions), |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $this->io->write(' * Working Copy Status ... '); |
| 236 | 236 | |
| 237 | - if ( $this->repositoryConnector->isMixedRevisionWorkingCopy($wc_path) ) { |
|
| 237 | + if ($this->repositoryConnector->isMixedRevisionWorkingCopy($wc_path)) { |
|
| 238 | 238 | $this->io->writeln('<error>Mixed revisions</error>'); |
| 239 | 239 | $this->updateWorkingCopy($wc_path); |
| 240 | 240 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $this->repositoryConnector->getWorkingCopyUrl($wc_path) |
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | - if ( $repository_revision > $working_copy_revision ) { |
|
| 249 | + if ($repository_revision > $working_copy_revision) { |
|
| 250 | 250 | $this->io->writeln('<error>Out of date</error>'); |
| 251 | 251 | $this->updateWorkingCopy($wc_path); |
| 252 | 252 | |
@@ -281,20 +281,20 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | $source_url = $this->io->getOption('source-url'); |
| 283 | 283 | |
| 284 | - if ( $source_url === null ) { |
|
| 284 | + if ($source_url === null) { |
|
| 285 | 285 | $source_url = $this->getSetting(self::SETTING_MERGE_SOURCE_URL); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if ( !$source_url ) { |
|
| 288 | + if (!$source_url) { |
|
| 289 | 289 | $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path); |
| 290 | 290 | $source_url = $this->_mergeSourceDetector->detect($wc_url); |
| 291 | 291 | |
| 292 | - if ( $source_url ) { |
|
| 292 | + if ($source_url) { |
|
| 293 | 293 | $this->setSetting(self::SETTING_MERGE_SOURCE_URL, $source_url); |
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if ( !$source_url ) { |
|
| 297 | + if (!$source_url) { |
|
| 298 | 298 | $error_msg = 'Unable to determine source url for merge.' . PHP_EOL; |
| 299 | 299 | $error_msg .= 'Please specify it manually using "--source-url" option'; |
| 300 | 300 | throw new CommandException($error_msg); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $this->io->write(' * Upcoming Merge Status ... '); |
| 339 | 339 | $unmerged_revisions = $this->calculateUnmergedRevisions($source_url, $wc_path); |
| 340 | 340 | |
| 341 | - if ( $unmerged_revisions ) { |
|
| 341 | + if ($unmerged_revisions) { |
|
| 342 | 342 | $unmerged_bugs = $revision_log->getBugsFromRevisions($unmerged_revisions); |
| 343 | 343 | $error_msg = '<error>%d revision(-s) or %d bug(-s) not merged</error>'; |
| 344 | 344 | $this->io->writeln(sprintf($error_msg, count($unmerged_revisions), count($unmerged_bugs))); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $merge_info = $command->run(); |
| 377 | 377 | $merge_info = explode(PHP_EOL, $merge_info); |
| 378 | 378 | |
| 379 | - foreach ( $merge_info as $index => $revision ) { |
|
| 379 | + foreach ($merge_info as $index => $revision) { |
|
| 380 | 380 | $merge_info[$index] = ltrim($revision, 'r'); |
| 381 | 381 | } |
| 382 | 382 | |
@@ -396,10 +396,10 @@ discard block |
||
| 396 | 396 | $merge_info = $this->repositoryConnector->getProperty('svn:mergeinfo', $wc_path); |
| 397 | 397 | $merge_info = array_filter(explode("\n", $merge_info)); |
| 398 | 398 | |
| 399 | - foreach ( $merge_info as $merge_info_line ) { |
|
| 399 | + foreach ($merge_info as $merge_info_line) { |
|
| 400 | 400 | list($path, $revisions) = explode(':', $merge_info_line, 2); |
| 401 | 401 | |
| 402 | - if ( $path == $source_path ) { |
|
| 402 | + if ($path == $source_path) { |
|
| 403 | 403 | return $this->_revisionListParser->expandRanges(explode(',', $revisions)); |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | try { |
| 424 | 424 | $revisions = $this->_revisionListParser->expandRanges($revisions); |
| 425 | 425 | |
| 426 | - foreach ( $revisions as $revision ) { |
|
| 426 | + foreach ($revisions as $revision) { |
|
| 427 | 427 | $revision_log->getRevisionData('summary', $revision); |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | - catch ( \InvalidArgumentException $e ) { |
|
| 430 | + catch (\InvalidArgumentException $e) { |
|
| 431 | 431 | throw new CommandException($e->getMessage()); |
| 432 | 432 | } |
| 433 | 433 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | sort($revisions, SORT_NUMERIC); |
| 449 | 449 | |
| 450 | - foreach ( $revisions as $revision ) { |
|
| 450 | + foreach ($revisions as $revision) { |
|
| 451 | 451 | $command = $this->repositoryConnector->getCommand( |
| 452 | 452 | 'merge', |
| 453 | 453 | '-c ' . $revision . ' {' . $source_url . '} {' . $wc_path . '}' |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
| 482 | 482 | |
| 483 | - if ( !$conflicts ) { |
|
| 483 | + if (!$conflicts) { |
|
| 484 | 484 | $this->io->writeln('<info>Successful</info>'); |
| 485 | 485 | |
| 486 | 486 | return; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | $table = new Table($this->io->getOutput()); |
| 492 | 492 | |
| 493 | - if ( $largest_suggested_revision ) { |
|
| 493 | + if ($largest_suggested_revision) { |
|
| 494 | 494 | $table->setHeaders(array( |
| 495 | 495 | 'Path', |
| 496 | 496 | 'Associated Revisions (before ' . $largest_suggested_revision . ')', |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | $revision_log = $this->getRevisionLog($source_url); |
| 507 | 507 | $source_path = $this->repositoryConnector->getPathFromUrl($source_url) . '/'; |
| 508 | 508 | |
| 509 | - foreach ( $conflicts as $conflict_path ) { |
|
| 509 | + foreach ($conflicts as $conflict_path) { |
|
| 510 | 510 | $path_revisions = $revision_log->find('paths', $source_path . $conflict_path); |
| 511 | 511 | $path_revisions = array_intersect($this->_unmergedRevisions, $path_revisions); |
| 512 | 512 | |
| 513 | - if ( $path_revisions && isset($largest_suggested_revision) ) { |
|
| 513 | + if ($path_revisions && isset($largest_suggested_revision)) { |
|
| 514 | 514 | $path_revisions = $this->limitRevisions($path_revisions, $largest_suggested_revision); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -537,8 +537,8 @@ discard block |
||
| 537 | 537 | { |
| 538 | 538 | $ret = array(); |
| 539 | 539 | |
| 540 | - foreach ( $revisions as $revision ) { |
|
| 541 | - if ( $revision < $max_revision ) { |
|
| 540 | + foreach ($revisions as $revision) { |
|
| 541 | + if ($revision < $max_revision) { |
|
| 542 | 542 | $ret[] = $revision; |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -178,12 +178,10 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | if ( $this->shouldMergeAll($revisions) ) { |
| 180 | 180 | $revisions = $this->_unmergedRevisions; |
| 181 | - } |
|
| 182 | - else { |
|
| 181 | + } else { |
|
| 183 | 182 | if ( $revisions ) { |
| 184 | 183 | $revisions = $this->getDirectRevisions($revisions, $source_url); |
| 185 | - } |
|
| 186 | - elseif ( $bugs ) { |
|
| 184 | + } elseif ( $bugs ) { |
|
| 187 | 185 | $revisions = $this->getRevisionLog($source_url)->find('bugs', $bugs); |
| 188 | 186 | } |
| 189 | 187 | |
@@ -198,8 +196,7 @@ discard block |
||
| 198 | 196 | |
| 199 | 197 | if ( $revisions ) { |
| 200 | 198 | $this->performMerge($source_url, $wc_path, $revisions); |
| 201 | - } |
|
| 202 | - elseif ( $this->_unmergedRevisions ) { |
|
| 199 | + } elseif ( $this->_unmergedRevisions ) { |
|
| 203 | 200 | $this->runOtherCommand('log', array( |
| 204 | 201 | 'path' => $this->repositoryConnector->getProjectUrl($source_url), |
| 205 | 202 | '--revisions' => implode(',', $this->_unmergedRevisions), |
@@ -342,8 +339,7 @@ discard block |
||
| 342 | 339 | $unmerged_bugs = $revision_log->getBugsFromRevisions($unmerged_revisions); |
| 343 | 340 | $error_msg = '<error>%d revision(-s) or %d bug(-s) not merged</error>'; |
| 344 | 341 | $this->io->writeln(sprintf($error_msg, count($unmerged_revisions), count($unmerged_bugs))); |
| 345 | - } |
|
| 346 | - else { |
|
| 342 | + } else { |
|
| 347 | 343 | $this->io->writeln('<info>Up to date</info>'); |
| 348 | 344 | } |
| 349 | 345 | |
@@ -426,8 +422,7 @@ discard block |
||
| 426 | 422 | foreach ( $revisions as $revision ) { |
| 427 | 423 | $revision_log->getRevisionData('summary', $revision); |
| 428 | 424 | } |
| 429 | - } |
|
| 430 | - catch ( \InvalidArgumentException $e ) { |
|
| 425 | + } catch ( \InvalidArgumentException $e ) { |
|
| 431 | 426 | throw new CommandException($e->getMessage()); |
| 432 | 427 | } |
| 433 | 428 | |
@@ -495,8 +490,7 @@ discard block |
||
| 495 | 490 | 'Path', |
| 496 | 491 | 'Associated Revisions (before ' . $largest_suggested_revision . ')', |
| 497 | 492 | )); |
| 498 | - } |
|
| 499 | - else { |
|
| 493 | + } else { |
|
| 500 | 494 | $table->setHeaders(array( |
| 501 | 495 | 'Path', |
| 502 | 496 | 'Associated Revisions', |
@@ -50,13 +50,13 @@ |
||
| 50 | 50 | $wc_path = $this->getWorkingCopyPath(); |
| 51 | 51 | $conflicts = $this->repositoryConnector->getWorkingCopyConflicts($wc_path); |
| 52 | 52 | |
| 53 | - if ( !$conflicts ) { |
|
| 53 | + if (!$conflicts) { |
|
| 54 | 54 | throw new CommandException('No conflicts detected.'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $resolve_path = $this->getResolvePath($conflicts); |
| 58 | 58 | |
| 59 | - if ( is_dir($resolve_path) ) { |
|
| 59 | + if (is_dir($resolve_path)) { |
|
| 60 | 60 | throw new CommandException('Interactive tree conflict resolution is not supported.'); |
| 61 | 61 | } |
| 62 | 62 | |