public function proceedChangesetsOfProject($host, array $project)
    {

        $dataService = $this->getDataService();
        $dataServiceName = $dataService->getName();

        // Clear the temp tables first
        $this->cleanupTempTables();

        // Query the data till we receive all data
        $startNum = 0;

        $sortKey = null;
        $changeSetQueryLimit = $dataService->getQueryLimit();

        do {
            $endNum = $startNum + $changeSetQueryLimit;

            $queryMessage = sprintf(
                'Querying %s via %s for changes %d...%s',
                $host,
                $dataServiceName,
                $startNum,
                $endNum
            );
            $this->output($queryMessage);

            $data = $dataService->getChangesets($project['name'], $sortKey, $startNum);
            $queryStatus = $this->transferJsonToArray(array_pop($data));

            $startNum += $queryStatus['rowCount'];

            $receivedMessage = sprintf('Received %d changes to process', $queryStatus['rowCount']);
            $this->output($receivedMessage);

            // One project can get n changesets. So lets do the same as one level above (the project loop)
            // Loop over all changesets and proceed (import / update) them ;)
            foreach ($data as $singleChangeset) {
                $changeSet = $this->transferJsonToArray($singleChangeset);

                $this->output($changeSet['subject']);

                // Import this changeset :)
                $this->proceedChangeset($changeSet, $project);
            }

            // First we query Gerrit for rows. If there are more rows than this limit,
            // we resume at the next changeset with the resume_sortkey feature.
            // But if the row cound lower the changeset query limit, we can exit here.
            // There are no more changesets in the next ssh query
            if ($queryStatus['rowCount'] > 0 && $queryStatus['rowCount'] < $changeSetQueryLimit) {
                break;
            }

            // We need to determine the last sortkey to continue the data reading for the next command.
            // How does it work? See the API documentation of Gerrit mentioned in the doc block
            $sortKey = $this->getLastSortKey($data);
        } while ($queryStatus['rowCount'] > 0);

        // Take care of 'dependsOn' relations in changesets
        $this->proceedChangeSetsDependsOnRelation();

        // Take care of 'neededBy' relations in changesets
        $this->proceedChangeSetsNeededByRelation();
    }
public function proceedChangesetsOfProject($host, array $project)
    {

        $dataService = $this->getDataService();
        $dataServiceName = $dataService->getName();

        // Clear the temp tables first
        $this->cleanupTempTables();

        // Query the data till we receive all data
        $startNum = 0;

        $sortKey = null;
        $changeSetQueryLimit = $dataService->getQueryLimit();

        do {
            $endNum = $startNum + $changeSetQueryLimit;

            $queryMessage = sprintf(
                'Querying %s via %s for changes %d...%s',
                $host,
                $dataServiceName,
                $startNum,
                $endNum
            );
            $this->output($queryMessage);

            $data = $dataService->getChangesets($project['name'], $sortKey, $startNum);
            $queryStatus = $this->transferJsonToArray(array_pop($data));

            $startNum += $queryStatus['rowCount'];

            $receivedMessage = sprintf('Received %d changes to process', $queryStatus['rowCount']);
            $this->output($receivedMessage);

            // One project can get n changesets. So lets do the same as one level above (the project loop)
            // Loop over all changesets and proceed (import / update) them ;)
            foreach ($data as $singleChangeset) {
                $changeSet = $this->transferJsonToArray($singleChangeset);

                $this->output($changeSet['subject']);

                // Import this changeset :)
                $this->proceedChangeset($changeSet, $project);
            }

            // First we query Gerrit for rows. If there are more rows than this limit,
            // we resume at the next changeset with the resume_sortkey feature.
            // But if the row cound lower the changeset query limit, we can exit here.
            // There are no more changesets in the next ssh query
            if ($queryStatus['rowCount'] > 0 && $queryStatus['rowCount'] < $changeSetQueryLimit) {
                break;
            }

            // We need to determine the last sortkey to continue the data reading for the next command.
            // How does it work? See the API documentation of Gerrit mentioned in the doc block
            $sortKey = $this->getLastSortKey($data);
        } while ($queryStatus['rowCount'] > 0);

        // Take care of 'dependsOn' relations in changesets
        $this->proceedChangeSetsDependsOnRelation();

        // Take care of 'neededBy' relations in changesets
        $this->proceedChangeSetsNeededByRelation();
    }
public function proceedChangesetsOfProject ( $ host , array $ project ) { $ dataService = $ this -> getDataService ( ) ; $ dataServiceName = $ dataService -> getName ( ) ; // Clear the temp tables first $ this -> cleanupTempTables ( ) ; // Query the data till we receive all data $ startNum = 0 ; $ sortKey = null ; $ changeSetQueryLimit = $ dataService -> getQueryLimit ( ) ; do { $ endNum = $ startNum + $ changeSetQueryLimit ; $ queryMessage = sprintf ( 'Querying %s via %s for changes %d...%s' , $ host , $ dataServiceName , $ startNum , $ endNum ) ; $ this -> output ( $ queryMessage ) ; $ data = $ dataService -> getChangesets ( $ project [ 'name' ] , $ sortKey , $ startNum ) ; $ queryStatus = $ this -> transferJsonToArray ( array_pop ( $ data ) ) ; $ startNum += $ queryStatus [ 'rowCount' ] ; $ receivedMessage = sprintf ( 'Received %d changes to process' , $ queryStatus [ 'rowCount' ] ) ; $ this -> output ( $ receivedMessage ) ; // One project can get n changesets. So lets do the same as one level above (the project loop) // Loop over all changesets and proceed (import / update) them ;) foreach ( $ data as $ singleChangeset ) { $ changeSet = $ this -> transferJsonToArray ( $ singleChangeset ) ; $ this -> output ( $ changeSet [ 'subject' ] ) ; // Import this changeset :) $ this -> proceedChangeset ( $ changeSet , $ project ) ; } // First we query Gerrit for rows. If there are more rows than this limit, // we resume at the next changeset with the resume_sortkey feature. // But if the row cound lower the changeset query limit, we can exit here. // There are no more changesets in the next ssh query if ( $ queryStatus [ 'rowCount' ] > 0 && $ queryStatus [ 'rowCount' ] < $ changeSetQueryLimit ) { break ; } // We need to determine the last sortkey to continue the data reading for the next command. // How does it work? See the API documentation of Gerrit mentioned in the doc block $ sortKey = $ this -> getLastSortKey ( $ data ) ; } while ( $ queryStatus [ 'rowCount' ] > 0 ) ; // Take care of 'dependsOn' relations in changesets $ this -> proceedChangeSetsDependsOnRelation ( ) ; // Take care of 'neededBy' relations in changesets $ this -> proceedChangeSetsNeededByRelation ( ) ; }
Imports all changes from a incoming project.

It queries the Gerrit system via SSH API with the configured limit.
It receives  all changesets, patchsets, approvals and comments automatically and store them in our database.

@see https://review.typo3.org/Documentation/cmd-query.html

@param string $host Gerrit server host
@param array $project The current project
@return void
Imports all changes from a incoming project .