@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.

Remove "cut point commit identifier" from Releeph

Summary: Ref T3656. Releeph denormalizes branch cut point identifiers into Branch objects, but this information isn't useful or used for sorting, filtering, or enforcing unique constraints. Instead, derive it via noramlized pathways from the `cutPointCommitPHID`.

Test Plan: Ran storage upgrade. Ran `releephwork.getbranch` and `releeph.getbranches`. Grepped for `cutPointCommitIdentifier`.

Reviewers: btrahan

Reviewed By: btrahan

CC: LegNeato, aran

Maniphest Tasks: T3656

Differential Revision: https://secure.phabricator.com/D6636

+48 -8
+2
resources/sql/patches/20130731.releephcutpointidentifier.sql
··· 1 + ALTER TABLE {$NAMESPACE}_releeph.releeph_branch 2 + DROP cutPointCommitIdentifier;
+1 -1
src/applications/releeph/conduit/ConduitAPI_releeph_getbranches_Method.php
··· 52 52 'branch' => $branch->getBasename(), 53 53 'fullBranchName' => $full_branch_name, 54 54 'symbolicName' => $branch->getSymbolicName(), 55 - 'cutPoint' => $branch->getCutPointCommitIdentifier(), 55 + 'cutPoint' => $cut_point_commit->getCommitIdentifier(), 56 56 ); 57 57 } 58 58 }
+9 -5
src/applications/releeph/conduit/work/ConduitAPI_releephwork_getbranch_Method.php
··· 26 26 } 27 27 28 28 protected function execute(ConduitAPIRequest $request) { 29 - $branch = id(new ReleephBranch()) 30 - ->loadOneWhere('phid = %s', $request->getValue('branchPHID')); 29 + $branch = id(new ReleephBranchQuery()) 30 + ->setViewer($request->getUser()) 31 + ->withPHIDs(array($request->getValue('branchPHID'))) 32 + ->needCutPointCommits(true) 33 + ->executeOne(); 31 34 32 35 $cut_phid = $branch->getCutPointCommitPHID(); 33 36 $phids = array($cut_phid); ··· 35 38 ->setViewer($request->getUser()) 36 39 ->loadHandles(); 37 40 38 - $project = $branch->loadReleephProject(); 39 - $repo = $project->loadPhabricatorRepository(); 41 + $project = $branch->getProject(); 42 + $repo = $project->getRepository(); 43 + $commit = $branch->getCutPointCommit(); 40 44 41 45 return array( 42 46 'branchName' => $branch->getName(), 43 47 'branchPHID' => $branch->getPHID(), 44 48 'vcsType' => $repo->getVersionControlSystem(), 45 - 'cutCommitID' => $branch->getCutPointCommitIdentifier(), 49 + 'cutCommitID' => $commit->getCommitIdentifier(), 46 50 'cutCommitName' => $handles[$cut_phid]->getName(), 47 51 'creatorPHID' => $branch->getCreatedByUserPHID(), 48 52 'trunk' => $project->getTrunkBranch(),
-1
src/applications/releeph/editor/ReleephBranchEditor.php
··· 46 46 ->setBasename($basename) 47 47 ->setReleephProjectID($this->releephProject->getID()) 48 48 ->setCreatedByUserPHID($this->requireActor()->getPHID()) 49 - ->setCutPointCommitIdentifier($cut_point->getCommitIdentifier()) 50 49 ->setCutPointCommitPHID($cut_point->getPHID()) 51 50 ->setIsActive(1) 52 51 ->setDetail('branchDate', $branch_date)
+21
src/applications/releeph/query/ReleephBranchQuery.php
··· 6 6 private $ids; 7 7 private $phids; 8 8 9 + private $needCutPointCommits; 10 + 9 11 public function withIDs(array $ids) { 10 12 $this->ids = $ids; 11 13 return $this; ··· 13 15 14 16 public function withPHIDs(array $phids) { 15 17 $this->phids = $phids; 18 + return $this; 19 + } 20 + 21 + public function needCutPointCommits($need_commits) { 22 + $this->needCutPointCommits = $need_commits; 16 23 return $this; 17 24 } 18 25 ··· 45 52 $branch->attachProject($projects[$project_id]); 46 53 } else { 47 54 unset($branches[$key]); 55 + } 56 + } 57 + 58 + if ($this->needCutPointCommits) { 59 + $commit_phids = mpull($branches, 'getCutPointCommitPHID'); 60 + $commits = id(new DiffusionCommitQuery()) 61 + ->setViewer($this->getViewer()) 62 + ->withPHIDs($commit_phids) 63 + ->execute(); 64 + $commits = mpull($commits, null, 'getPHID'); 65 + 66 + foreach ($branches as $branch) { 67 + $commit = idx($commits, $branch->getCutPointCommitPHID()); 68 + $branch->attachCutPointCommit($commit); 48 69 } 49 70 } 50 71
+11 -1
src/applications/releeph/storage/ReleephBranch.php
··· 17 17 protected $symbolicName; 18 18 19 19 // Where to cut the branch 20 - protected $cutPointCommitIdentifier; 21 20 protected $cutPointCommitPHID; 22 21 23 22 protected $details = array(); 24 23 25 24 private $project = self::ATTACHABLE; 25 + private $cutPointCommit = self::ATTACHABLE; 26 26 27 27 public function getConfiguration() { 28 28 return array( ··· 160 160 161 161 public function getProject() { 162 162 return $this->assertAttached($this->project); 163 + } 164 + 165 + public function attachCutPointCommit( 166 + PhabricatorRepositoryCommit $commit = null) { 167 + $this->cutPointCommit = $commit; 168 + return $this; 169 + } 170 + 171 + public function getCutPointCommit() { 172 + return $this->assertAttached($this->cutPointCommit); 163 173 } 164 174 165 175
+4
src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
··· 1543 1543 'type' => 'sql', 1544 1544 'name' => $this->getPatchPath('20130731.releephproject.sql'), 1545 1545 ), 1546 + '20130731.releephcutpointidentifier.sql' => array( 1547 + 'type' => 'sql', 1548 + 'name' => $this->getPatchPath('20130731.releephcutpointidentifier.sql'), 1549 + ), 1546 1550 ); 1547 1551 } 1548 1552 }