1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +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:
Adam Hupp 2011-06-24 09:16:49 -07:00
parent 3715266209
commit cc283a63a5

View file

@ -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,6 +141,24 @@ EOTEXT
$longest_name = max(strlen($branch->getFormattedName()), $longest_name);
$longest_status = max(strlen($branch->getStatus()), $longest_status);
}
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();
@ -150,3 +172,4 @@ EOTEXT
}
}
}
}