{
protected $_repos;
- public static function executeCommands($repos, $commands)
+ public static function executeCommands($repos, $commands, $debug = false)
{
$res = [];
foreach ($commands as $command) {
- $res[] = self::executeCommand($repos, $command);
+ $res[] = self::executeCommand($repos, $command, $debug);
}
return $res;
}
- public static function executeCommand($repos, $command)
+ public static function executeCommand($repos, $command, $debug = false)
{
$git = new self($repos);
- return $git->executeCmd($command);
+ return $git->executeCmd($command, $debug);
}
public function __construct($repos, $output = null, $error = true)
$this->cd($repos);
}
- public function executeCmd($cmd)
+ public function executeCmd($cmd, $debug = false)
{
$this->setManualArg($cmd);
$this->execute();
+ if ($debug) {
+ $this->debug();
+ }
return $this->getOutput();
}
* @param $repos
* @return bool
*/
- public static function pull($repos, $restoreMtime = false)
+ public static function pull($repos, $rebase = false, $restoreMtime = false, $debug = false)
{
- $res=self::executeCommand($repos,'pull');
+ $args = '';
+ if ($rebase) {
+ $args .= '--rebase';
+ }
+ $res = self::executeCommand($repos, 'pull ' . $args, $debug);
$changes = (trim($res) !== 'Already up to date.');
- if($restoreMtime && $changes){
- self::executeCommand($repos,'restore-mtime');
+ if ($restoreMtime && $changes) {
+ self::executeCommand($repos, 'restore-mtime', $debug);
}
return $changes;
}