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

Support export of revisions to Excel/CSV/JSON/etc

Summary: Ref T13210. See PHI806. This enables basic export of revisions into flat data formats. This isn't too fancy, but just covers the basics since the driving use case isn't especially concerned about getting all the fields and details.

Test Plan: Exported some revisions into JSON, got sensible output.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13210

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

+76 -3
+3 -3
src/applications/differential/application/PhabricatorDifferentialApplication.php
··· 1 1 <?php 2 2 3 - final class PhabricatorDifferentialApplication extends PhabricatorApplication { 3 + final class PhabricatorDifferentialApplication 4 + extends PhabricatorApplication { 4 5 5 6 public function getBaseURI() { 6 7 return '/differential/'; ··· 48 49 '/(?P<filter>new)/' => 'DifferentialRevisionViewController', 49 50 ), 50 51 '/differential/' => array( 51 - '(?:query/(?P<queryKey>[^/]+)/)?' 52 - => 'DifferentialRevisionListController', 52 + $this->getQueryRoutePattern() => 'DifferentialRevisionListController', 53 53 'diff/' => array( 54 54 '(?P<id>[1-9]\d*)/' => array( 55 55 '' => 'DifferentialDiffViewController',
+73
src/applications/differential/query/DifferentialRevisionSearchEngine.php
··· 289 289 return $result; 290 290 } 291 291 292 + protected function newExportFields() { 293 + $fields = array( 294 + id(new PhabricatorStringExportField()) 295 + ->setKey('monogram') 296 + ->setLabel(pht('Monogram')), 297 + id(new PhabricatorPHIDExportField()) 298 + ->setKey('authorPHID') 299 + ->setLabel(pht('Author PHID')), 300 + id(new PhabricatorStringExportField()) 301 + ->setKey('author') 302 + ->setLabel(pht('Author')), 303 + id(new PhabricatorStringExportField()) 304 + ->setKey('status') 305 + ->setLabel(pht('Status')), 306 + id(new PhabricatorStringExportField()) 307 + ->setKey('statusName') 308 + ->setLabel(pht('Status Name')), 309 + id(new PhabricatorURIExportField()) 310 + ->setKey('uri') 311 + ->setLabel(pht('URI')), 312 + id(new PhabricatorStringExportField()) 313 + ->setKey('title') 314 + ->setLabel(pht('Title')), 315 + id(new PhabricatorStringExportField()) 316 + ->setKey('summary') 317 + ->setLabel(pht('Summary')), 318 + id(new PhabricatorStringExportField()) 319 + ->setKey('testPlan') 320 + ->setLabel(pht('Test Plan')), 321 + ); 322 + 323 + return $fields; 324 + } 325 + 326 + protected function newExportData(array $revisions) { 327 + $viewer = $this->requireViewer(); 328 + 329 + $phids = array(); 330 + foreach ($revisions as $revision) { 331 + $phids[] = $revision->getAuthorPHID(); 332 + } 333 + $handles = $viewer->loadHandles($phids); 334 + 335 + $export = array(); 336 + foreach ($revisions as $revision) { 337 + 338 + $author_phid = $revision->getAuthorPHID(); 339 + if ($author_phid) { 340 + $author_name = $handles[$author_phid]->getName(); 341 + } else { 342 + $author_name = null; 343 + } 344 + 345 + $status = $revision->getStatusObject(); 346 + $status_name = $status->getDisplayName(); 347 + $status_value = $status->getKey(); 348 + 349 + $export[] = array( 350 + 'monogram' => $revision->getMonogram(), 351 + 'authorPHID' => $author_phid, 352 + 'author' => $author_name, 353 + 'status' => $status_value, 354 + 'statusName' => $status_name, 355 + 'uri' => PhabricatorEnv::getProductionURI($revision->getURI()), 356 + 'title' => (string)$revision->getTitle(), 357 + 'summary' => (string)$revision->getSummary(), 358 + 'testPlan' => (string)$revision->getTestPlan(), 359 + ); 360 + } 361 + 362 + return $export; 363 + } 364 + 292 365 }