*/
public function getAllBranches() {
list($branch_info) = $this->execxLocal(
- 'branch --verbose --abbrev=40 --no-color');
+ 'branch --no-color');
$lines = explode("\n", rtrim($branch_info));
$result = array();
continue;
}
- list($current, $name, $hash, $desc) = preg_split('/\s+/', $line, 4);
+ list($current, $name) = preg_split('/\s+/', $line, 2);
$result[] = array(
'current' => !empty($current),
'name' => $name,
- 'hash' => $hash,
- 'desc' => $desc,
);
}
throw new ArcanistUsageException('No branches in this working copy.');
}
- $commit_map = $this->loadCommitInfo($branches, $repository_api);
- foreach ($branches as $key => $branch) {
- $branches[$key] += $commit_map[$branch['hash']];
- }
+ $branches = $this->loadCommitInfo($branches, $repository_api);
$revisions = $this->loadRevisions($branches);
array $branches,
ArcanistRepositoryAPI $repository_api) {
- // NOTE: "-s" is an option deep in git's diff argument parser that doesn't
- // seem to have much documentation and has no long form. It suppresses any
- // diff output.
+ $futures = array();
+ foreach ($branches as $branch) {
+ // NOTE: "-s" is an option deep in git's diff argument parser that doesn't
+ // seem to have much documentation and has no long form. It suppresses any
+ // diff output.
+ $futures[$branch['name']] = $repository_api->execFutureLocal(
+ 'show -s --format=%C %s',
+ '%H%x01%ct%x01%T%x01%s%x01%b',
+ $branch['name']);
+ }
- $commits = ipull($branches, 'hash');
- list($info) = $repository_api->execxLocal(
- 'show -s --format=%C %Ls',
- '%H%x01%ct%x01%T%x01%s%n%b%x02',
- $commits);
+ $branches = ipull($branches, null, 'name');
$commit_map = array();
+ foreach (Futures($futures) as $name => $future) {
+ list($info) = $future->resolvex();
+ list($hash, $epoch, $tree, $desc, $text) = explode("\1", trim($info), 5);
+
+ $branch = $branches[$name];
+ $branch['hash'] = $hash;
+ $branch['desc'] = $desc;
- $info = array_filter(explode("\2", trim($info)));
- foreach ($info as $line) {
- list($hash, $epoch, $tree, $text) = explode("\1", trim($line), 4);
try {
+ $text = $desc."\n".$text;
$message = ArcanistDifferentialCommitMessage::newFromRawCorpus($text);
$id = $message->getRevisionID();
- $commit_map[$hash] = array(
+ $branch += array(
'epoch' => (int)$epoch,
'tree' => $tree,
'revisionID' => $id,
);
} catch (ArcanistUsageException $ex) {
- // In case of invalid commit message which fails the parsing, do noting.
+ // In case of invalid commit message which fails the parsing,
+ // do nothing.
}
+
+ $commit_map[$hash] = $branch;
}
return $commit_map;