]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix callsites which called libphutil_console_wrap like it were _format
authorAlex Vandiver <alexmv@dropbox.com>
Thu, 3 Sep 2015 19:01:01 +0000 (12:01 -0700)
committerepriestley <git@epriestley.com>
Thu, 3 Sep 2015 19:01:01 +0000 (12:01 -0700)
Summary:
7e2df9a attempted to pht() some strings; unfortunately, it assumed
that some things that were calls to phutil_console_wrap() were
actually calls to phutil_console_format().  This produces errors of
the form:

    [2015-07-17 21:17:28] ERROR 2: str_repeat() expects parameter 2 to be long, string given at [/usr/local/libphutil/src/console/format.php:162]
    #0 str_repeat(string, string) called at [<phutil>/src/console/format.php:162]
    #1 phutil_console_wrap(string, string, string) called at [<arcanist>/scripts/arcanist.php:620]
    #2 arcanist_load_libraries(array, boolean, string, ArcanistWorkingCopyIdentity) called at [<arcanist>/scripts/arcanist.php:154]
    %s: %s

Provide an additional call to phutil_console_format() when necessary,
or simply append the relevant characters if possible.

Test Plan: Caused a library load error

Reviewers: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14053

scripts/arcanist.php
src/workflow/ArcanistDiffWorkflow.php
src/workflow/ArcanistWorkflow.php

index ff80fa6e360d1c8083cd63254e867ce2eeefd06f..f29311f667991a575838abdc51c4697a04595ea7 100755 (executable)
@@ -620,9 +620,9 @@ function arcanist_load_libraries(
         throw new ArcanistUsageException($error);
       } else {
         fwrite(STDERR, phutil_console_wrap(
-          "%s: %s\n\n",
-          pht('WARNING'),
-          $error));
+          phutil_console_format("%s: %s\n",
+                                pht('WARNING'),
+                                $error)));
       }
     } catch (PhutilLibraryConflictException $ex) {
       if ($ex->getLibrary() != 'arcanist') {
index 16811e206ca79bd9bf3c2982abd789ef6fbec09d..3074c16679c885f97ab53de30f9726e32cd2a4b6 100644 (file)
@@ -1030,9 +1030,8 @@ EOTEXT
               } catch (ConduitClientException $e) {
                 if ($e->getErrorCode() == 'ERR-BAD-ARCANIST-PROJECT') {
                   echo phutil_console_wrap(
-                    "%s\n",
-                    pht('Lookup of encoding in arcanist project failed'),
-                    $e->getMessage());
+                    pht('Lookup of encoding in arcanist project failed: %s',
+                        $e->getMessage())."\n");
                 } else {
                   throw $e;
                 }
index 87b3760553a0b7ea7c6eaa3487537bbaa5145e58..047477e57cf2b1f67a62a257e155857872851399 100644 (file)
@@ -1585,12 +1585,11 @@ abstract class ArcanistWorkflow extends Phobject {
     } catch (ConduitClientException $ex) {
       if ($ex->getErrorCode() == 'ERR-CONDUIT-CALL') {
         echo phutil_console_wrap(
-          "%s\n\n",
           pht(
             'This feature requires a newer version of Phabricator. Please '.
             'update it using these instructions: %s',
             'https://secure.phabricator.com/book/phabricator/article/'.
-              'upgrading/'));
+              'upgrading/')."\n\n");
       }
       throw $ex;
     }