Page MenuHomePhabricator

Generate dot graph of ticket dependencies for a project

Authored By
altendky
Jul 17 2015, 8:23 PM
Size
1 KB
Referenced Files
None
Subscribers
None

Generate dot graph of ticket dependencies for a project

#!/usr/bin/env php
<?php
require '/path/to/libphutil/src/__phutil_library_init__.php';
# TODO customize or parameterize or... these
$uri = 'fill_me_in';
$certificate = 'fill_me_in';
$username = 'fill_me_in';
$client = new ConduitClient($uri);
$args = new PhutilArgumentParser($argv);
$args->parse(
array(
array(
'name' => 'project',
'param' => 'projname',
'short' => 'p',
'help' => 'The project name to process.',
),
));
$project_name = $args->getArg('project');
$params = array(
'certificate' => $certificate,
'client' => 'mytestclient',
'clientVersion' => '1.0',
'user' => $username,
'host' => $uri
);
$client->callMethodSynchronous('conduit.connect', $params);
$projects = $client->callMethodSynchronous('project.query', array('names' => [$project_name]));
$project_phid = array_keys($projects['data'])[0];
$tasks = $client->callMethodSynchronous('maniphest.query', array('projectPHIDs' => [$project_phid]));
print('dot {{{' . PHP_EOL);
print(' digraph {' . PHP_EOL);
foreach ($tasks as $task) {
# print('T' . $task['id'] . ': ' . $task['title'] . PHP_EOL);
print(str_replace('-', '_', $task['phid']) . ' [label="T' . $task['id'] . '" URL="' . $uri . 'T' . $task['id'] . '"]' . PHP_EOL);
foreach ($task['dependsOnTaskPHIDs'] as $dependsOnPhid) {
# print(' ' . $dependsOnPhid . PHP_EOL);
print(str_replace('-', '_', $dependsOnPhid) . ' -> ' . str_replace('-', '_', $task['phid']) . PHP_EOL);
}
}
print(' }' . PHP_EOL);
print('}}}' . PHP_EOL);
?>

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/f3/i6/usuqdzoeegynp2js
Default Alt Text
Generate dot graph of ticket dependencies for a project (1 KB)

Event Timeline