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

Fix `differential.getdiff`, etc., for diffs with no Arcanist Project

Summary:
`getArcanistProjectName()` has some logic which gets messy with the `self::ATTACHABLE` mechanism. This makes `differential.getdiff` and similar Conduit methods throw an exception when querying a diff which doesn't have a project. See <http://pastebin.com/Czzrd0Jz>.

Instead, unconditionally attach a project (possibly `null`) when loading diffs if they need projects.

Test Plan: Ran `differential.getdiff` against a `arc diff --raw` diff with no project, got a result instead of an exception.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, sttwister

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

+9 -6
+8 -5
src/applications/differential/query/DifferentialDiffQuery.php
··· 77 77 'phid IN (%Ls)', 78 78 $phids); 79 79 $project_map = mpull($projects, null, 'getPHID'); 80 - foreach ($diffs as $diff) { 81 - if ($diff->getArcanistProjectPHID()) { 82 - $project = $project_map[$diff->getArcanistProjectPHID()]; 83 - $diff->attachArcanistProject($project); 84 - } 80 + } 81 + 82 + foreach ($diffs as $diff) { 83 + $project = null; 84 + if ($diff->getArcanistProjectPHID()) { 85 + $project = idx($project_map, $diff->getArcanistProjectPHID()); 85 86 } 87 + $diff->attachArcanistProject($project); 86 88 } 89 + 87 90 return $diffs; 88 91 } 89 92
+1 -1
src/applications/differential/storage/DifferentialDiff.php
··· 62 62 } 63 63 64 64 public function attachArcanistProject( 65 - PhabricatorRepositoryArcanistProject $project) { 65 + PhabricatorRepositoryArcanistProject $project = null) { 66 66 $this->arcanistProject = $project; 67 67 return $this; 68 68 }