From f52222ad19a00a422e1fb422e1bf5c0d08dfc0b2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 11 Jun 2020 10:38:27 -0700 Subject: [PATCH] Add more "RepositoryRef" legacy status mappings Summary: Ref T13546. The old "differential.query" call is still used to fill refs when all we have locally is hashes. Add some mappings to improve the resulting refs. Test Plan: Viewed "arc branches", saw statuses colored more consistently. Reviewers: ptarjan Reviewed By: ptarjan Maniphest Tasks: T13546 Differential Revision: https://secure.phabricator.com/D21355 --- src/ref/revision/ArcanistRevisionRef.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/ref/revision/ArcanistRevisionRef.php b/src/ref/revision/ArcanistRevisionRef.php index b7a7f1cc..5e2ffa0e 100644 --- a/src/ref/revision/ArcanistRevisionRef.php +++ b/src/ref/revision/ArcanistRevisionRef.php @@ -49,6 +49,27 @@ final class ArcanistRevisionRef break; } + $value_map = array( + '0' => 'needs-review', + '1' => 'needs-revision', + '2' => 'accepted', + '3' => 'published', + '4' => 'abandoned', + '5' => 'changes-planned', + ); + + $color_map = array( + 'needs-review' => 'magenta', + 'needs-revision' => 'red', + 'accepted' => 'green', + 'published' => 'cyan', + 'abandoned' => null, + 'changes-planned' => 'red', + ); + + $status_value = idx($value_map, idx($dict, 'status')); + $ansi_color = idx($color_map, $status_value); + $dict['fields'] = array( 'uri' => idx($dict, 'uri'), 'title' => idx($dict, 'title'), @@ -56,6 +77,8 @@ final class ArcanistRevisionRef 'status' => array( 'name' => $status_name, 'closed' => $is_closed, + 'value' => $status_value, + 'color.ansi' => $ansi_color, ), );