From dd8232b766ae90ec1e4c95d0cc918cb7725c35c3 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 6 May 2011 12:34:34 -0700 Subject: [PATCH] Hint 'arc' commands in Differential UI Summary: Point users toward 'arc amend', 'arc commit', 'arc patch' and 'arc export' since no one is going to read 'arc help'. There's kind of a tradeoff here where we're wasting a fair amount of UI space for expert users with the patch/export hints but I think it's probably okay since there's really no other way to figure out that these features exist. Note that the "export" command given isn't complete (it needs --git or --unified), but it will give you a useful error message when you run it, telling you to specify --git or --unified. If it turns out users get confused by this, let me know. Test Plan: Loaded a revision and looked at it. Faked it into 'accepted' status. Reviewed By: tuomaspelkonen Reviewers: tuomaspelkonen, aran, jungejason CC: aran, tuomaspelkonen, epriestley Differential Revision: 242 --- .../DifferentialRevisionViewController.php | 23 ++++++++++++++++++- .../controller/revisionview/__init__.php | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php b/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php index fd4e76de8f..99662a9980 100644 --- a/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php @@ -267,8 +267,24 @@ class DifferentialRevisionViewController extends DifferentialController { $properties = array(); $status = $revision->getStatus(); + $next_step = null; + if ($status == DifferentialRevisionStatus::ACCEPTED) { + switch ($diff->getSourceControlSystem()) { + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: + $next_step = 'arc amend --revision '.$revision->getID(); + break; + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: + $next_step = 'arc commit --revision '.$revision->getID(); + break; + } + if ($next_step) { + $next_step = + ' · '. + 'Next step: '.phutil_escape_html($next_step).''; + } + } $status = DifferentialRevisionStatus::getNameForRevisionStatus($status); - $properties['Revision Status'] = ''.$status.''; + $properties['Revision Status'] = ''.$status.''.$next_step; $author = $handles[$revision->getAuthorPHID()]; $properties['Author'] = $author->renderLink(); @@ -399,6 +415,11 @@ class DifferentialRevisionViewController extends DifferentialController { $properties['Commits'] = implode('
', $links); } + $properties['Apply Patch'] = + 'arc patch D'.$revision->getID().''; + $properties['Export Patch'] = + 'arc export --revision '.$revision->getID().''; + return $properties; } diff --git a/src/applications/differential/controller/revisionview/__init__.php b/src/applications/differential/controller/revisionview/__init__.php index 90c9a5be5d..dac3a7fe73 100644 --- a/src/applications/differential/controller/revisionview/__init__.php +++ b/src/applications/differential/controller/revisionview/__init__.php @@ -26,6 +26,7 @@ phutil_require_module('phabricator', 'applications/differential/view/revisionupd phutil_require_module('phabricator', 'applications/draft/storage/draft'); phutil_require_module('phabricator', 'applications/phid/constants'); phutil_require_module('phabricator', 'applications/phid/handle/data'); +phutil_require_module('phabricator', 'applications/repository/constants/repositorytype'); phutil_require_module('phabricator', 'infrastructure/celerity/api'); phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'view/form/error');