Collect commit info.

@throws \RuntimeException

@return \PhpCoveralls\Bundle\CoverallsBundle\Entity\Git\Commit
554888
protected function collectCommit()
    {
        $commitResult = $this->command->getHeadCommit();

        if (count($commitResult) !== 6 || array_keys($commitResult) !== range(0, 5)) {
            throw new \RuntimeException();
        }

        $commit = new Commit();

        return $commit
            ->setId($commitResult[0])
            ->setAuthorName($commitResult[1])
            ->setAuthorEmail($commitResult[2])
            ->setCommitterName($commitResult[3])
            ->setCommitterEmail($commitResult[4])
            ->setMessage($commitResult[5]);
    }
718494
public function indexAction()
    {
        $request = $this->getRequest();
        $type    = $request->getParam( 'type' );

        if ( ! $request instanceof ConsoleRequest )
        {
            throw new \RuntimeException( sprintf(
                '%s can only be used from a console.',
                __METHOD__
            ) );
        }

        $phpSelf = realpath( static::PHP_SELF );

        if ( empty( $phpSelf ) || ! is_file( $phpSelf ) )
        {
            throw new \RuntimeException( sprintf(
                '%s: php not found at "%s" (in "%s").',
                __METHOD__,
                static::PHP_SELF,
                getcwd()
            ) );
        }

        $result = 'Running ' . $type . ' cron(s) ...' . PHP_EOL . PHP_EOL;

        foreach ( $this->mimicSiteInfos() as $siteInfo )
        {
            $domain  = $siteInfo->getDomain();
            $process = new Process( array(
                'command'   => 'php',
                'arguments' => array(
                    $phpSelf,
                    'cron',
                    $domain,
                    $type,
                ),
                'environmentVariables'  => array(
                    'GRIDGUYZ_HOST'     => $domain,
                    'HTTP_HOST'         => $domain,
                ),
            ) );

            $result .= 'Calling process ...' . PHP_EOL .
                       $process->getRunCommand() . PHP_EOL;

            $output = tempnam( './data/', $domain );
            $descr  = array( Process::TYPE_FILE, $output, Process::MODE_APPEND );
            file_put_contents( $output, '' );

            $process->open( array(
                Process::STREAM_STDOUT => $descr,
                Process::STREAM_STDERR => $descr,
            ) );

            $return     = $process->close();
            $messages   = rtrim( file_get_contents( $output ), PHP_EOL );
            unlink( $output );

            if ( $messages )
            {
                $result .= static::PADDING . preg_replace(
                    '/[' . PHP_EOL . ']+/',
                    '$0' . static::PADDING,
                    $messages
                ) . PHP_EOL;
            }

            $result .= sprintf(
                'Process returned with #%d: %s' . PHP_EOL . PHP_EOL,
                $return,
                $return ? 'error!' : 'success.'
            );
        }

        $result .= 'Done.' . PHP_EOL;
        return $result;
    }
452232
public function commit()
    {
        try {
            if (empty($this->_fields)) {
                $field = 'COUNT(1)';
            } else {
                $field = 'COUNT(';
                if ($this->_fields[static::FIELD_DISTINCT]) {
                    $field .= 'DISTINCT(';
                }
                $field .= '`' . $this->_fields[static::FIELD_NAME] . '`';
                if ($this->_fields[static::FIELD_DISTINCT]) {
                    $field .= ')';
                }
                $field = ')';
            }

            $query = "
                SELECT
                    $field AS nb
                FROM
                    `" . $this->getDbPrefix() . $this->_dbContainer . "`";

            if ($this->_conditions->count()) {
                $query .= "
                WHERE
                    " . $this->_conditions->getPreparedConditions($this->_dbContainer) . "";
            }

            $prepared = Agl::app()->getDb()->getConnection()->prepare($query);

            if ($prepared->execute($this->_conditions->getPreparedValues())) {
                $result = $prepared->fetchObject();
                if (! $result) {
                    throw new Exception("The count query failed (table '" . $this->getDbPrefix() . $this->_dbContainer . "')");
                }
            } else {
                $error = $prepared->errorInfo();
                throw new Exception("The count query failed (table '" . $this->getDbPrefix() . $this->_dbContainer . "') with message '" . $error[2] . "'");
            }

            if (Agl::app()->isDebugMode()) {
                Agl::app()->getDb()->incrementCounter();
            }

            return (int)$result->{'nb'};
        } catch (Exception $e) {
            throw new Exception($e);
        }
    }
161800
public function getCommitOrderCalculator()
    {
        if ($this->commitOrderCalculator === null) {
            $this->commitOrderCalculator = new Internal\CommitOrderCalculator;
        }

        return $this->commitOrderCalculator;
    }
