From bfbb16f32210767eb979f254a5aa5d085daba94a Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 14 Sep 2013 08:06:50 -0700 Subject: [PATCH] Pluralize add files questions Test Plan: Saw 'Do you want to add these files to the commit?' Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D6991 --- scripts/__init_script__.php | 10 ++++++++++ src/workflow/ArcanistBaseWorkflow.php | 16 ++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php index 91985a9b..742f5dab 100644 --- a/scripts/__init_script__.php +++ b/scripts/__init_script__.php @@ -85,6 +85,16 @@ PhutilTranslator::getInstance() 'Do you want to mark these files as binary and continue?', ), + 'Do you want to amend these files to the commit?' => array( + 'Do you want to amend this file to the commit?', + 'Do you want to amend these files to the commit?', + ), + + 'Do you want to add these files to the commit?' => array( + 'Do you want to add this file to the commit?', + 'Do you want to add these files to the commit?', + ), + 'line(s)' => array('line', 'lines'), '%d test(s)' => array('%d test', '%d tests'), diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php index 3732a73e..705f172e 100644 --- a/src/workflow/ArcanistBaseWorkflow.php +++ b/src/workflow/ArcanistBaseWorkflow.php @@ -812,7 +812,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { "may have forgotten to 'hg add' them to your commit.\n"); } - if ($this->askForAdd()) { + if ($this->askForAdd($untracked)) { $api->addToCommit($untracked); $must_commit += array_flip($untracked); } else if ($this->commitMode == self::COMMIT_DISABLE) { @@ -852,7 +852,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { $working_copy_desc. " Unstaged changes in working copy:\n". " ".implode("\n ", $unstaged)."\n"; - if ($this->askForAdd()) { + if ($this->askForAdd($unstaged)) { $api->addToCommit($unstaged); $must_commit += array_flip($unstaged); } else { @@ -882,7 +882,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { $working_copy_desc. " Uncommitted changes in working copy:\n". " ".implode("\n ", $uncommitted)."\n"; - if ($this->askForAdd()) { + if ($this->askForAdd($uncommitted)) { $must_commit += array_flip($uncommitted); } else { throw new ArcanistUncommittedChangesException( @@ -958,7 +958,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { return false; } - private function askForAdd() { + private function askForAdd(array $files) { if ($this->commitMode == self::COMMIT_DISABLE) { return false; } @@ -969,9 +969,13 @@ abstract class ArcanistBaseWorkflow extends Phobject { return true; } if ($this->shouldAmend) { - $prompt = "Do you want to amend these files to the commit?"; + $prompt = pht( + 'Do you want to amend these files to the commit?', + count($files)); } else { - $prompt = "Do you want to add these files to the commit?"; + $prompt = pht( + 'Do you want to add these files to the commit?', + count($files)); } return phutil_console_confirm($prompt); } -- 2.43.0