Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14728166
D16413.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D16413.diff
View Options
diff --git a/src/applications/diffusion/herald/HeraldCommitAdapter.php b/src/applications/diffusion/herald/HeraldCommitAdapter.php
--- a/src/applications/diffusion/herald/HeraldCommitAdapter.php
+++ b/src/applications/diffusion/herald/HeraldCommitAdapter.php
@@ -7,7 +7,6 @@
protected $diff;
protected $revision;
- protected $repository;
protected $commit;
protected $commitData;
private $commitDiff;
@@ -42,6 +41,7 @@
public function setObject($object) {
$this->commit = $object;
+
return $this;
}
@@ -86,41 +86,26 @@
}
public function getTriggerObjectPHIDs() {
+ $project_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
+
return array_merge(
array(
- $this->repository->getPHID(),
+ $this->getRepository()->getPHID(),
$this->getPHID(),
),
- $this->repository->getProjectPHIDs());
+ $this->loadEdgePHIDs($project_type));
}
public function explainValidTriggerObjects() {
return pht('This rule can trigger for **repositories** and **projects**.');
}
- public static function newLegacyAdapter(
- PhabricatorRepository $repository,
- PhabricatorRepositoryCommit $commit,
- PhabricatorRepositoryCommitData $commit_data) {
-
- $object = new HeraldCommitAdapter();
-
- $commit->attachRepository($repository);
-
- $object->repository = $repository;
- $object->commit = $commit;
- $object->commitData = $commit_data;
-
- return $object;
- }
-
public function setCommit(PhabricatorRepositoryCommit $commit) {
$viewer = PhabricatorUser::getOmnipotentUser();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withIDs(array($commit->getRepositoryID()))
- ->needProjectPHIDs(true)
->executeOne();
if (!$repository) {
throw new Exception(pht('Unable to load repository!'));
@@ -137,7 +122,6 @@
$this->commit->attachRepository($repository);
$this->commit->attachCommitData($data);
- $this->repository = $repository;
$this->commitData = $data;
return $this;
@@ -150,7 +134,7 @@
public function loadAffectedPaths() {
if ($this->affectedPaths === null) {
$result = PhabricatorOwnerPathQuery::loadAffectedPaths(
- $this->repository,
+ $this->getRepository(),
$this->commit,
PhabricatorUser::getOmnipotentUser());
$this->affectedPaths = $result;
@@ -161,7 +145,7 @@
public function loadAffectedPackages() {
if ($this->affectedPackages === null) {
$packages = PhabricatorOwnersPackage::loadAffectedPackages(
- $this->repository,
+ $this->getRepository(),
$this->loadAffectedPaths());
$this->affectedPackages = $packages;
}
@@ -314,7 +298,7 @@
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $viewer,
- 'repository' => $this->repository,
+ 'repository' => $this->getRepository(),
'commit' => $this->commit->getCommitIdentifier(),
));
@@ -325,6 +309,10 @@
$params);
}
+ private function getRepository() {
+ return $this->getObject()->getRepository();
+ }
+
/* -( HarbormasterBuildableAdapterInterface )------------------------------ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 5:17 AM (21 h, 18 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7017862
Default Alt Text
D16413.diff (3 KB)
Attached To
Mode
D16413: Fix Herald test adapter for commits
Attached
Detach File
Event Timeline
Log In to Comment