@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+32 -25
+2
resources/sql/autopatches/20140126.diff.1.parentrevisionid.sql
··· 1 + ALTER TABLE {$NAMESPACE}_differential.differential_diff 2 + DROP COLUMN parentRevisionID;
+2
resources/sql/autopatches/20140126.diff.2.repositoryphid.sql
··· 1 + ALTER TABLE {$NAMESPACE}_differential.differential_diff 2 + ADD COLUMN repositoryPHID VARCHAR(64) COLLATE utf8_bin AFTER authorPHID;
+21 -23
src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group conduit 5 - */ 6 3 final class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod { 7 4 8 5 public function getMethodDescription() { ··· 16 13 'sourcePath' => 'required string', 17 14 'branch' => 'required string', 18 15 'bookmark' => 'optional string', 19 - 'sourceControlSystem' => 'required enum<svn, git>', 16 + 'sourceControlSystem' => 'required enum<svn, git, hg>', 20 17 'sourceControlPath' => 'required string', 21 18 'sourceControlBaseRevision' => 'required string', 22 - 'parentRevisionID' => 'optional revisionid', 23 19 'creationMethod' => 'optional string', 24 - 'authorPHID' => 'optional phid', 25 20 'arcanistProject' => 'optional string', 26 - 'repositoryUUID' => 'optional string', 27 21 'lintStatus' => 28 22 'required enum<none, skip, okay, warn, fail, postponed>', 29 23 'unitStatus' => 30 24 'required enum<none, skip, okay, warn, fail, postponed>', 25 + 'repositoryPHID' => 'optional phid', 26 + 27 + 'parentRevisionID' => 'deprecated', 28 + 'authorPHID' => 'deprecated', 29 + 'repositoryUUID' => 'deprecated', 31 30 ); 32 31 } 33 32 ··· 54 53 55 54 $diff->setBranch($request->getValue('branch')); 56 55 $diff->setCreationMethod($request->getValue('creationMethod')); 57 - $diff->setAuthorPHID($request->getValue('authorPHID')); 56 + $diff->setAuthorPHID($request->getViewer()->getPHID()); 58 57 $diff->setBookmark($request->getValue('bookmark')); 59 58 60 - $parent_id = $request->getValue('parentRevisionID'); 61 - if ($parent_id) { 62 - // NOTE: If the viewer can't see the parent revision, just don't set 63 - // a parent revision ID. This isn't used for anything meaningful. 64 - // TODO: Can we delete this entirely? 65 - $parent_rev = id(new DifferentialRevisionQuery()) 66 - ->setViewer($request->getUser()) 67 - ->withIDs(array($parent_id)) 68 - ->execute(); 69 - if ($parent_rev) { 70 - $parent_rev = head($parent_rev); 71 - if (!$parent_rev->isClosed()) { 72 - $diff->setParentRevisionID($parent_id); 73 - } 59 + // TODO: Remove this eventually; for now continue writing the UUID. Note 60 + // that we'll overwrite it below if we identify a repository, and `arc` 61 + // no longer sends it. This stuff is retained for backward compatibility. 62 + $diff->setRepositoryUUID($request->getValue('repositoryUUID')); 63 + 64 + $repository_phid = $request->getValue('repositoryPHID'); 65 + if ($repository_phid) { 66 + $repository = id(new PhabricatorRepositoryQuery()) 67 + ->setViewer($request->getViewer()) 68 + ->withPHIDs(array($repository_phid)) 69 + ->executeOne(); 70 + if ($repository) { 71 + $diff->setRepositoryPHID($repository->getPHID()); 72 + $diff->setRepositoryUUID($repository->getUUID()); 74 73 } 75 74 } 76 75 ··· 96 95 } 97 96 98 97 $diff->setArcanistProjectPHID($project_phid); 99 - $diff->setRepositoryUUID($request->getValue('repositoryUUID')); 100 98 101 99 switch ($request->getValue('lintStatus')) { 102 100 case 'skip':
+1 -2
src/applications/differential/storage/DifferentialDiff.php
··· 8 8 9 9 protected $revisionID; 10 10 protected $authorPHID; 11 + protected $repositoryPHID; 11 12 12 13 protected $sourceMachine; 13 14 protected $sourcePath; ··· 24 25 protected $branch; 25 26 protected $bookmark; 26 27 27 - protected $parentRevisionID; 28 28 protected $arcanistProjectPHID; 29 29 protected $creationMethod; 30 30 protected $repositoryUUID; ··· 223 223 public function getDiffDict() { 224 224 $dict = array( 225 225 'id' => $this->getID(), 226 - 'parent' => $this->getParentRevisionID(), 227 226 'revisionID' => $this->getRevisionID(), 228 227 'dateCreated' => $this->getDateCreated(), 229 228 'dateModified' => $this->getDateModified(),
+6
src/applications/repository/conduit/ConduitAPI_repository_query_Method.php
··· 22 22 'callsigns' => 'optional list<string>', 23 23 'vcsTypes' => 'optional list<string>', 24 24 'remoteURIs' => 'optional list<string>', 25 + 'uuids' => 'optional list<string>', 25 26 ); 26 27 } 27 28 ··· 61 62 $remote_uris = $request->getValue('remoteURIs', array()); 62 63 if ($remote_uris) { 63 64 $query->withRemoteURIs($remote_uris); 65 + } 66 + 67 + $uuids = $request->getValue('uuids', array()); 68 + if ($uuids) { 69 + $query->withUUIDs($uuids); 64 70 } 65 71 66 72 $repositories = $query->execute();