1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-10 06:41:04 +01:00
phorge-arcanist/src/workflow/ArcanistListWorkflow.php
vrana 66d204be81 Delete license headers from files
Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in unit tests and LICENSE file.

Reviewers: epriestley, btrahan, edward

Reviewed By: epriestley

CC: aran, Korvin, davidrecordon

Maniphest Tasks: T2035

Differential Revision: https://secure.phabricator.com/D3881
2012-11-05 11:16:24 -08:00

93 lines
2.1 KiB
PHP

<?php
/**
* Lists open revisions in Differential.
*
* @group workflow
*/
final class ArcanistListWorkflow extends ArcanistBaseWorkflow {
public function getWorkflowName() {
return 'list';
}
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
**list**
EOTEXT
);
}
public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT
Supports: git, svn, hg
List your open Differential revisions.
EOTEXT
);
}
public function requiresConduit() {
return true;
}
public function requiresRepositoryAPI() {
return true;
}
public function requiresAuthentication() {
return true;
}
public function run() {
$revisions = $this->getConduit()->callMethodSynchronous(
'differential.query',
array(
'authors' => array($this->getUserPHID()),
'status' => 'status-open',
));
if (!$revisions) {
echo "You have no open Differential revisions.\n";
return 0;
}
$repository_api = $this->getRepositoryAPI();
$info = array();
$status_len = 0;
foreach ($revisions as $key => $revision) {
$revision_path = Filesystem::resolvePath($revision['sourcePath']);
$current_path = Filesystem::resolvePath($repository_api->getPath());
if ($revision_path == $current_path) {
$info[$key]['here'] = 1;
} else {
$info[$key]['here'] = 0;
}
$info[$key]['sort'] = sprintf(
'%d%04d%08d',
$info[$key]['here'],
$revision['status'],
$revision['id']);
$info[$key]['statusName'] = $revision['statusName'];
$status_len = max(
$status_len,
strlen($info[$key]['statusName']));
}
$info = isort($info, 'sort');
foreach ($info as $key => $spec) {
$revision = $revisions[$key];
printf(
"%s %-".($status_len + 4)."s D%d: %s\n",
$spec['here']
? phutil_console_format('**%s**', '*')
: ' ',
$spec['statusName'],
$revision['id'],
$revision['title']);
}
return 0;
}
}