Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistGitAPI.php
Show First 20 Lines • Show All 591 Lines • ▼ Show 20 Lines | public function getSourceControlBaseRevision() { | ||||
list($stdout) = $this->execxLocal( | list($stdout) = $this->execxLocal( | ||||
'rev-parse %s', | 'rev-parse %s', | ||||
$this->getBaseCommit()); | $this->getBaseCommit()); | ||||
return rtrim($stdout, "\n"); | return rtrim($stdout, "\n"); | ||||
} | } | ||||
public function getCanonicalRevisionName($string) { | public function getCanonicalRevisionName($string) { | ||||
$match = null; | $match = null; | ||||
if (preg_match('/@([0-9]+)$/', $string, $match)) { | if (preg_match('/@([0-9]+)$/', $string, $match)) { | ||||
$stdout = $this->getHashFromFromSVNRevisionNumber($match[1]); | $stdout = $this->getHashFromFromSVNRevisionNumber($match[1]); | ||||
} else { | } else { | ||||
list($stdout) = $this->execxLocal( | list($stdout) = $this->execxLocal( | ||||
phutil_is_windows() | 'show -s --format=%s %s --', | ||||
? 'show -s --format=%C %s --' | |||||
: 'show -s --format=%s %s --', | |||||
'%H', | '%H', | ||||
$string); | $string); | ||||
} | } | ||||
return rtrim($stdout); | return rtrim($stdout); | ||||
} | } | ||||
private function executeSVNFindRev($input, $vcs) { | private function executeSVNFindRev($input, $vcs) { | ||||
$match = array(); | $match = array(); | ||||
list($stdout) = $this->execxLocal( | list($stdout) = $this->execxLocal( | ||||
'svn find-rev %s', | 'svn find-rev %s', | ||||
$input); | $input); | ||||
▲ Show 20 Lines • Show All 433 Lines • ▼ Show 20 Lines | private function getFileDataAtRevision($path, $revision) { | ||||
return $stdout; | return $stdout; | ||||
} | } | ||||
/** | /** | ||||
* Returns names of all the branches in the current repository. | * Returns names of all the branches in the current repository. | ||||
* | * | ||||
* @return list<dict<string, string>> Dictionary of branch information. | * @return list<dict<string, string>> Dictionary of branch information. | ||||
*/ | */ | ||||
public function getAllBranches() { | private function getAllBranches() { | ||||
$field_list = array( | $field_list = array( | ||||
'%(refname)', | '%(refname)', | ||||
'%(objectname)', | '%(objectname)', | ||||
'%(committerdate:raw)', | '%(committerdate:raw)', | ||||
'%(tree)', | '%(tree)', | ||||
'%(subject)', | '%(subject)', | ||||
'%(subject)%0a%0a%(body)', | '%(subject)%0a%0a%(body)', | ||||
'%02', | '%02', | ||||
Show All 29 Lines | foreach ($lines as $line) { | ||||
'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->newMarkerRef() | |||||
->setName($branch['name']) | |||||
->setIsActive($branch['current']) | |||||
->attachCommitRef($commit_ref); | |||||
} | |||||
return $refs; | |||||
} | |||||
public function getBaseCommitRef() { | public function getBaseCommitRef() { | ||||
$base_commit = $this->getBaseCommit(); | $base_commit = $this->getBaseCommit(); | ||||
if ($base_commit === self::GIT_MAGIC_ROOT_COMMIT) { | if ($base_commit === self::GIT_MAGIC_ROOT_COMMIT) { | ||||
return null; | return null; | ||||
} | } | ||||
$base_message = $this->getCommitMessage($base_commit); | $base_message = $this->getCommitMessage($base_commit); | ||||
▲ Show 20 Lines • Show All 645 Lines • ▼ Show 20 Lines | return array( | ||||
ArcanistMarkerRef::TYPE_BRANCH, | ArcanistMarkerRef::TYPE_BRANCH, | ||||
); | ); | ||||
} | } | ||||
protected function newMarkerRefQueryTemplate() { | protected function newMarkerRefQueryTemplate() { | ||||
return new ArcanistGitRepositoryMarkerQuery(); | return new ArcanistGitRepositoryMarkerQuery(); | ||||
} | } | ||||
} | } |