Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base workflow for Phrequent workflows
|
|
|
|
*/
|
|
|
|
abstract class ArcanistPhrequentWorkflow extends ArcanistBaseWorkflow {
|
|
|
|
|
|
|
|
protected function printCurrentTracking() {
|
|
|
|
$conduit = $this->getConduit();
|
|
|
|
|
|
|
|
$results = $conduit->callMethodSynchronous(
|
|
|
|
'phrequent.tracking',
|
|
|
|
array(
|
|
|
|
));
|
|
|
|
$results = $results['data'];
|
|
|
|
|
|
|
|
if (count($results) === 0) {
|
|
|
|
echo phutil_console_format(
|
|
|
|
"Not currently tracking time against any object\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$phids_to_lookup = array();
|
|
|
|
foreach ($results as $result) {
|
|
|
|
$phids_to_lookup[] = $result['phid'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$phid_query = $conduit->callMethodSynchronous(
|
|
|
|
'phid.query',
|
|
|
|
array(
|
|
|
|
'phids' => $phids_to_lookup,
|
|
|
|
));
|
|
|
|
|
|
|
|
$phid_map = array();
|
|
|
|
foreach ($phids_to_lookup as $lookup) {
|
|
|
|
if (array_key_exists($lookup, $phid_query)) {
|
|
|
|
$phid_map[$lookup] = $phid_query[$lookup]['fullName'];
|
|
|
|
} else {
|
|
|
|
$phid_map[$lookup] = 'Unknown Object';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$table = id(new PhutilConsoleTable())
|
|
|
|
->addColumn('type', array('title' => 'Status'))
|
|
|
|
->addColumn('time', array('title' => 'Tracked', 'align' => 'right'))
|
|
|
|
->addColumn('name', array('title' => 'Name'))
|
|
|
|
->setBorders(false);
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
foreach ($results as $result) {
|
2014-07-17 05:26:00 +02:00
|
|
|
if ($i === 0) {
|
|
|
|
$column_type = 'In Progress';
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
} else {
|
2014-07-17 05:26:00 +02:00
|
|
|
$column_type = 'Suspended';
|
Add Phrequent workflows to Arcanist
Summary:
Depends on D9906.
This adds `arc start`, `arc stop` and `arc tracking` for tracking tasks, diffs and other objects in Phrequent.
Test Plan: Tested this against a local install.
Reviewers: skyronic, #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: maxhodak, hach-que, aran, epriestley, Korvin
Maniphest Tasks: T3569, T3969
Differential Revision: https://secure.phabricator.com/D7327
2014-07-17 03:58:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$table->addRow(array(
|
|
|
|
'type' => '('.$column_type.')',
|
|
|
|
'time' => phutil_format_relative_time($result['time']),
|
|
|
|
'name' => $phid_map[$result['phid']],
|
|
|
|
));
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->draw();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|