Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistGitAPI.php
| Show First 20 Lines • Show All 1,084 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 !== null) { | if ($branch !== null) { | ||||
| $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 getWorkingCopyRevision() { | public function getAllBranchRefs() { | ||||
| list($stdout) = $this->execxLocal('rev-parse HEAD'); | $branches = $this->getAllBranches(); | ||||
| return rtrim($stdout, "\n"); | |||||
| $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); | |||||
| } | } | ||||
| public function getUnderlyingWorkingCopyRevision() { | return $refs; | ||||
| list($err, $stdout) = $this->execManualLocal('svn find-rev HEAD'); | |||||
| if (!$err && $stdout) { | |||||
| return rtrim($stdout, "\n"); | |||||
| } | } | ||||
| return $this->getWorkingCopyRevision(); | |||||
| public function getBaseCommitRef() { | |||||
| $base_commit = $this->getBaseCommit(); | |||||
| if ($base_commit === self::GIT_MAGIC_ROOT_COMMIT) { | |||||
| return null; | |||||
| } | |||||
| $base_message = $this->getCommitMessage($base_commit); | |||||
| // TODO: We should also pull the tree hash. | |||||
| return $this->newCommitRef() | |||||
| ->setCommitHash($base_commit) | |||||
| ->attachMessage($base_message); | |||||
| } | |||||
| public function getWorkingCopyRevision() { | |||||
| list($stdout) = $this->execxLocal('rev-parse HEAD'); | |||||
| return rtrim($stdout, "\n"); | |||||
| } | } | ||||
| public function isHistoryDefaultImmutable() { | public function isHistoryDefaultImmutable() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function supportsAmend() { | public function supportsAmend() { | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 557 Lines • Show Last 20 Lines | |||||