Page MenuHomePhabricator

D9848.id23629.diff
No OneTemporary

D9848.id23629.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -492,6 +492,7 @@
'DiffusionController' => 'applications/diffusion/controller/DiffusionController.php',
'DiffusionDiffController' => 'applications/diffusion/controller/DiffusionDiffController.php',
'DiffusionDoorkeeperCommitFeedStoryPublisher' => 'applications/diffusion/doorkeeper/DiffusionDoorkeeperCommitFeedStoryPublisher.php',
+ 'DiffusionEdgeTypeCommitHasTask' => 'applications/diffusion/edge/DiffusionEdgeTypeCommitHasTask.php',
'DiffusionEmptyResultView' => 'applications/diffusion/view/DiffusionEmptyResultView.php',
'DiffusionExternalController' => 'applications/diffusion/controller/DiffusionExternalController.php',
'DiffusionFileContent' => 'applications/diffusion/data/DiffusionFileContent.php',
@@ -920,6 +921,7 @@
'ManiphestCustomFieldStorage' => 'applications/maniphest/storage/ManiphestCustomFieldStorage.php',
'ManiphestCustomFieldStringIndex' => 'applications/maniphest/storage/ManiphestCustomFieldStringIndex.php',
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
+ 'ManiphestEdgeTypeTaskHasCommit' => 'applications/maniphest/edge/ManiphestEdgeTypeTaskHasCommit.php',
'ManiphestEdgeTypeTaskHasRevision' => 'applications/maniphest/edge/ManiphestEdgeTypeTaskHasRevision.php',
'ManiphestExcelDefaultFormat' => 'applications/maniphest/export/ManiphestExcelDefaultFormat.php',
'ManiphestExcelFormat' => 'applications/maniphest/export/ManiphestExcelFormat.php',
@@ -3205,6 +3207,7 @@
'DiffusionController' => 'PhabricatorController',
'DiffusionDiffController' => 'DiffusionController',
'DiffusionDoorkeeperCommitFeedStoryPublisher' => 'DoorkeeperFeedStoryPublisher',
+ 'DiffusionEdgeTypeCommitHasTask' => 'PhabricatorEdgeType',
'DiffusionEmptyResultView' => 'DiffusionView',
'DiffusionExternalController' => 'DiffusionController',
'DiffusionFileContentQuery' => 'DiffusionQuery',
@@ -3691,6 +3694,7 @@
'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'ManiphestDAO' => 'PhabricatorLiskDAO',
+ 'ManiphestEdgeTypeTaskHasCommit' => 'PhabricatorEdgeType',
'ManiphestEdgeTypeTaskHasRevision' => 'PhabricatorEdgeType',
'ManiphestExcelDefaultFormat' => 'ManiphestExcelFormat',
'ManiphestExportController' => 'ManiphestController',
diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php
--- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php
+++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_getcommits_Method.php
@@ -274,7 +274,7 @@
* Enhances the commits list with Maniphest information.
*/
private function addManiphestInformation(array $commits) {
- $task_type = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK;
+ $task_type = DiffusionEdgeTypeCommitHasTask::EDGECONST;
$commit_phids = ipull($commits, 'commitPHID');
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -420,7 +420,7 @@
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($commit_phid))
->withEdgeTypes(array(
- PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK,
+ DiffusionEdgeTypeCommitHasTask::EDGECONST,
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT,
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV,
));
@@ -428,7 +428,7 @@
$edges = $edge_query->execute();
$task_phids = array_keys(
- $edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK]);
+ $edges[$commit_phid][DiffusionEdgeTypeCommitHasTask::EDGECONST]);
$proj_phids = array_keys(
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT]);
$revision_phid = key(
diff --git a/src/applications/diffusion/edge/DiffusionEdgeTypeCommitHasTask.php b/src/applications/diffusion/edge/DiffusionEdgeTypeCommitHasTask.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/edge/DiffusionEdgeTypeCommitHasTask.php
@@ -0,0 +1,111 @@
+<?php
+
+final class DiffusionEdgeTypeCommitHasTask extends PhabricatorEdgeType {
+
+ const EDGECONST = 2;
+
+ public function getEdgeConstant() {
+ return self::EDGECONST;
+ }
+
+ public function getInverseEdgeConstant() {
+ return ManiphestEdgeTypeTaskHasCommit::EDGECONST;
+ }
+
+ public function shouldWriteInverseTransactions() {
+ // TODO: This should happen after T4896, but Diffusion does not support
+ // transactions yet.
+ return false;
+ }
+
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s task(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s task(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s task(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s task(s) to %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s task(s) from %s: %s.',
+ $actor,
+ $rem_count,
+ $object,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s task(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+}
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -51,7 +51,7 @@
->setViewer($user)
->readFieldsFromStorage($task);
- $e_commit = PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT;
+ $e_commit = ManiphestEdgeTypeTaskHasCommit::EDGECONST;
$e_dep_on = PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK;
$e_dep_by = PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK;
$e_rev = ManiphestEdgeTypeTaskHasRevision::EDGECONST;
@@ -601,7 +601,7 @@
$handles = $this->getLoadedHandles();
$commit_phids = array_keys(
- $edges[PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT]);
+ $edges[ManiphestEdgeTypeTaskHasCommit::EDGECONST]);
if ($commit_phids) {
$commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV;
$drev_edges = id(new PhabricatorEdgeQuery())
diff --git a/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasCommit.php b/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasCommit.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasCommit.php
@@ -0,0 +1,111 @@
+<?php
+
+final class ManiphestEdgeTypeTaskHasCommit extends PhabricatorEdgeType {
+
+ const EDGECONST = 1;
+
+ public function getEdgeConstant() {
+ return self::EDGECONST;
+ }
+
+ public function getInverseEdgeConstant() {
+ return DiffusionEdgeTypeCommitHasTask::EDGECONST;
+ }
+
+ public function shouldWriteInverseTransactions() {
+ // TODO: This should happen after T4896, but Diffusion does not support
+ // transactions yet.
+ return false;
+ }
+
+ public function getTransactionAddString(
+ $actor,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s commit(s): %s.',
+ $actor,
+ $add_count,
+ $add_edges);
+ }
+
+ public function getTransactionRemoveString(
+ $actor,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s commit(s): %s.',
+ $actor,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getTransactionEditString(
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s commit(s), added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+ public function getFeedAddString(
+ $actor,
+ $object,
+ $add_count,
+ $add_edges) {
+
+ return pht(
+ '%s added %s commit(s) to %s: %s.',
+ $actor,
+ $add_count,
+ $object,
+ $add_edges);
+ }
+
+ public function getFeedRemoveString(
+ $actor,
+ $object,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s removed %s commit(s) from %s: %s.',
+ $actor,
+ $rem_count,
+ $object,
+ $rem_edges);
+ }
+
+ public function getFeedEditString(
+ $actor,
+ $object,
+ $total_count,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges) {
+
+ return pht(
+ '%s edited %s commit(s) for %s, added %s: %s; removed %s: %s.',
+ $actor,
+ $total_count,
+ $object,
+ $add_count,
+ $add_edges,
+ $rem_count,
+ $rem_edges);
+ }
+
+}
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -448,28 +448,16 @@
foreach ($tasks as $task_id => $task) {
$xactions = array();
- // TODO: Swap this for a real edge transaction once the weirdness in
- // Maniphest edges is sorted out. Currently, Maniphest reacts to an edge
- // edit on this edge.
- id(new PhabricatorEdgeEditor())
- ->addEdge(
- $task->getPHID(),
- PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT,
- $commit->getPHID())
- ->save();
-
- /* TODO: Do this instead of the above.
-
+ $edge_type = ManiphestEdgeTypeTaskHasCommit::EDGECONST;
$xactions[] = id(new ManiphestTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
- ->setMetadataValue('edge:type', $edge_task_has_commit)
+ ->setMetadataValue('edge:type', $edge_type)
->setNewValue(
array(
'+' => array(
$commit->getPHID() => $commit->getPHID(),
),
));
- */
$status = $task_statuses[$task_id];
if ($status) {
diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php
--- a/src/applications/search/controller/PhabricatorSearchAttachController.php
+++ b/src/applications/search/controller/PhabricatorSearchAttachController.php
@@ -293,10 +293,10 @@
$map = array(
$t_cmit => array(
- $t_task => PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK,
+ $t_task => DiffusionEdgeTypeCommitHasTask::EDGECONST,
),
$t_task => array(
- $t_cmit => PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT,
+ $t_cmit => ManiphestEdgeTypeTaskHasCommit::EDGECONST,
$t_task => PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK,
$t_drev => ManiphestEdgeTypeTaskHasRevision::EDGECONST,
$t_mock => PhabricatorEdgeConfig::TYPE_TASK_HAS_MOCK,
diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
--- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
+++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
@@ -5,9 +5,6 @@
const TABLE_NAME_EDGE = 'edge';
const TABLE_NAME_EDGEDATA = 'edgedata';
- const TYPE_TASK_HAS_COMMIT = 1;
- const TYPE_COMMIT_HAS_TASK = 2;
-
const TYPE_TASK_DEPENDS_ON_TASK = 3;
const TYPE_TASK_DEPENDED_ON_BY_TASK = 4;
@@ -123,9 +120,6 @@
private static function getInverse($edge_type) {
static $map = array(
- self::TYPE_TASK_HAS_COMMIT => self::TYPE_COMMIT_HAS_TASK,
- self::TYPE_COMMIT_HAS_TASK => self::TYPE_TASK_HAS_COMMIT,
-
self::TYPE_TASK_DEPENDS_ON_TASK => self::TYPE_TASK_DEPENDED_ON_BY_TASK,
self::TYPE_TASK_DEPENDED_ON_BY_TASK => self::TYPE_TASK_DEPENDS_ON_TASK,
@@ -246,11 +240,9 @@
public static function getEditStringForEdgeType($type) {
switch ($type) {
- case self::TYPE_TASK_HAS_COMMIT:
case self::TYPE_PROJECT_HAS_COMMIT:
case self::TYPE_DREV_HAS_COMMIT:
return '%s edited commit(s), added %d: %s; removed %d: %s.';
- case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_TASK_DEPENDS_ON_TASK:
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
case self::TYPE_MOCK_HAS_TASK:
@@ -322,7 +314,6 @@
public static function getAddStringForEdgeType($type) {
switch ($type) {
- case self::TYPE_TASK_HAS_COMMIT:
case self::TYPE_PROJECT_HAS_COMMIT:
case self::TYPE_DREV_HAS_COMMIT:
return '%s added %d commit(s): %s.';
@@ -332,7 +323,6 @@
return '%s added %d dependencie(s): %s.';
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
return '%s added %d blocked task(s): %s.';
- case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s added %d task(s): %s.';
case self::TYPE_DREV_DEPENDED_ON_BY_DREV:
@@ -400,7 +390,6 @@
public static function getRemoveStringForEdgeType($type) {
switch ($type) {
- case self::TYPE_TASK_HAS_COMMIT:
case self::TYPE_PROJECT_HAS_COMMIT:
case self::TYPE_DREV_HAS_COMMIT:
return '%s removed %d commit(s): %s.';
@@ -408,7 +397,6 @@
return '%s removed %d blocking task(s): %s.';
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
return '%s removed %d blocked task(s): %s.';
- case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_MOCK_HAS_TASK:
return '%s removed %d task(s): %s.';
case self::TYPE_DREV_DEPENDS_ON_DREV:
@@ -475,11 +463,9 @@
public static function getFeedStringForEdgeType($type) {
switch ($type) {
- case self::TYPE_TASK_HAS_COMMIT:
case self::TYPE_PROJECT_HAS_COMMIT:
case self::TYPE_DREV_HAS_COMMIT:
return '%s updated commits of %s.';
- case self::TYPE_COMMIT_HAS_TASK:
case self::TYPE_TASK_DEPENDS_ON_TASK:
case self::TYPE_TASK_DEPENDED_ON_BY_TASK:
case self::TYPE_MOCK_HAS_TASK:

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 22, 4:34 AM (1 w, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6723859
Default Alt Text
D9848.id23629.diff (15 KB)

Event Timeline