Differential D21511 Diff 51200 src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
| Show All 39 Lines | protected function getResult(ConduitAPIRequest $request) { | ||||
| ); | ); | ||||
| } | } | ||||
| protected function getGitResult(ConduitAPIRequest $request) { | protected function getGitResult(ConduitAPIRequest $request) { | ||||
| $drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
| $repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
| $commit_hash = $request->getValue('commit'); | $commit_hash = $request->getValue('commit'); | ||||
| $against_hash = $request->getValue('against'); | $against_hash = $request->getValue('against'); | ||||
| $path = $request->getValue('path'); | $path = $request->getValue('path'); | ||||
| if (!strlen($path)) { | |||||
| $path = null; | |||||
| } | |||||
| $offset = $request->getValue('offset'); | $offset = $request->getValue('offset'); | ||||
| $limit = $request->getValue('limit'); | $limit = $request->getValue('limit'); | ||||
| if (strlen($against_hash)) { | if (strlen($against_hash)) { | ||||
| $commit_range = "${against_hash}..${commit_hash}"; | $commit_range = "${against_hash}..${commit_hash}"; | ||||
| } else { | } else { | ||||
| $commit_range = $commit_hash; | $commit_range = $commit_hash; | ||||
| } | } | ||||
| $argv = array(); | |||||
| $argv[] = '--skip'; | |||||
| $argv[] = $offset; | |||||
| $argv[] = '--max-count'; | |||||
| $argv[] = $limit; | |||||
| $argv[] = '--format=%H:%P'; | |||||
| $argv[] = gitsprintf('%s', $commit_range); | |||||
| $argv[] = '--'; | |||||
| if ($path !== null) { | |||||
| $argv[] = $path; | |||||
| } | |||||
| list($stdout) = $repository->execxLocalCommand( | list($stdout) = $repository->execxLocalCommand( | ||||
| 'log '. | 'log %Ls', | ||||
| '--skip=%d '. | $argv); | ||||
| '-n %d '. | |||||
| '--pretty=format:%s '. | |||||
| '%s -- %C', | |||||
| $offset, | |||||
| $limit, | |||||
| '%H:%P', | |||||
| gitsprintf('%s', $commit_range), | |||||
| // Git omits merge commits if the path is provided, even if it is empty. | |||||
| (strlen($path) ? csprintf('%s', $path) : '')); | |||||
| $lines = explode("\n", trim($stdout)); | $lines = explode("\n", trim($stdout)); | ||||
| $lines = array_filter($lines); | $lines = array_filter($lines); | ||||
| $hash_list = array(); | $hash_list = array(); | ||||
| $parent_map = array(); | $parent_map = array(); | ||||
| foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
| list($hash, $parents) = explode(':', $line); | list($hash, $parents) = explode(':', $line); | ||||
| ▲ Show 20 Lines • Show All 209 Lines • Show Last 20 Lines | |||||