Update DifferentialDiff: add repositoryPHID, drop parentRevisionID
Summary: Moves away from ArcanistProjects: - Adds storage for diffs to be directly associated with a repository (instead of indirectly, through arcanist projects). Not really populated yet. - Drops `parentRevisionID`, which is obsoleted by the "Depends On" edge. This is not exposed in the UI anywhere and doesn't do anything. Resolves TODO. Test Plan: Ran storage upgrades, browsed around, lots of `grep`. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D8072
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE {$NAMESPACE}_differential.differential_diff
|
||||||
|
DROP COLUMN parentRevisionID;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE {$NAMESPACE}_differential.differential_diff
|
||||||
|
ADD COLUMN repositoryPHID VARCHAR(64) COLLATE utf8_bin AFTER authorPHID;
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group conduit
|
|
||||||
*/
|
|
||||||
final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
||||||
|
|
||||||
public function getMethodDescription() {
|
public function getMethodDescription() {
|
||||||
@@ -16,18 +13,20 @@ final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
|||||||
'sourcePath' => 'required string',
|
'sourcePath' => 'required string',
|
||||||
'branch' => 'required string',
|
'branch' => 'required string',
|
||||||
'bookmark' => 'optional string',
|
'bookmark' => 'optional string',
|
||||||
'sourceControlSystem' => 'required enum<svn, git>',
|
'sourceControlSystem' => 'required enum<svn, git, hg>',
|
||||||
'sourceControlPath' => 'required string',
|
'sourceControlPath' => 'required string',
|
||||||
'sourceControlBaseRevision' => 'required string',
|
'sourceControlBaseRevision' => 'required string',
|
||||||
'parentRevisionID' => 'optional revisionid',
|
|
||||||
'creationMethod' => 'optional string',
|
'creationMethod' => 'optional string',
|
||||||
'authorPHID' => 'optional phid',
|
|
||||||
'arcanistProject' => 'optional string',
|
'arcanistProject' => 'optional string',
|
||||||
'repositoryUUID' => 'optional string',
|
|
||||||
'lintStatus' =>
|
'lintStatus' =>
|
||||||
'required enum<none, skip, okay, warn, fail, postponed>',
|
'required enum<none, skip, okay, warn, fail, postponed>',
|
||||||
'unitStatus' =>
|
'unitStatus' =>
|
||||||
'required enum<none, skip, okay, warn, fail, postponed>',
|
'required enum<none, skip, okay, warn, fail, postponed>',
|
||||||
|
'repositoryPHID' => 'optional phid',
|
||||||
|
|
||||||
|
'parentRevisionID' => 'deprecated',
|
||||||
|
'authorPHID' => 'deprecated',
|
||||||
|
'repositoryUUID' => 'deprecated',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,23 +53,23 @@ final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
|||||||
|
|
||||||
$diff->setBranch($request->getValue('branch'));
|
$diff->setBranch($request->getValue('branch'));
|
||||||
$diff->setCreationMethod($request->getValue('creationMethod'));
|
$diff->setCreationMethod($request->getValue('creationMethod'));
|
||||||
$diff->setAuthorPHID($request->getValue('authorPHID'));
|
$diff->setAuthorPHID($request->getViewer()->getPHID());
|
||||||
$diff->setBookmark($request->getValue('bookmark'));
|
$diff->setBookmark($request->getValue('bookmark'));
|
||||||
|
|
||||||
$parent_id = $request->getValue('parentRevisionID');
|
// TODO: Remove this eventually; for now continue writing the UUID. Note
|
||||||
if ($parent_id) {
|
// that we'll overwrite it below if we identify a repository, and `arc`
|
||||||
// NOTE: If the viewer can't see the parent revision, just don't set
|
// no longer sends it. This stuff is retained for backward compatibility.
|
||||||
// a parent revision ID. This isn't used for anything meaningful.
|
$diff->setRepositoryUUID($request->getValue('repositoryUUID'));
|
||||||
// TODO: Can we delete this entirely?
|
|
||||||
$parent_rev = id(new DifferentialRevisionQuery())
|
$repository_phid = $request->getValue('repositoryPHID');
|
||||||
->setViewer($request->getUser())
|
if ($repository_phid) {
|
||||||
->withIDs(array($parent_id))
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
->execute();
|
->setViewer($request->getViewer())
|
||||||
if ($parent_rev) {
|
->withPHIDs(array($repository_phid))
|
||||||
$parent_rev = head($parent_rev);
|
->executeOne();
|
||||||
if (!$parent_rev->isClosed()) {
|
if ($repository) {
|
||||||
$diff->setParentRevisionID($parent_id);
|
$diff->setRepositoryPHID($repository->getPHID());
|
||||||
}
|
$diff->setRepositoryUUID($repository->getUUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +95,6 @@ final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$diff->setArcanistProjectPHID($project_phid);
|
$diff->setArcanistProjectPHID($project_phid);
|
||||||
$diff->setRepositoryUUID($request->getValue('repositoryUUID'));
|
|
||||||
|
|
||||||
switch ($request->getValue('lintStatus')) {
|
switch ($request->getValue('lintStatus')) {
|
||||||
case 'skip':
|
case 'skip':
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ final class DifferentialDiff
|
|||||||
|
|
||||||
protected $revisionID;
|
protected $revisionID;
|
||||||
protected $authorPHID;
|
protected $authorPHID;
|
||||||
|
protected $repositoryPHID;
|
||||||
|
|
||||||
protected $sourceMachine;
|
protected $sourceMachine;
|
||||||
protected $sourcePath;
|
protected $sourcePath;
|
||||||
@@ -24,7 +25,6 @@ final class DifferentialDiff
|
|||||||
protected $branch;
|
protected $branch;
|
||||||
protected $bookmark;
|
protected $bookmark;
|
||||||
|
|
||||||
protected $parentRevisionID;
|
|
||||||
protected $arcanistProjectPHID;
|
protected $arcanistProjectPHID;
|
||||||
protected $creationMethod;
|
protected $creationMethod;
|
||||||
protected $repositoryUUID;
|
protected $repositoryUUID;
|
||||||
@@ -223,7 +223,6 @@ final class DifferentialDiff
|
|||||||
public function getDiffDict() {
|
public function getDiffDict() {
|
||||||
$dict = array(
|
$dict = array(
|
||||||
'id' => $this->getID(),
|
'id' => $this->getID(),
|
||||||
'parent' => $this->getParentRevisionID(),
|
|
||||||
'revisionID' => $this->getRevisionID(),
|
'revisionID' => $this->getRevisionID(),
|
||||||
'dateCreated' => $this->getDateCreated(),
|
'dateCreated' => $this->getDateCreated(),
|
||||||
'dateModified' => $this->getDateModified(),
|
'dateModified' => $this->getDateModified(),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ final class ConduitAPI_repository_query_Method
|
|||||||
'callsigns' => 'optional list<string>',
|
'callsigns' => 'optional list<string>',
|
||||||
'vcsTypes' => 'optional list<string>',
|
'vcsTypes' => 'optional list<string>',
|
||||||
'remoteURIs' => 'optional list<string>',
|
'remoteURIs' => 'optional list<string>',
|
||||||
|
'uuids' => 'optional list<string>',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +64,11 @@ final class ConduitAPI_repository_query_Method
|
|||||||
$query->withRemoteURIs($remote_uris);
|
$query->withRemoteURIs($remote_uris);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$uuids = $request->getValue('uuids', array());
|
||||||
|
if ($uuids) {
|
||||||
|
$query->withUUIDs($uuids);
|
||||||
|
}
|
||||||
|
|
||||||
$repositories = $query->execute();
|
$repositories = $query->execute();
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user