Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialDiff.php
| Show First 20 Lines • Show All 483 Lines • ▼ Show 20 Lines | /* -( HarbormasterBuildableInterface )------------------------------------- */ | ||||
| public function getStagingRef() { | public function getStagingRef() { | ||||
| // TODO: We're just hoping to get lucky. Instead, `arc` should store | // TODO: We're just hoping to get lucky. Instead, `arc` should store | ||||
| // where it sent changes and we should only provide staging details | // where it sent changes and we should only provide staging details | ||||
| // if we reasonably believe they are accurate. | // if we reasonably believe they are accurate. | ||||
| return 'refs/tags/phabricator/diff/'.$this->getID(); | return 'refs/tags/phabricator/diff/'.$this->getID(); | ||||
| } | } | ||||
| public function loadTargetBranch() { | |||||
| // TODO: This is sketchy, but just eat the query cost until this can get | |||||
| // cleaned up. | |||||
| // For now, we're only returning a target if there's exactly one and it's | |||||
| // a branch, since we don't support landing to more esoteric targets like | |||||
| // tags yet. | |||||
| $property = id(new DifferentialDiffProperty())->loadOneWhere( | |||||
| 'diffID = %d AND name = %s', | |||||
| $this->getID(), | |||||
| 'arc:onto'); | |||||
| if (!$property) { | |||||
| return null; | |||||
| } | |||||
| $data = $property->getData(); | |||||
| if (!$data) { | |||||
| return null; | |||||
| } | |||||
| if (!is_array($data)) { | |||||
| return null; | |||||
| } | |||||
| if (count($data) != 1) { | |||||
| return null; | |||||
| } | |||||
| $onto = head($data); | |||||
| if (!is_array($onto)) { | |||||
| return null; | |||||
| } | |||||
| $type = idx($onto, 'type'); | |||||
| if ($type != 'branch') { | |||||
| return null; | |||||
| } | |||||
| return idx($onto, 'name'); | |||||
| } | |||||
| /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
| public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
| return new DifferentialDiffEditor(); | return new DifferentialDiffEditor(); | ||||
| } | } | ||||
| Show All 40 Lines | |||||