Commit

@param string        $message  the commit message
@param bool          $stageAll commit all changes
@param string|Author $author   override the author for this commit

@throws \RuntimeException
@throws \InvalidArgumentException
@return string
330948
public function commit($message, $stageAll = false, $author = null, $allowEmpty = false)
    {
        $this->clearAll();
        if (trim($message) === '' || is_null($message)) {
            throw new \InvalidArgumentException(sprintf('You can\'t commit without message'));
        }
        $this->addCommandName(self::GIT_COMMIT);

        if ($stageAll) {
            $this->addCommandArgument('-a');
        }

        if ($author !== null) {
            $this->addCommandArgument('--author');
            $this->addCommandArgument($author);
        }

        if ($allowEmpty) {
            $this->addCommandArgument('--allow-empty');
        }

        $this->addCommandArgument('-m');
        $this->addCommandSubject($message);

        return $this->getCommand();
    }
883445
public function commit($message, $params = null) {
		if(!is_array($params)) {
			$params = [];
		}
		return $this
			->begin()
			->run("git commit", $params, ['-m' => $message,])
			->end();
	}
617891
function zcLog($stage, $message) {
    static $tokenHash;
    if ($tokenHash == '') $tokenHash = '_' . zen_create_random_value(4);
    if (MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log and Email' || MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log File') {
      $token = (isset($_SESSION['paypal_ec_token'])) ? $_SESSION['paypal_ec_token'] : preg_replace('/[^0-9.A-Z\-]/', '', $_GET['token']);
      $token = ($token == '') ? date('m-d-Y-H-i') : $token; // or time()
      $token .= $tokenHash;
      $file = $this->_logDir . '/' . $this->code . '_Paypal_Action_' . $token . '.log';
      if (defined('PAYPAL_DEV_MODE') && PAYPAL_DEV_MODE == 'true') $file = $this->_logDir . '/' . $this->code . '_Paypal_Debug_' . $token . '.log';
      $fp = @fopen($file, 'a');
      @fwrite($fp, date('M-d-Y H:i:s') . ' (' . time() . ')' . "\n" . $stage . "\n" . $message . "\n=================================\n\n");
      @fclose($fp);
    }
    $this->_doDebug($stage, $message, false);
  }
1204535
public RevCommit addAndCommit(Git git, String message) {
        try {
            git.add()
                .addFilepattern(".")
                .call();
            return git.commit()
                .setMessage(message)
                .call();
        } catch (GitAPIException e) {
            throw new IllegalStateException(e);
        }
    }
1298993
private function processCommit(OutputInterface $output, array $commit, array $components)
    {
        $output->writeln(sprintf(
            'Processing Commit: <info>%s</info>',
            $commit['message']
        ));
        $output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl']));
        $output->writeln('----------');
        $output->writeln('');

        $message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message']));

        $commitRelease = [];
        foreach ($components as $key => $component) {
            $componentRelease = isset($commitRelease[$key])
                ? $commitRelease[$key]
                : ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []];

            $lowestAllowedLevel = $componentRelease['level'];
            $suggestedLevel = $lowestAllowedLevel;
            $allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) {
                return $key >= $lowestAllowedLevel;
            }, ARRAY_FILTER_USE_BOTH);

            $output->writeln(sprintf('Component <comment>%s</comment> modified by commit.', $key));

            list ($suggestedLevel, $reasons) =
                $this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']);

            $output->writeln(sprintf(
                'We suggest a <info>%s</info> release because of the following reasons. Please do not use this as an ' .
                'absolute guide, as this tool is unable to determine the correct outcome in every scenario.',
                $this->levels[$suggestedLevel]
            ));
            $output->writeln('');

            foreach ($reasons as $reason) {
                $output->writeln('* '. $reason);
            }

            $output->writeln('');

            $componentRelease['level'] = $suggestedLevel;
            $componentRelease['message'] = $message .' (#'. $commit['reference'] .')';
            $componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons);
            $componentRelease['ref'] = $commit['reference'];

            $commitRelease[$key] = $componentRelease;
        }

        return $commitRelease;
    }
