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

Tasks can be defined in the commit message (Phabricator part).

Summary:
Phabricator did not support giving the task ids in the commit message.
Currently there is no default implementation for this, but there is a
Facebook specific implementation. At some point default implementation
for Maniphest tasks to revisions will be added.

Test Plan:
Tested with the Facebook specific implementation that task ids are
recognized in the commit message and tasks are automatically attached
to revisions.

The task attached to this revision was added from the commit message.

Reviewed By: jungejason
Reviewers: jungejason, epriestley
CC: dpepper, edward, gpatangay, tuomaspelkonen, jungejason
Differential Revision: 240996

+85 -1
+1
src/__phutil_library_map__.php
··· 156 156 'DifferentialRevisionUpdateHistoryView' => 'applications/differential/view/revisionupdatehistory', 157 157 'DifferentialRevisionViewController' => 'applications/differential/controller/revisionview', 158 158 'DifferentialSubscribeController' => 'applications/differential/controller/subscribe', 159 + 'DifferentialTasksAttacher' => 'applications/differential/tasks', 159 160 'DifferentialUnitStatus' => 'applications/differential/constants/unitstatus', 160 161 'DiffusionBranchInformation' => 'applications/diffusion/data/branch', 161 162 'DiffusionBranchQuery' => 'applications/diffusion/query/branch/base',
+1
src/applications/conduit/method/differential/getcommitmessage/ConduitAPI_differential_getcommitmessage_Method.php
··· 66 66 'testPlan' => 'Test Plan', 67 67 'blameRevision' => 'Blame Revision', 68 68 'revertPlan' => 'Revert Plan', 69 + 'tasks' => 'Tasks', 69 70 ); 70 71 71 72 foreach ($fields as $field => $value) {
+1
src/applications/conduit/method/differential/parsecommitmessage/ConduitAPI_differential_parsecommitmessage_Method.php
··· 62 62 'ccPHIDs' => $message->getCCPHIDs(), 63 63 'revisionID' => $message->getRevisionID(), 64 64 'gitSVNID' => $message->getGitSVNID(), 65 + 'tasks' => $message->getTasks(), 65 66 ), 66 67 ); 67 68 }
+26
src/applications/differential/editor/revision/DifferentialRevisionEditor.php
··· 31 31 protected $diff; 32 32 protected $comments; 33 33 protected $silentUpdate; 34 + protected $tasks = null; 34 35 35 36 public function __construct(DifferentialRevision $revision, $actor_phid) { 36 37 $this->revision = $revision; ··· 54 55 55 56 $editor->addDiff($diff, null); 56 57 $editor->save(); 58 + 59 + // Tasks can only be updated after revision has been saved to the 60 + // database. Currently tasks are updated only when a revision is created. 61 + // UI must be used to modify tasks after creating one. 62 + $editor->updateTasks(); 57 63 58 64 return $revision; 59 65 } ··· 70 76 71 77 $this->setReviewers($fields['reviewerPHIDs']); 72 78 $this->setCCPHIDs($fields['ccPHIDs']); 79 + $this->setTasks($fields['tasks']); 73 80 } 74 81 75 82 public function getRevision() { ··· 84 91 public function setCCPHIDs(array $cc) { 85 92 $this->cc = $cc; 86 93 return $this; 94 + } 95 + 96 + public function setTasks(array $tasks) { 97 + $this->tasks = $tasks; 87 98 } 88 99 89 100 public function addDiff(DifferentialDiff $diff, $comments) { ··· 553 564 $comment->save(); 554 565 555 566 return $comment; 567 + } 568 + 569 + private function updateTasks() { 570 + if ($this->tasks) { 571 + $task_class = PhabricatorEnv::getEnvConfig( 572 + 'differential.attach-task-class'); 573 + if ($task_class) { 574 + PhutilSymbolLoader::loadClass($task_class); 575 + $task_attacher = newv($task_class, array()); 576 + $ret = $task_attacher->attachTasksToRevision( 577 + $this->actorPHID, 578 + $this->revision, 579 + $this->tasks); 580 + } 581 + } 556 582 } 557 583 558 584 }
+1
src/applications/differential/editor/revision/__init__.php
··· 19 19 phutil_require_module('phabricator', 'storage/qsprintf'); 20 20 phutil_require_module('phabricator', 'storage/queryfx'); 21 21 22 + phutil_require_module('phutil', 'symbols'); 22 23 phutil_require_module('phutil', 'utils'); 23 24 24 25
+16 -1
src/applications/differential/parser/commitmessage/DifferentialCommitMessage.php
··· 39 39 protected $revisionID; 40 40 protected $gitSVNID; 41 41 42 + protected $tasks = array(); 43 + 42 44 protected function __construct() { 43 45 44 46 } ··· 160 162 return $this; 161 163 } 162 164 165 + public function setTasks(array $tasks) { 166 + $this->tasks = $tasks; 167 + return $this; 168 + } 169 + 170 + public function getTasks() { 171 + return $this->tasks; 172 + } 163 173 164 174 public static function newFromRawCorpus($raw_corpus) { 165 175 $message = new DifferentialCommitMessage(); ··· 201 211 break; 202 212 case 'Commenters': 203 213 // Just drop this. 214 + break; 215 + case 'Tasks': 216 + $message->setTasks($data); 204 217 break; 205 218 default: 206 219 throw new Exception("Unrecognized field '{$field}'."); ··· 298 311 'CC' => 'CC', 299 312 'Revert' => 'Revert Plan', 300 313 'Revert Plan' => 'Revert Plan', 301 - 314 + 'Task ID' => 'Tasks', 315 + 'Task IDs' => 'Tasks', 316 + 'Tasks' => 'Tasks', 302 317 'git-svn-id' => 'git-svn-id', 303 318 304 319 // This appears only in "arc amend"-ed messages, just discard it.
+29
src/applications/differential/tasks/DifferentialTasksAttacher.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + abstract class DifferentialTasksAttacher { 20 + /** 21 + * Implementation of this function should attach given tasks to 22 + * the given revision. The function is called when 'arc' has task 23 + * ids defined in the commit message. 24 + */ 25 + abstract public function attachTasksToRevision( 26 + $user_phid, 27 + DifferentialRevision $revision, 28 + array $task_ids); 29 + }
+10
src/applications/differential/tasks/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + 10 + phutil_require_source('DifferentialTasksAttacher.php');