mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-21 04:01:29 +01:00
84857e4890
Summary: Ref T10895. This allows `arc browse <commit name>` to resolve to a revision, if an associated open revision exists. Test Plan: Ran `arc browse` with various arguments. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10895 Differential Revision: https://secure.phabricator.com/D16933
41 lines
940 B
PHP
41 lines
940 B
PHP
<?php
|
|
|
|
final class ArcanistGitCommitMessageHardpointLoader
|
|
extends ArcanistGitHardpointLoader {
|
|
|
|
const LOADERKEY = 'git.commit.message';
|
|
|
|
public function canLoadRef(ArcanistRef $ref) {
|
|
return ($ref instanceof ArcanistCommitRef);
|
|
}
|
|
|
|
public function canLoadHardpoint(ArcanistRef $ref, $hardpoint) {
|
|
return ($hardpoint == 'message');
|
|
}
|
|
|
|
public function loadHardpoints(array $refs, $hardpoint) {
|
|
$api = $this->getQuery()->getRepositoryAPI();
|
|
|
|
|
|
$futures = array();
|
|
foreach ($refs as $ref_key => $ref) {
|
|
$hash = $ref->getCommitHash();
|
|
|
|
$futures[$ref_key] = $api->execFutureLocal(
|
|
'log -n1 --format=%C %s --',
|
|
'%s%n%n%b',
|
|
$hash);
|
|
}
|
|
|
|
$iterator = $this->newFutureIterator($futures);
|
|
|
|
$results = array();
|
|
foreach ($iterator as $ref_key => $future) {
|
|
list($stdout) = $future->resolvex();
|
|
$results[$ref_key] = $stdout;
|
|
}
|
|
|
|
return $results;
|
|
}
|
|
|
|
}
|