264881
public function publishRelease($repository, $label = 'none', $origin = '') {
      if (!in_array($label, ['rc', 'beta', 'alpha', 'none'])) {
         throw new \InvalidArgumentException('Release label, can be rc, beta, alpha or none');
      }
      $this->options['label'] = $label;

      // changelog generation
      $result = $this->makeChangelog($repository);
      if (null !== $result && $result->wasCancelled()) {
         $this->say($result->getMessage());
         return;
      }

      $newVersion = $this->newVersion;
      $releaseBranch = 'release/' . $newVersion;

      // git-flow start
      $this->taskGitStack()->checkout('-b ' . $releaseBranch)->run();

      // Continue the git flow
      $filename = 'CHANGELOG.md';
      $commitMessage = 'docs: updated project files for new release.';
      $composerFile = 'composer.json';
      $this->composerUpdate($composerFile);
      $this->taskGitStack()->add($filename)->add($composerFile)
         ->commit($commitMessage, '--no-gpg-sign')
         ->checkout('-b robo-master upstream/master')
         ->merge($releaseBranch)->tag($newVersion)
         ->checkout('-b robo-develop upstream/develop')->merge($releaseBranch)
         ->run();

      // finish git-flow with delete release branch
      $this->taskGitStack()->exec('branch -D ' . $releaseBranch)->run();

      // make changelog for gh-pages
      $this->taskGitStack()->checkout('-b robo-gh-pages upstream/gh-pages')->checkout('robo-develop ' . $filename)->run();
      $this->_exec('mv -f ' . $filename. ' _includes/' . $filename);
      $this->taskGitStack()->add('_includes/' .$filename)->commit($commitMessage, '--no-gpg-sign')->run();

      // publish the changes
      if ($origin) {
         $this->taskGitStack()
            ->push($origin, 'robo-gh-pages:gh-pages')
            ->push($origin, 'robo-develop:develop')
            ->push($origin, 'robo-master:master')
            ->push($origin, $newVersion)
            ->run();
      }
   }
218490
function commitAllChanges(msg) {
    return vowExec(util.format('git commit -a -m "%s" -n', msg))
        .fail(function (res) {
            return vow.reject('Commit failed:\n' + res.stderr);
        });
}
223047
public function log($level, $message, array $context = array()) {
        if (!isset($this->wraps[$level])) {
            throw new InvalidArgumentException("Invalid log level: $level", 400);
        }

        $msg = $this->replaceContext($message, $context);

        $eol = true;
        $fullLine = true;
        $str = ''; // queue everything in a string to avoid race conditions

        if ($this->bufferBegins()) {
            if (!empty($context[TaskLogger::FIELD_BEGIN])) {
                if ($this->inBegin) {
                    $str .= $this->eol;
                } else {
                    $this->inBegin = true;
                }
                $eol = false;
            } elseif (!empty($context[TaskLogger::FIELD_END]) && strpos($msg, "\n") === false) {
                if ($this->inBegin) {
                    $msg = ' '.$msg;
                    $fullLine = false;
                    $this->inBegin = false;
                }
            } elseif ($this->inBegin) {
                $str .= $this->eol;
                $this->inBegin = false;
            }
        }

        $str .= $this->fullMessageStr($level, $msg, $context, $fullLine);

        if ($eol) {
            $str .= $this->eol;
        }

        if (!is_resource($this->outputHandle) || feof($this->outputHandle)) {
            trigger_error('The StreamLogger output handle is not valid.', E_USER_WARNING);
        } else {
            fwrite($this->outputHandle, $str);
        }
    }
1223233
final public function log($level, $message, array $context = array())
	{
		if(! defined("\\shgysk8zer0\\Core_API\\Abstracts\\LogLevel::" . strtoupper($level))) {
			throw new \InvalidArgumentException("Undefined log level: {$level}");
		}
		echo $this->interpolate($message, $context) . PHP_EOL;
	}
61765
public function commitMsgHook($message) {
    $this->say('Validating commit message syntax...');
    $pattern = $this->getConfigValue('git.commit-msg.pattern');
    $help_description = $this->getConfigValue('git.commit-msg.help_description');
    $example = $this->getConfigValue('git.commit-msg.example');
    $this->logger->debug("Validing commit message with regex <comment>$pattern</comment>.");
    if (!preg_match($pattern, $message)) {
      $this->logger->error("Invalid commit message!");
      $this->say("Commit messages must conform to the regex $pattern");
      if (!empty($help_description)) {
        $this->say("$help_description");
      }
      if (!empty($example)) {
        $this->say("Example: $example");
      }
      $this->logger->notice("To disable or customize Git hooks, see http://blt.rtfd.io/en/latest/readme/extending-blt/#git-hooks");

      return 1;
    }

    return 0;
  }
1053587
protected function messageToString($level, $message, array $context)
    {
        if (!empty($context)) {
            $message .= ' '.json_encode($context, JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR);
        }

        return $message;
    }
