Use Edges to store dependencies between revisions in Differential
Summary: See D3006. Move this data to the edge store. Test Plan: - Created dependencies, migrated, verified dependencies were preserved. - Added new dependencies, they worked. Reviewers: vrana, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1162 Differential Revision: https://secure.phabricator.com/D3007
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,9 +46,9 @@ final class DifferentialDependenciesFieldSpecification
|
||||
}
|
||||
|
||||
private function getDependentRevisionPHIDs() {
|
||||
$revision = $this->getRevision();
|
||||
return $revision->getAttachedPHIDs(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_DREV);
|
||||
return PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$this->getRevision()->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -119,7 +119,6 @@ final class PhabricatorSearchAttachController
|
||||
} else {
|
||||
switch ($this->action) {
|
||||
case self::ACTION_ATTACH:
|
||||
case self::ACTION_DEPENDENCIES:
|
||||
$phids = $object->getAttachedPHIDs($attach_type);
|
||||
break;
|
||||
default:
|
||||
@@ -274,6 +273,7 @@ final class PhabricatorSearchAttachController
|
||||
private function getEdgeType($src_type, $dst_type) {
|
||||
$t_cmit = PhabricatorPHIDConstants::PHID_TYPE_CMIT;
|
||||
$t_task = PhabricatorPHIDConstants::PHID_TYPE_TASK;
|
||||
$t_drev = PhabricatorPHIDConstants::PHID_TYPE_DREV;
|
||||
|
||||
$map = array(
|
||||
$t_cmit => array(
|
||||
@@ -283,6 +283,9 @@ final class PhabricatorSearchAttachController
|
||||
$t_cmit => PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT,
|
||||
$t_task => PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK,
|
||||
),
|
||||
$t_drev => array(
|
||||
$t_drev => PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV,
|
||||
),
|
||||
);
|
||||
|
||||
if (empty($map[$src_type][$dst_type])) {
|
||||
|
||||
@@ -23,9 +23,13 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||
|
||||
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;
|
||||
|
||||
const TYPE_DREV_DEPENDS_ON_DREV = 5;
|
||||
const TYPE_DREV_DEPENDED_ON_BY_DREV = 6;
|
||||
|
||||
const TYPE_TEST_NO_CYCLE = 9000;
|
||||
|
||||
public static function getInverse($edge_type) {
|
||||
@@ -35,6 +39,9 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||
|
||||
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,
|
||||
|
||||
self::TYPE_DREV_DEPENDS_ON_DREV => self::TYPE_DREV_DEPENDED_ON_BY_DREV,
|
||||
self::TYPE_DREV_DEPENDED_ON_BY_DREV => self::TYPE_DREV_DEPENDS_ON_DREV,
|
||||
);
|
||||
|
||||
return idx($map, $edge_type);
|
||||
@@ -44,6 +51,7 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||
static $map = array(
|
||||
self::TYPE_TEST_NO_CYCLE => true,
|
||||
self::TYPE_TASK_DEPENDS_ON_TASK => true,
|
||||
self::TYPE_DREV_DEPENDS_ON_DREV => true,
|
||||
);
|
||||
return isset($map[$edge_type]);
|
||||
}
|
||||
|
||||
@@ -919,6 +919,11 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
|
||||
'type' => 'php',
|
||||
'name' => $this->getPatchPath('migrate-maniphest-dependencies.php'),
|
||||
),
|
||||
'migrate-differential-dependencies.php' => array(
|
||||
'type' => 'php',
|
||||
'name' => $this->getPatchPath(
|
||||
'migrate-differential-dependencies.php'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user