405701
public function commit() {
		
		if(null === $this -> connection) {
			$this -> connect();
		}

		$this -> connection -> commit();
		$this -> connection -> autocommit(true);

		return $this;
	}
1361588
function commit() {
		$this->savepoint--;

		if ($this->savepoint == 0) {
			$this->dbh->commit();
		}
		else { // not finished with transaction yet
			$this->dbh->exec('RELEASE SAVEPOINT save'.$this->savepoint);
		}

		return $this;
	}
546648
protected function doCdUp()
    {
        $connection = $this->connection;

        return $this->retry(function () use ($connection) {
            $res = @ftp_cdup($connection);

            if (false === $res) {
                throw new \RuntimeException("Cdup failed");
            }
        });
    }
414335
public function commit() {
        if ($this->transactionLevel < 0) throw new RuntimeException('Negative transaction nesting level detected: '.$this->transactionLevel);

        if      (!$this->isConnected())    trigger_error('Not connected', E_USER_WARNING);
        else if (!$this->transactionLevel) trigger_error('No database transaction to commit', E_USER_WARNING);
        else {
            if ($this->transactionLevel == 1)
                $this->execute('commit');
            $this->transactionLevel--;
        }
        return $this;
    }
345976
public function commit()
    {
        $res = null;

        if ($this->transLevel == 0) {
            $this->cleanAfterCommit();
            throw $this->createException('Commit without transaction');
        }

        if (!empty($this->transLevelRolledBack[$this->transLevel])) {
            $this->transLevel--;
            return $this;
        }

        if (empty($this->pendingTransactionBegin[$this->transLevel])) {
            $this->dbTransLevel--;

            if ($this->dbTransLevel == 0) {
                $res = pg_query($this->pgConn, 'commit');
            }

            if ($res === false) {
                $this->cleanAfterCommit();
                throw $this->createException();
            }
        }

        $this->afterCommit();
        $this->transLevel--;

        return $this;
    }
1061501
protected function collectBranch()
    {
        $branchesResult = $this->command->getBranches();

        foreach ($branchesResult as $result) {
            if (strpos($result, '* ') === 0) {
                $exploded = explode('* ', $result, 2);

                return $exploded[1];
            }
        }

        throw new \RuntimeException();
    }
690309
public function commit()
    {
        if ($this->disableTransactionHandling) {
            return;
        }

        if (null === $this->session) {
            throw new RuntimeAdapterException('Transaction not started');
        }

        $this->session->commitTransaction();
        $this->session->endSession();
        $this->session = null;
    }
414387
public function getHeadCommit()
    {
        $base = Project::getProjectBaseFromUrl($this->getUri()) . '/git/commits';

        return Commit::get($this->head_commit, $base, $this->client);
    }
1038024
public function update(): Schema
    {
        if ('cli' !== PHP_SAPI) {
            throw new \RuntimeException('This should only be called from the command line');
        }
        $metadata        = $this->getAllMetaData();
        $schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata);
        if (0 !== count($schemaUpdateSql)) {
            $connection = $this->entityManager->getConnection();
            foreach ($schemaUpdateSql as $sql) {
                try {
                    $connection->executeQuery($sql);
                } catch (DBALException $e) {
                    throw new DoctrineStaticMetaException(
                        "exception running update sql:\n$sql\n",
                        $e->getCode(),
                        $e
                    );
                }
            }
        }
        $this->generateProxies();

        return $this;
    }
1328042
public function serialize()
    {
        if ($this->inTransaction()) {
            throw new \RuntimeException('Can not serialize in transaction');
        }
        return serialize(array(
            $this->dsn,
            $this->user,
            $this->password,
            $this->options,
        ));
    }
84148
public function getKey()
    {
        $repository = $this->om->getRepository($this->modelName);
        $count = 0;

        do {
            ++$count;

            if ($count > static::MAX_API_KEY_GENERATION_ATTEMPTS) {
                throw new \RuntimeException(sprintf(
                    'Unable to generate a new api key, stopping after %d tries!',
                    static::MAX_API_KEY_GENERATION_ATTEMPTS
                ));
            }

            $key = $this->doGenerate();
        } while (null !== $repository->findOneBy(array($this->metadata->getPropertyName(ClassMetadata::API_KEY_PROPERTY) => $key)));

        return $key;
    }
912185
public function commit()
    {
        if (!$this->nested || $this->depth <= 1) {
            parent::commit();
        } else {
            $this->depth--;
        }

        return $this;
    }
192517
protected function gitRepo($throw_exception = true)
    {
        $options = $this->getOptions();

        $repo = isset($options['repo_url'])
            ? $options['repo_url']
            : null;

        if (!isset($repo) && $throw_exception) {
            throw new DeploymentRuntimeException(
                'Missing Git repository in deploy options.'
            );
        }

        return $repo;
    }