553217
public function log($level, $message, array $context = array())
    {
        $meta = [
            'datetime' => date($this->dateFormat),
            'name'     => $this->name,
            'level'    => $level,
            'message'  => $this->formatMessage($message, $context),
            'context'  => $this->formatContext($context)
        ];

        $message = $this->interpolate($this->getMessageFormat($level, $context), $meta);

        fwrite($this->stream, $message . PHP_EOL);
    }
102105
protected function initMessage($level, $message, array $context)
    {
        // assert that message is a string, and interpolate placeholders
        $message = (string) $message;
        $context = $this->initContext($context);
        $message = self::interpolate($message, $context);

        // create message object
        $messageObj = new Message();
        $messageObj->setLevel($level);
        $messageObj->setShortMessage($message);
        $messageObj->setFacility($this->facility);

        foreach ($this->getDefaultContext() as $key => $value) {
            $messageObj->setAdditional($key, $value);
        }
        foreach ($context as $key => $value) {
            $messageObj->setAdditional($key, $value);
        }

        return $messageObj;
    }
1237700
public function createTicket(Ticket $ticket, $author, $authorEmail)
    {
        if (filter_var($authorEmail, FILTER_VALIDATE_EMAIL) === false)
        {
            throw new InvalidArgumentException($authorEmail . " is not a valid email address.");
        }

        $result = $this->httpHelper->post("/tickets", [
            'subject' => $ticket->getSubject(),
            'type' => 'public',
            'inbound_email_account_id' => $ticket->getInboundEmailAccountID(),
            'ticket_group_id' => $ticket->getTicketGroupID(),
            'user_id' => $ticket->getUserID(),
            'assignee' => 'accounts',
            'assignee_id' => $ticket->getAccountID(),
            'email_address' => $ticket->getEmailAddress(),
            'priority' => $ticket->getPriority(),
            'comment' => "Created via the customer portal framework.",
        ]);

        $this->httpHelper->post("/tickets/" . $result->id . "/ticket_replies", [
            'text' => $ticket->getDescription(),
            'incoming' => true,
            'author' => $author,
            'author_email' => $authorEmail,
        ]);

        return $result;
    }
854851
public function store($message = null, $commit = null)
    {
        $this->arguments[] = 'store';
        if ($message) {
            $this->arguments[] = '--message '.$message;
        }
        if ($commit) {
            $this->arguments[] = $commit;
        }
        return $this->run();
    }
485452
public function onBeforeAddPageCommit(BeforeAddPageCommitEvent $event)
    {
        if ($event->isAborted()) {
            return;
        }

        $pageManager = $event->getContentManager();
        $pageRepository = $pageManager->getPageRepository();
        $values = $event->getValues();

        if (!is_array($values)) {
            throw new InvalidArgumentException('exception_invalid_value_array_required');
        }

        try {
            $languages = $this->languageRepository->activeLanguages();
            if (count($languages)) {
                $result = true;
                $idPage = $pageManager->get()->getId();
                $this->seoManager->getSeoRepository()->setConnection($pageRepository->getConnection());
                $pageRepository->startTransaction();
                foreach ($languages as $alLanguage) {
                    $seoManagerValues = array_merge($values, array('PageId' => $idPage, 'LanguageId' => $alLanguage->getId(), 'CreatedAt'       => date("Y-m-d H:i:s")));
                    if (!$alLanguage->getMainLanguage() && array_key_exists('Permalink', $seoManagerValues)) $seoManagerValues['Permalink'] = $alLanguage->getLanguageName() . '-' . $seoManagerValues['Permalink'];
                    $this->seoManager->set(null);
                    $result = $this->seoManager->save($seoManagerValues);

                    if (false === $result) break;
                }

                if (false !== $result) {
                    $pageRepository->commit();

                    return;
                }

                $pageRepository->rollBack();
                $event->abort();
            }
        } catch (\Exception $e) {
            $event->abort();

            if (isset($pageRepository) && $pageRepository !== null) {
                $pageRepository->rollBack();
            }

            throw $e;
        }
    }
15295
public function getCurrentCommit()
    {
        /** @var $result CallResult */
        $result = $this->getSvn()->{'info'}($this->getRepositoryPath(), array(
            '--xml',
            '--revision' => 'HEAD'
        ));
        $result->assertSuccess(sprintf('Cannot get info for "%s"', $this->getRepositoryPath()));

        $xml    = simplexml_load_string($result->getStdOut());
        if (!$xml) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }

        $commit = $xml->xpath('/info/entry/commit[@revision]');
        if (empty($commit)) {
            throw new \RuntimeException(sprintf('Cannot read info XML for "%s"', $this->getRepositoryPath()));
        }

        $commit = reset($commit);
        return (string)($commit['revision']);
    }