]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Pluralize add files questions
authorJakub Vrana <jakub@vrana.cz>
Sat, 14 Sep 2013 15:06:50 +0000 (08:06 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sat, 14 Sep 2013 15:06:50 +0000 (08:06 -0700)
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
src/workflow/ArcanistBaseWorkflow.php

index 91985a9b2285432cf9fb26564a4777b0b4600fab..742f5dab2638450163ca50c304707310fdfa3229 100644 (file)
@@ -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'),
index 3732a73e35806010a32685d5eb144dc0c53ed66c..705f172e25a29fae1f75f15004b973e3d7c8fcaa 100644 (file)
@@ -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);
   }