@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Provide a real object ("PhabricatorRepositoryPushEvent") to represent an entire push transaction

Summary:
Ref T4677. Currently, we record individual actions in a push as PhabricatorRepositoryPushLogs, but tie them together only loosely with a `transactionKey`.

Provide a real PushEvent object, and move some of the denormalized fields to it. This primarily just gives us more robust infrastructure for building, e.g., email about pushes, for T4677, since we can act on real PHIDs rather than passing awkward identifiers around.

Test Plan:
- Performed migration.
- Looked at database for consistency.
- Browsed/queried push logs.
- Pushed a bunch of stuff.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4677

Differential Revision: https://secure.phabricator.com/D8615

+361 -65
+15
resources/sql/autopatches/20140325.push.1.event.sql
··· 1 + CREATE TABLE {$NAMESPACE}_repository.repository_pushevent ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + phid VARCHAR(64) NOT NULL COLLATE utf8_bin, 4 + repositoryPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 5 + epoch INT UNSIGNED NOT NULL, 6 + pusherPHID VARCHAR(64) NOT NULL COLLATE utf8_bin, 7 + remoteAddress INT UNSIGNED, 8 + remoteProtocol VARCHAR(32), 9 + rejectCode INT UNSIGNED NOT NULL, 10 + rejectDetails VARCHAR(64) COLLATE utf8_bin, 11 + 12 + UNIQUE KEY `key_phid` (phid), 13 + KEY `key_repository` (repositoryPHID) 14 + 15 + ) ENGINE=InnoDB, COLLATE=utf8_general_ci;
+5
resources/sql/autopatches/20140325.push.2.eventphid.sql
··· 1 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 2 + ADD pushEventPHID VARCHAR(64) NOT NULL COLLATE utf8_bin AFTER epoch; 3 + 4 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 5 + ADD KEY `key_event` (pushEventPHID);
+43
resources/sql/autopatches/20140325.push.3.groups.php
··· 1 + <?php 2 + 3 + $conn_w = id(new PhabricatorRepository())->establishConnection('w'); 4 + 5 + echo "Adding transaction log event groups...\n"; 6 + 7 + $logs = queryfx_all( 8 + $conn_w, 9 + 'SELECT * FROM %T GROUP BY transactionKey ORDER BY id ASC', 10 + 'repository_pushlog'); 11 + foreach ($logs as $log) { 12 + $id = $log['id']; 13 + echo "Migrating log {$id}...\n"; 14 + if ($log['pushEventPHID']) { 15 + continue; 16 + } 17 + 18 + $event_phid = id(new PhabricatorRepositoryPushEvent())->generatePHID(); 19 + 20 + queryfx( 21 + $conn_w, 22 + 'INSERT INTO %T (phid, repositoryPHID, epoch, pusherPHID, remoteAddress, 23 + remoteProtocol, rejectCode, rejectDetails) 24 + VALUES (%s, %s, %d, %s, %d, %s, %d, %s)', 25 + 'repository_pushevent', 26 + $event_phid, 27 + $log['repositoryPHID'], 28 + $log['epoch'], 29 + $log['pusherPHID'], 30 + $log['remoteAddress'], 31 + $log['remoteProtocol'], 32 + $log['rejectCode'], 33 + $log['rejectDetails']); 34 + 35 + queryfx( 36 + $conn_w, 37 + 'UPDATE %T SET pushEventPHID = %s WHERE transactionKey = %s', 38 + 'repository_pushlog', 39 + $event_phid, 40 + $log['transactionKey']); 41 + } 42 + 43 + echo "Done.\n";
+14
resources/sql/autopatches/20140325.push.4.prune.sql
··· 1 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 2 + DROP remoteAddress; 3 + 4 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 5 + DROP remoteProtocol; 6 + 7 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 8 + DROP transactionKey; 9 + 10 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 11 + DROP rejectCode; 12 + 13 + ALTER TABLE {$NAMESPACE}_repository.repository_pushlog 14 + DROP rejectDetails;
+10
src/__phutil_library_map__.php
··· 1958 1958 'PhabricatorRepositoryPHIDTypeArcanistProject' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeArcanistProject.php', 1959 1959 'PhabricatorRepositoryPHIDTypeCommit' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php', 1960 1960 'PhabricatorRepositoryPHIDTypeMirror' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeMirror.php', 1961 + 'PhabricatorRepositoryPHIDTypePushEvent' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypePushEvent.php', 1961 1962 'PhabricatorRepositoryPHIDTypePushLog' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypePushLog.php', 1962 1963 'PhabricatorRepositoryPHIDTypeRepository' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeRepository.php', 1963 1964 'PhabricatorRepositoryParsedChange' => 'applications/repository/data/PhabricatorRepositoryParsedChange.php', 1964 1965 'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php', 1965 1966 'PhabricatorRepositoryPullLocalDaemon' => 'applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php', 1967 + 'PhabricatorRepositoryPushEvent' => 'applications/repository/storage/PhabricatorRepositoryPushEvent.php', 1968 + 'PhabricatorRepositoryPushEventQuery' => 'applications/repository/query/PhabricatorRepositoryPushEventQuery.php', 1966 1969 'PhabricatorRepositoryPushLog' => 'applications/repository/storage/PhabricatorRepositoryPushLog.php', 1967 1970 'PhabricatorRepositoryPushLogQuery' => 'applications/repository/query/PhabricatorRepositoryPushLogQuery.php', 1968 1971 'PhabricatorRepositoryPushLogSearchEngine' => 'applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php', ··· 4792 4795 'PhabricatorRepositoryPHIDTypeArcanistProject' => 'PhabricatorPHIDType', 4793 4796 'PhabricatorRepositoryPHIDTypeCommit' => 'PhabricatorPHIDType', 4794 4797 'PhabricatorRepositoryPHIDTypeMirror' => 'PhabricatorPHIDType', 4798 + 'PhabricatorRepositoryPHIDTypePushEvent' => 'PhabricatorPHIDType', 4795 4799 'PhabricatorRepositoryPHIDTypePushLog' => 'PhabricatorPHIDType', 4796 4800 'PhabricatorRepositoryPHIDTypeRepository' => 'PhabricatorPHIDType', 4797 4801 'PhabricatorRepositoryParsedChange' => 'Phobject', 4798 4802 'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine', 4799 4803 'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon', 4804 + 'PhabricatorRepositoryPushEvent' => 4805 + array( 4806 + 0 => 'PhabricatorRepositoryDAO', 4807 + 1 => 'PhabricatorPolicyInterface', 4808 + ), 4809 + 'PhabricatorRepositoryPushEventQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 4800 4810 'PhabricatorRepositoryPushLog' => 4801 4811 array( 4802 4812 0 => 'PhabricatorRepositoryDAO',
+6 -3
src/applications/diffusion/controller/DiffusionPushLogListController.php
··· 52 52 // Reveal this if it's valid and the user can edit the repository. 53 53 $remote_addr = '-'; 54 54 if (isset($editable_repos[$log->getRepositoryPHID()])) { 55 - $remote_long = $log->getRemoteAddress(); 55 + $remote_long = $log->getPushEvent()->getRemoteAddress(); 56 56 if ($remote_long) { 57 57 $remote_addr = long2ip($remote_long); 58 58 } ··· 60 60 61 61 $callsign = $log->getRepository()->getCallsign(); 62 62 $rows[] = array( 63 + $log->getPushEvent()->getID(), 63 64 phutil_tag( 64 65 'a', 65 66 array( ··· 68 69 $callsign), 69 70 $this->getHandle($log->getPusherPHID())->renderLink(), 70 71 $remote_addr, 71 - $log->getRemoteProtocol(), 72 + $log->getPushEvent()->getRemoteProtocol(), 72 73 $log->getRefType(), 73 74 $log->getRefName(), 74 75 phutil_tag( ··· 86 87 87 88 // TODO: Make these human-readable. 88 89 $log->getChangeFlags(), 89 - $log->getRejectCode(), 90 + $log->getPushEvent()->getRejectCode(), 90 91 phabricator_datetime($log->getEpoch(), $viewer), 91 92 ); 92 93 } ··· 94 95 $table = id(new AphrontTableView($rows)) 95 96 ->setHeaders( 96 97 array( 98 + pht('Push'), 97 99 pht('Repository'), 98 100 pht('Pusher'), 99 101 pht('From'), ··· 108 110 )) 109 111 ->setColumnClasses( 110 112 array( 113 + '', 111 114 '', 112 115 '', 113 116 '',
+28 -37
src/applications/diffusion/engine/DiffusionCommitHookEngine.php
··· 30 30 private $gitCommits = array(); 31 31 32 32 private $heraldViewerProjects; 33 + private $rejectCode = PhabricatorRepositoryPushLog::REJECT_BROKEN; 34 + private $rejectDetails; 33 35 34 36 35 37 /* -( Config )------------------------------------------------------------- */ ··· 60 62 $remote_address = max(0, ip2long($remote_address)); 61 63 $remote_address = nonempty($remote_address, null); 62 64 return $remote_address; 63 - } 64 - 65 - private function getTransactionKey() { 66 - if (!$this->transactionKey) { 67 - $entropy = Filesystem::readRandomBytes(64); 68 - $this->transactionKey = PhabricatorHash::digestForIndex($entropy); 69 - } 70 - return $this->transactionKey; 71 65 } 72 66 73 67 public function setSubversionTransactionInfo($transaction, $repository) { ··· 137 131 } catch (DiffusionCommitHookRejectException $ex) { 138 132 // If we're rejecting dangerous changes, flag everything that we've 139 133 // seen as rejected so it's clear that none of it was accepted. 140 - foreach ($all_updates as $update) { 141 - $update->setRejectCode( 142 - PhabricatorRepositoryPushLog::REJECT_DANGEROUS); 143 - } 134 + $this->rejectCode = PhabricatorRepositoryPushLog::REJECT_DANGEROUS; 144 135 throw $ex; 145 136 } 146 137 ··· 156 147 157 148 // If we make it this far, we're accepting these changes. Mark all the 158 149 // logs as accepted. 159 - foreach ($all_updates as $update) { 160 - $update->setRejectCode(PhabricatorRepositoryPushLog::REJECT_ACCEPT); 161 - } 150 + $this->rejectCode = PhabricatorRepositoryPushLog::REJECT_ACCEPT; 162 151 } catch (Exception $ex) { 163 152 // We'll throw this again in a minute, but we want to save all the logs 164 153 // first. ··· 166 155 } 167 156 168 157 // Save all the logs no matter what the outcome was. 169 - foreach ($all_updates as $update) { 170 - $update->save(); 171 - } 158 + $event = $this->newPushEvent(); 159 + 160 + $event->setRejectCode($this->rejectCode); 161 + $event->setRejectDetails($this->rejectDetails); 162 + 163 + $event->openTransaction(); 164 + $event->save(); 165 + foreach ($all_updates as $update) { 166 + $update->setPushEventPHID($event->getPHID()); 167 + $update->save(); 168 + } 169 + $event->saveTransaction(); 172 170 173 171 if ($caught) { 174 172 throw $caught; ··· 296 294 } 297 295 298 296 if ($blocking_effect) { 299 - foreach ($all_updates as $update) { 300 - $update->setRejectCode(PhabricatorRepositoryPushLog::REJECT_HERALD); 301 - $update->setRejectDetails($blocking_effect->getRulePHID()); 302 - } 297 + $this->rejectCode = PhabricatorRepositoryPushLog::REJECT_HERALD; 298 + $this->rejectDetails = $blocking_effect->getRulePHID(); 303 299 304 300 $message = $blocking_effect->getTarget(); 305 301 if (!strlen($message)) { ··· 596 592 continue; 597 593 } 598 594 599 - // Mark everything as rejected by this hook. 600 - foreach ($updates as $update) { 601 - $update->setRejectCode( 602 - PhabricatorRepositoryPushLog::REJECT_EXTERNAL); 603 - $update->setRejectDetails(basename($hook)); 604 - } 595 + $this->rejectCode = PhabricatorRepositoryPushLog::REJECT_EXTERNAL; 596 + $this->rejectDetails = basename($hook); 605 597 606 598 throw new DiffusionCommitHookRejectException( 607 599 pht( ··· 983 975 984 976 985 977 private function newPushLog() { 986 - // NOTE: By default, we create these with REJECT_BROKEN as the reject 987 - // code. This indicates a broken hook, and covers the case where we 988 - // encounter some unexpected exception and consequently reject the changes. 989 - 990 978 // NOTE: We generate PHIDs up front so the Herald transcripts can pick them 991 979 // up. 992 980 $phid = id(new PhabricatorRepositoryPushLog())->generatePHID(); 993 981 994 982 return PhabricatorRepositoryPushLog::initializeNewLog($this->getViewer()) 995 983 ->setPHID($phid) 996 - ->attachRepository($this->getRepository()) 997 984 ->setRepositoryPHID($this->getRepository()->getPHID()) 998 - ->setEpoch(time()) 985 + ->setEpoch(time()); 986 + } 987 + 988 + private function newPushEvent() { 989 + $viewer = $this->getViewer(); 990 + return PhabricatorRepositoryPushEvent::initializeNewEvent($viewer) 991 + ->setRepositoryPHID($this->getRepository()->getPHID()) 999 992 ->setRemoteAddress($this->getRemoteAddressForLog()) 1000 993 ->setRemoteProtocol($this->getRemoteProtocol()) 1001 - ->setTransactionKey($this->getTransactionKey()) 1002 - ->setRejectCode(PhabricatorRepositoryPushLog::REJECT_BROKEN) 1003 - ->setRejectDetails(null); 994 + ->setEpoch(time()); 1004 995 } 1005 996 1006 997 public function loadChangesetsForCommit($identifier) {
+40
src/applications/repository/phid/PhabricatorRepositoryPHIDTypePushEvent.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositoryPHIDTypePushEvent 4 + extends PhabricatorPHIDType { 5 + 6 + const TYPECONST = 'PSHE'; 7 + 8 + public function getTypeConstant() { 9 + return self::TYPECONST; 10 + } 11 + 12 + public function getTypeName() { 13 + return pht('Push Event'); 14 + } 15 + 16 + public function newObject() { 17 + return new PhabricatorRepositoryPushEvent(); 18 + } 19 + 20 + protected function buildQueryForObjects( 21 + PhabricatorObjectQuery $query, 22 + array $phids) { 23 + 24 + return id(new PhabricatorRepositoryPushEventQuery()) 25 + ->withPHIDs($phids); 26 + } 27 + 28 + public function loadHandles( 29 + PhabricatorHandleQuery $query, 30 + array $handles, 31 + array $objects) { 32 + 33 + foreach ($handles as $phid => $handle) { 34 + $event = $objects[$phid]; 35 + 36 + $handle->setName(pht('Push Event %d', $event->getID())); 37 + } 38 + } 39 + 40 + }
+108
src/applications/repository/query/PhabricatorRepositoryPushEventQuery.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositoryPushEventQuery 4 + extends PhabricatorCursorPagedPolicyAwareQuery { 5 + 6 + private $ids; 7 + private $phids; 8 + private $repositoryPHIDs; 9 + private $pusherPHIDs; 10 + 11 + public function withIDs(array $ids) { 12 + $this->ids = $ids; 13 + return $this; 14 + } 15 + 16 + public function withPHIDs(array $phids) { 17 + $this->phids = $phids; 18 + return $this; 19 + } 20 + 21 + public function withRepositoryPHIDs(array $repository_phids) { 22 + $this->repositoryPHIDs = $repository_phids; 23 + return $this; 24 + } 25 + 26 + public function withPusherPHIDs(array $pusher_phids) { 27 + $this->pusherPHIDs = $pusher_phids; 28 + return $this; 29 + } 30 + 31 + protected function loadPage() { 32 + $table = new PhabricatorRepositoryPushEvent(); 33 + $conn_r = $table->establishConnection('r'); 34 + 35 + $data = queryfx_all( 36 + $conn_r, 37 + 'SELECT * FROM %T %Q %Q %Q', 38 + $table->getTableName(), 39 + $this->buildWhereClause($conn_r), 40 + $this->buildOrderClause($conn_r), 41 + $this->buildLimitClause($conn_r)); 42 + 43 + return $table->loadAllFromArray($data); 44 + } 45 + 46 + public function willFilterPage(array $events) { 47 + $repository_phids = mpull($events, 'getRepositoryPHID'); 48 + $repositories = id(new PhabricatorRepositoryQuery()) 49 + ->setViewer($this->getViewer()) 50 + ->withPHIDs($repository_phids) 51 + ->execute(); 52 + $repositories = mpull($repositories, null, 'getPHID'); 53 + 54 + foreach ($events as $key => $event) { 55 + $phid = $event->getRepositoryPHID(); 56 + if (empty($repositories[$phid])) { 57 + unset($events[$key]); 58 + continue; 59 + } 60 + $event->attachRepository($repositories[$phid]); 61 + } 62 + 63 + return $events; 64 + } 65 + 66 + 67 + private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 68 + $where = array(); 69 + 70 + if ($this->ids) { 71 + $where[] = qsprintf( 72 + $conn_r, 73 + 'id IN (%Ld)', 74 + $this->ids); 75 + } 76 + 77 + if ($this->phids) { 78 + $where[] = qsprintf( 79 + $conn_r, 80 + 'phid IN (%Ls)', 81 + $this->phids); 82 + } 83 + 84 + if ($this->repositoryPHIDs) { 85 + $where[] = qsprintf( 86 + $conn_r, 87 + 'repositoryPHID IN (%Ls)', 88 + $this->repositoryPHIDs); 89 + } 90 + 91 + if ($this->pusherPHIDs) { 92 + $where[] = qsprintf( 93 + $conn_r, 94 + 'pusherPHID in (%Ls)', 95 + $this->pusherPHIDs); 96 + } 97 + 98 + $where[] = $this->buildPagingClause($conn_r); 99 + 100 + return $this->formatWhereClause($where); 101 + } 102 + 103 + 104 + public function getQueryApplicationClass() { 105 + return 'PhabricatorApplicationDiffusion'; 106 + } 107 + 108 + }
+9 -13
src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
··· 56 56 } 57 57 58 58 public function willFilterPage(array $logs) { 59 - $repository_phids = mpull($logs, 'getRepositoryPHID'); 60 - if ($repository_phids) { 61 - $repositories = id(new PhabricatorRepositoryQuery()) 62 - ->setViewer($this->getViewer()) 63 - ->withPHIDs($repository_phids) 64 - ->execute(); 65 - $repositories = mpull($repositories, null, 'getPHID'); 66 - } else { 67 - $repositories = array(); 68 - } 59 + $event_phids = mpull($logs, 'getPushEventPHID'); 60 + $events = id(new PhabricatorRepositoryPushEventQuery()) 61 + ->setViewer($this->getViewer()) 62 + ->withPHIDs($event_phids) 63 + ->execute(); 64 + $events = mpull($events, null, 'getPHID'); 69 65 70 66 foreach ($logs as $key => $log) { 71 - $phid = $log->getRepositoryPHID(); 72 - if (empty($repositories[$phid])) { 67 + $event = idx($events, $log->getPushEventPHID()); 68 + if (!$event) { 73 69 unset($logs[$key]); 74 70 continue; 75 71 } 76 - $log->attachRepository($repositories[$phid]); 72 + $log->attachPushEvent($event); 77 73 } 78 74 79 75 return $logs;
+71
src/applications/repository/storage/PhabricatorRepositoryPushEvent.php
··· 1 + <?php 2 + 3 + /** 4 + * Groups a set of push logs corresponding to changes which were all pushed in 5 + * the same transaction. 6 + */ 7 + final class PhabricatorRepositoryPushEvent 8 + extends PhabricatorRepositoryDAO 9 + implements PhabricatorPolicyInterface { 10 + 11 + protected $repositoryPHID; 12 + protected $epoch; 13 + protected $pusherPHID; 14 + protected $remoteAddress; 15 + protected $remoteProtocol; 16 + protected $rejectCode; 17 + protected $rejectDetails; 18 + 19 + private $repository = self::ATTACHABLE; 20 + 21 + public static function initializeNewEvent(PhabricatorUser $viewer) { 22 + return id(new PhabricatorRepositoryPushEvent()) 23 + ->setPusherPHID($viewer->getPHID()); 24 + } 25 + 26 + public function getConfiguration() { 27 + return array( 28 + self::CONFIG_AUX_PHID => true, 29 + self::CONFIG_TIMESTAMPS => false, 30 + ) + parent::getConfiguration(); 31 + } 32 + 33 + public function generatePHID() { 34 + return PhabricatorPHID::generateNewPHID( 35 + PhabricatorRepositoryPHIDTypePushEvent::TYPECONST); 36 + } 37 + 38 + public function attachRepository(PhabricatorRepository $repository) { 39 + $this->repository = $repository; 40 + return $this; 41 + } 42 + 43 + public function getRepository() { 44 + return $this->assertAttached($this->repository); 45 + } 46 + 47 + 48 + /* -( PhabricatorPolicyInterface )----------------------------------------- */ 49 + 50 + 51 + public function getCapabilities() { 52 + return array( 53 + PhabricatorPolicyCapability::CAN_VIEW, 54 + ); 55 + } 56 + 57 + public function getPolicy($capability) { 58 + return $this->getRepository()->getPolicy($capability); 59 + } 60 + 61 + public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 62 + return $this->getRepository()->hasAutomaticCapability($capability, $viewer); 63 + } 64 + 65 + public function describeAutomaticCapability($capability) { 66 + return pht( 67 + "A repository's push events are visible to users who can see the ". 68 + "repository."); 69 + } 70 + 71 + }
+12 -12
src/applications/repository/storage/PhabricatorRepositoryPushLog.php
··· 33 33 protected $repositoryPHID; 34 34 protected $epoch; 35 35 protected $pusherPHID; 36 - protected $remoteAddress; 37 - protected $remoteProtocol; 38 - protected $transactionKey; 36 + protected $pushEventPHID; 39 37 protected $refType; 40 38 protected $refNameHash; 41 39 protected $refNameRaw; ··· 44 42 protected $refNew; 45 43 protected $mergeBase; 46 44 protected $changeFlags; 47 - protected $rejectCode; 48 - protected $rejectDetails; 49 45 50 46 private $dangerousChangeDescription = self::ATTACHABLE; 51 - private $repository = self::ATTACHABLE; 47 + private $pushEvent = self::ATTACHABLE; 52 48 53 49 public static function initializeNewLog(PhabricatorUser $viewer) { 54 50 return id(new PhabricatorRepositoryPushLog()) ··· 70 66 PhabricatorRepositoryPHIDTypePushLog::TYPECONST); 71 67 } 72 68 73 - public function attachRepository(PhabricatorRepository $repository) { 74 - $this->repository = $repository; 69 + public function getRepository() { 70 + return $this->getPushEvent()->getRepository(); 71 + } 72 + 73 + public function attachPushEvent(PhabricatorRepositoryPushEvent $push_event) { 74 + $this->pushEvent = $push_event; 75 75 return $this; 76 76 } 77 77 78 - public function getRepository() { 79 - return $this->assertAttached($this->repository); 78 + public function getPushEvent() { 79 + return $this->assertAttached($this->pushEvent); 80 80 } 81 81 82 82 public function getRefName() { ··· 131 131 } 132 132 133 133 public function getPolicy($capability) { 134 - return $this->getRepository()->getPolicy($capability); 134 + return $this->getPushEvent()->getPolicy($capability); 135 135 } 136 136 137 137 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 138 - return $this->getRepository()->hasAutomaticCapability($capability, $viewer); 138 + return $this->getPushEvent()->hasAutomaticCapability($capability, $viewer); 139 139 } 140 140 141 141 public function describeAutomaticCapability($capability) {