| @@ 304-322 (lines=19) @@ | ||
| 301 | public function commit($message = 'PATCH: module clean-up') { |
|
| 302 | ||
| 303 | $git = $this->checkOrSetGitCommsWrapper(); |
|
| 304 | if ($git) { |
|
| 305 | ||
| 306 | try { |
|
| 307 | $git->commit($message); |
|
| 308 | } |
|
| 309 | catch (Exception $e) { |
|
| 310 | $errStr = $e->getMessage(); |
|
| 311 | if (stripos($errStr, 'nothing to commit') === false) { |
|
| 312 | print_r($e); |
|
| 313 | throw $e; |
|
| 314 | } |
|
| 315 | else { |
|
| 316 | GeneralMethods::output_to_screen('No changes to commit'); |
|
| 317 | } |
|
| 318 | } |
|
| 319 | //GeneralMethods::output_to_screen($git->getOutput()); |
|
| 320 | ||
| 321 | return $this; |
|
| 322 | } |
|
| 323 | return false; |
|
| 324 | } |
|
| 325 | ||
| @@ 335-353 (lines=19) @@ | ||
| 332 | GeneralMethods::output_to_screen('Adding new files to '.$this->ModuleName.' ... ' ,"created"); |
|
| 333 | ||
| 334 | $git = $this->checkOrSetGitcommsWrapper(); |
|
| 335 | if ($git) { |
|
| 336 | try { |
|
| 337 | $git->add("."); |
|
| 338 | } |
|
| 339 | catch (GitWrapper\GitException $e) { |
|
| 340 | $errStr = $e->getMessage(); |
|
| 341 | if (stripos($errStr, 'did not match any files') === false) { |
|
| 342 | print_r($e); |
|
| 343 | throw $e; |
|
| 344 | } |
|
| 345 | else { |
|
| 346 | GeneralMethods::output_to_screen('No new files to add to $module. '); |
|
| 347 | } |
|
| 348 | } |
|
| 349 | ||
| 350 | //GeneralMethods::output_to_screen($git->getOutput()); |
|
| 351 | ||
| 352 | return $this; |
|
| 353 | } |
|
| 354 | return false; |
|
| 355 | } |
|
| 356 | ||