Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWhichWorkflow.php
Show All 37 Lines | EOTEXT | ||||
} | } | ||||
public function requiresAuthentication() { | public function requiresAuthentication() { | ||||
return true; | return true; | ||||
} | } | ||||
public function getArguments() { | public function getArguments() { | ||||
return array( | return array( | ||||
'any-author' => array( | |||||
'help' => "Show revisions by any author, not just you.", | |||||
), | |||||
'any-status' => array( | 'any-status' => array( | ||||
'help' => "Show committed and abandoned revisions.", | 'help' => "Show committed and abandoned revisions.", | ||||
), | ), | ||||
'base' => array( | 'base' => array( | ||||
'param' => 'rules', | 'param' => 'rules', | ||||
'help' => 'Additional rules for determining base revision.', | 'help' => 'Additional rules for determining base revision.', | ||||
'nosupport' => array( | 'nosupport' => array( | ||||
'svn' => 'Subversion does not use base commits.', | 'svn' => 'Subversion does not use base commits.', | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | if ($repository_api->supportsCommitRanges()) { | ||||
"You can see the exact changes that will be sent by running ". | "You can see the exact changes that will be sent by running ". | ||||
"this command:\n\n". | "this command:\n\n". | ||||
" $ {$command}\n\n". | " $ {$command}\n\n". | ||||
"These commits will be included in the diff:\n\n"); | "These commits will be included in the diff:\n\n"); | ||||
echo $commits."\n\n\n"; | echo $commits."\n\n\n"; | ||||
} | } | ||||
$any_author = $this->getArgument('any-author'); | |||||
$any_status = $this->getArgument('any-status'); | $any_status = $this->getArgument('any-status'); | ||||
$query = array( | $query = array( | ||||
'authors' => $any_author | |||||
? null | |||||
: array($this->getUserPHID()), | |||||
'status' => $any_status | 'status' => $any_status | ||||
epriestley: You can just omit this parameter. | |||||
? 'status-any' | ? 'status-any' | ||||
: 'status-open', | : 'status-open', | ||||
); | ); | ||||
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions( | $revisions = $repository_api->loadWorkingCopyDifferentialRevisions( | ||||
$this->getConduit(), | $this->getConduit(), | ||||
$query); | $query); | ||||
echo phutil_console_wrap( | echo phutil_console_wrap( | ||||
phutil_console_format( | phutil_console_format( | ||||
"**MATCHING REVISIONS**\n". | "**MATCHING REVISIONS**\n". | ||||
"These Differential revisions match the changes in this working ". | "These Differential revisions match the changes in this working ". | ||||
"copy:\n\n")); | "copy:\n\n")); | ||||
if (empty($revisions)) { | if (empty($revisions)) { | ||||
echo " (No revisions match.)\n"; | echo " (No revisions match.)\n"; | ||||
echo "\n"; | echo "\n"; | ||||
echo phutil_console_wrap( | echo phutil_console_wrap( | ||||
phutil_console_format( | phutil_console_format( | ||||
"Since there are no revisions in Differential which match this ". | "Since there are no revisions in Differential which match this ". | ||||
"working copy, a new revision will be **created** if you run ". | "working copy, a new revision will be **created** if you run ". | ||||
"'arc diff{$arg}'.\n\n")); | "'arc diff{$arg}'.\n\n")); | ||||
} else { | } else { | ||||
$other_author_phids = array(); | |||||
foreach ($revisions as $revision) { | foreach ($revisions as $revision) { | ||||
echo ' D'.$revision['id'].' '.$revision['title']."\n"; | if ($revision['authorPHID'] != $this->getUserPHID()) { | ||||
$other_author_phids[] = $revision['authorPHID']; | |||||
} | |||||
} | |||||
$other_authors = array(); | |||||
if ($other_author_phids) { | |||||
$other_authors = $this->getConduit()->callMethodSynchronous( | |||||
'user.query', | |||||
array( | |||||
'phids' => $other_author_phids, | |||||
)); | |||||
$other_authors = ipull($other_authors, 'userName', 'phid'); | |||||
} | |||||
foreach ($revisions as $revision) { | |||||
$title = $revision['title']; | |||||
$monogram = 'D'.$revision['id']; | |||||
if ($revision['authorPHID'] != $this->getUserPHID()) { | |||||
$author = $other_authors[$revision['authorPHID']]; | |||||
echo pht(" %s (%s) %s\n", $monogram, $author, $title); | |||||
} else { | |||||
echo pht(" %s %s\n", $monogram, $title); | |||||
} | |||||
echo ' Reason: '.$revision['why']."\n"; | echo ' Reason: '.$revision['why']."\n"; | ||||
echo "\n"; | echo "\n"; | ||||
} | } | ||||
if (count($revisions) == 1) { | if (count($revisions) == 1) { | ||||
echo phutil_console_wrap( | echo phutil_console_wrap( | ||||
phutil_console_format( | phutil_console_format( | ||||
"Since exactly one revision in Differential matches this working ". | "Since exactly one revision in Differential matches this working ". | ||||
"copy, it will be **updated** if you run 'arc diff{$arg}'.")); | "copy, it will be **updated** if you run 'arc diff{$arg}'.")); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
You can just omit this parameter.