Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistGitAPI.php
Show First 20 Lines • Show All 1,008 Lines • ▼ Show 20 Lines | foreach ($lines as $line) { | ||||
$fields = explode("\1", $line, 6); | $fields = explode("\1", $line, 6); | ||||
list($ref, $hash, $epoch, $tree, $desc, $text) = $fields; | list($ref, $hash, $epoch, $tree, $desc, $text) = $fields; | ||||
$branch = $this->getBranchNameFromRef($ref); | $branch = $this->getBranchNameFromRef($ref); | ||||
if ($branch) { | if ($branch) { | ||||
$result[] = array( | $result[] = array( | ||||
'current' => ($branch === $current), | 'current' => ($branch === $current), | ||||
'name' => $branch, | 'name' => $branch, | ||||
'ref' => $ref, | |||||
'hash' => $hash, | 'hash' => $hash, | ||||
'tree' => $tree, | 'tree' => $tree, | ||||
'epoch' => (int)$epoch, | 'epoch' => (int)$epoch, | ||||
'desc' => $desc, | 'desc' => $desc, | ||||
'text' => $text, | 'text' => $text, | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
return $result; | return $result; | ||||
} | } | ||||
public function getAllBranchRefs() { | |||||
$branches = $this->getAllBranches(); | |||||
$refs = array(); | |||||
foreach ($branches as $branch) { | |||||
$commit_ref = $this->newCommitRef() | |||||
->setCommitHash($branch['hash']) | |||||
->setTreeHash($branch['tree']) | |||||
->setCommitEpoch($branch['epoch']) | |||||
->attachMessage($branch['text']); | |||||
$refs[] = $this->newBranchRef() | |||||
->setBranchName($branch['name']) | |||||
->setRefName($branch['ref']) | |||||
->setIsCurrentBranch($branch['current']) | |||||
->attachCommitRef($commit_ref); | |||||
} | |||||
return $refs; | |||||
} | |||||
public function getWorkingCopyRevision() { | public function getWorkingCopyRevision() { | ||||
list($stdout) = $this->execxLocal('rev-parse HEAD'); | list($stdout) = $this->execxLocal('rev-parse HEAD'); | ||||
return rtrim($stdout, "\n"); | return rtrim($stdout, "\n"); | ||||
} | } | ||||
public function getUnderlyingWorkingCopyRevision() { | public function getUnderlyingWorkingCopyRevision() { | ||||
list($err, $stdout) = $this->execManualLocal('svn find-rev HEAD'); | list($err, $stdout) = $this->execManualLocal('svn find-rev HEAD'); | ||||
if (!$err && $stdout) { | if (!$err && $stdout) { | ||||
▲ Show 20 Lines • Show All 433 Lines • Show Last 20 Lines |