Changeset View
Changeset View
Standalone View
Standalone View
src/ref/ArcanistCommitRef.php
<?php | <?php | ||||
final class ArcanistCommitRef | final class ArcanistCommitRef | ||||
extends ArcanistRef { | extends ArcanistRef { | ||||
private $commitHash; | private $commitHash; | ||||
private $treeHash; | private $treeHash; | ||||
private $commitEpoch; | private $commitEpoch; | ||||
private $authorEpoch; | private $authorEpoch; | ||||
private $upstream; | |||||
public function getRefIdentifier() { | public function getRefIdentifier() { | ||||
return pht('Commit %s', $this->getCommitHash()); | return pht('Commit %s', $this->getCommitHash()); | ||||
} | } | ||||
public function defineHardpoints() { | public function defineHardpoints() { | ||||
return array( | return array( | ||||
'message' => array( | 'message' => array( | ||||
'type' => 'string', | 'type' => 'string', | ||||
), | ), | ||||
'upstream' => array( | |||||
'type' => 'wild', | |||||
), | |||||
); | ); | ||||
} | } | ||||
public function setCommitHash($commit_hash) { | public function setCommitHash($commit_hash) { | ||||
$this->commitHash = $commit_hash; | $this->commitHash = $commit_hash; | ||||
return $this; | return $this; | ||||
} | } | ||||
Show All 40 Lines | final class ArcanistCommitRef | ||||
public function attachMessage($message) { | public function attachMessage($message) { | ||||
return $this->attachHardpoint('message', $message); | return $this->attachHardpoint('message', $message); | ||||
} | } | ||||
public function getMessage() { | public function getMessage() { | ||||
return $this->getHardpoint('message'); | return $this->getHardpoint('message'); | ||||
} | } | ||||
public function getURI() { | |||||
return $this->getUpstreamProperty('uri'); | |||||
} | |||||
private function getUpstreamProperty($key, $default = null) { | |||||
$upstream = $this->getHardpoint('upstream'); | |||||
if (!$upstream) { | |||||
return $default; | |||||
} | |||||
return idx($upstream, $key, $default); | |||||
} | |||||
} | } |