mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 14:00:55 +01:00
Add by-status option to 'arc branch'
Summary: This diff adds a '--by-status' argument to arc branch that sorts the output by status. Example output: Accepted my-branch Amazing change Needs Revision nah-nah Not so good change Needs Review in-progress-change I have no idea No Revision etc etc Blame Rev: Task ID: # Reviewers: epriestley, slawekbiel Test Plan: Ran it with and without --by-status, saw expected output in both cases. DiffCamp Revision: Revert Plan: Database Impact: Memcache Impact: Other Notes: EImportant: - begin *PUBLIC* platform impact section - Bugzilla: # - end platform impact - Differential Revision: 512
This commit is contained in:
parent
3715266209
commit
cc283a63a5
1 changed files with 33 additions and 10 deletions
|
@ -57,6 +57,9 @@ EOTEXT
|
|||
'help' =>
|
||||
"Include committed and abandoned revisions",
|
||||
),
|
||||
'by-status' => array(
|
||||
'help' => 'Group output by revision status.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -78,6 +81,7 @@ EOTEXT
|
|||
$branch->setStatus('Not Yours');
|
||||
continue;
|
||||
}
|
||||
|
||||
$rev_id = $branch->getRevisionId();
|
||||
if ($rev_id) {
|
||||
$status = idx($revision_status, $rev_id, 'Unknown Status');
|
||||
|
@ -137,16 +141,35 @@ EOTEXT
|
|||
$longest_name = max(strlen($branch->getFormattedName()), $longest_name);
|
||||
$longest_status = max(strlen($branch->getStatus()), $longest_status);
|
||||
}
|
||||
foreach ($this->branches as $branch) {
|
||||
$name_markdown = $branch->getFormattedName();
|
||||
$status_markdown = $branch->getFormattedStatus();
|
||||
$subject = $branch->getCommitSubject();
|
||||
$subject_pad = $longest_status - strlen($branch->getStatus()) + 4;
|
||||
$name_markdown =
|
||||
str_pad($name_markdown, $longest_name + 4, ' ');
|
||||
$subject =
|
||||
str_pad($subject, strlen($subject) + $subject_pad, ' ', STR_PAD_LEFT);
|
||||
echo "$name_markdown $status_markdown $subject\n";
|
||||
|
||||
if ($this->getArgument('by-status')) {
|
||||
$by_status = mgroup($this->branches, 'getStatus');
|
||||
foreach (array('Accepted', 'Needs Revision',
|
||||
'Needs Review', 'No Revision') as $status) {
|
||||
$branches = idx($by_status, $status);
|
||||
if (!$branches) {
|
||||
continue;
|
||||
}
|
||||
echo reset($branches)->getFormattedStatus()."\n";
|
||||
foreach ($branches as $branch) {
|
||||
$name_markdown = $branch->getFormattedName();
|
||||
$subject = $branch->getCommitSubject();
|
||||
$name_markdown = str_pad($name_markdown, $longest_name + 4, ' ');
|
||||
echo " $name_markdown $subject\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($this->branches as $branch) {
|
||||
$name_markdown = $branch->getFormattedName();
|
||||
$status_markdown = $branch->getFormattedStatus();
|
||||
$subject = $branch->getCommitSubject();
|
||||
$subject_pad = $longest_status - strlen($branch->getStatus()) + 4;
|
||||
$name_markdown =
|
||||
str_pad($name_markdown, $longest_name + 4, ' ');
|
||||
$subject =
|
||||
str_pad($subject, strlen($subject) + $subject_pad, ' ', STR_PAD_LEFT);
|
||||
echo "$name_markdown $status_markdown $subject\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue