Changeset View
Changeset View
Standalone View
Standalone View
src/repository/marker/ArcanistMarkerRef.php
| <?php | <?php | ||||
| final class ArcanistMarkerRef | final class ArcanistMarkerRef | ||||
| extends ArcanistRef | extends ArcanistRef { | ||||
| implements | |||||
| ArcanistDisplayRefInterface { | |||||
| const HARDPOINT_COMMITREF = 'arc.marker.commitRef'; | const HARDPOINT_COMMITREF = 'arc.marker.commitRef'; | ||||
| const HARDPOINT_WORKINGCOPYSTATEREF = 'arc.marker.workingCopyStateRef'; | const HARDPOINT_WORKINGCOPYSTATEREF = 'arc.marker.workingCopyStateRef'; | ||||
| const HARDPOINT_REMOTEREF = 'arc.marker.remoteRef'; | const HARDPOINT_REMOTEREF = 'arc.marker.remoteRef'; | ||||
| const TYPE_BRANCH = 'branch'; | const TYPE_BRANCH = 'branch'; | ||||
| const TYPE_BOOKMARK = 'bookmark'; | const TYPE_BOOKMARK = 'bookmark'; | ||||
| private $name; | private $name; | ||||
| private $markerType; | private $markerType; | ||||
| private $epoch; | private $epoch; | ||||
| private $markerHash; | private $markerHash; | ||||
| private $commitHash; | private $commitHash; | ||||
| private $displayHash; | private $displayHash; | ||||
| private $treeHash; | private $treeHash; | ||||
| private $summary; | private $summary; | ||||
| private $message; | private $message; | ||||
| private $isActive = false; | private $isActive = false; | ||||
| public function getRefDisplayName() { | public function getRefDisplayName() { | ||||
| return $this->getDisplayRefObjectName(); | |||||
| } | |||||
| public function getDisplayRefObjectName() { | |||||
| switch ($this->getMarkerType()) { | switch ($this->getMarkerType()) { | ||||
| case self::TYPE_BRANCH: | case self::TYPE_BRANCH: | ||||
| return pht('Branch "%s"', $this->getName()); | return pht('Branch "%s"', $this->getName()); | ||||
| case self::TYPE_BOOKMARK: | case self::TYPE_BOOKMARK: | ||||
| return pht('Bookmark "%s"', $this->getName()); | return pht('Bookmark "%s"', $this->getName()); | ||||
| default: | default: | ||||
| return pht('Marker "%s"', $this->getName()); | return pht('Marker "%s"', $this->getName()); | ||||
| } | } | ||||
| } | } | ||||
| public function getDisplayRefTitle() { | |||||
| return pht( | |||||
| '%s %s', | |||||
| $this->getDisplayHash(), | |||||
| $this->getSummary()); | |||||
| } | |||||
| protected function newHardpoints() { | protected function newHardpoints() { | ||||
| return array( | return array( | ||||
| $this->newHardpoint(self::HARDPOINT_COMMITREF), | $this->newHardpoint(self::HARDPOINT_COMMITREF), | ||||
| $this->newHardpoint(self::HARDPOINT_WORKINGCOPYSTATEREF), | $this->newHardpoint(self::HARDPOINT_WORKINGCOPYSTATEREF), | ||||
| $this->newHardpoint(self::HARDPOINT_REMOTEREF), | $this->newHardpoint(self::HARDPOINT_REMOTEREF), | ||||
| ); | ); | ||||
| } | } | ||||
| Show All 37 Lines | public function setDisplayHash($display_hash) { | ||||
| $this->displayHash = $display_hash; | $this->displayHash = $display_hash; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDisplayHash() { | public function getDisplayHash() { | ||||
| return $this->displayHash; | return $this->displayHash; | ||||
| } | } | ||||
| public function setCommitHash($commit_hash) { | public function setCommitHash($commit_hash) { | ||||
| $this->commitHash = $commit_hash; | $this->commitHash = $commit_hash; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getCommitHash() { | public function getCommitHash() { | ||||
| return $this->commitHash; | return $this->commitHash; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | final class ArcanistMarkerRef | ||||
| public function attachRemoteRef(ArcanistRemoteRef $ref = null) { | public function attachRemoteRef(ArcanistRemoteRef $ref = null) { | ||||
| return $this->attachHardpoint(self::HARDPOINT_REMOTEREF, $ref); | return $this->attachHardpoint(self::HARDPOINT_REMOTEREF, $ref); | ||||
| } | } | ||||
| public function getRemoteRef() { | public function getRemoteRef() { | ||||
| return $this->getHardpoint(self::HARDPOINT_REMOTEREF); | return $this->getHardpoint(self::HARDPOINT_REMOTEREF); | ||||
| } | } | ||||
| protected function buildRefView(ArcanistRefView $view) { | |||||
| $title = pht( | |||||
| '%s %s', | |||||
| $this->getDisplayHash(), | |||||
| $this->getSummary()); | |||||
| $view | |||||
| ->setObjectName($this->getRefDisplayName()) | |||||
| ->setTitle($title); | |||||
| } | |||||
| } | } | ||||