array( 'help' => "Show revisions by any author, not just you.", ), 'any-status' => array( 'help' => "Show committed and abandoned revisions.", ), 'id' => array( 'help' => "If exactly one revision matches, print it to stdout. ". "Otherwise, exit with an error. Intended for scripts.", ), '*' => 'commit', ); } public function run() { $repository_api = $this->getRepositoryAPI(); $commit = $this->getArgument('commit'); if (count($commit)) { if (!$repository_api->supportsRelativeLocalCommits()) { throw new ArcanistUsageException( "This version control system does not support relative commits."); } else { $repository_api->parseRelativeLocalCommit($commit); } } $any_author = $this->getArgument('any-author'); $any_status = $this->getArgument('any-status'); $query = array( 'authors' => $any_author ? null : array($this->getUserPHID()), 'status' => $any_status ? 'status-any' : 'status-open', ); $revisions = $repository_api->loadWorkingCopyDifferentialRevisions( $this->getConduit(), $query); if (empty($revisions)) { $this->writeStatusMessage("No matching revisions.\n"); return 1; } if ($this->getArgument('id')) { if (count($revisions) == 1) { echo idx(head($revisions), 'id'); return 0; } else { $this->writeStatusMessage("More than one matching revision.\n"); return 1; } } foreach ($revisions as $revision) { echo 'D'.$revision['id'].' '.$revision['title']."\n"; } return 0; } }