]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix escaping of bookmarknames properly for `arc patch`
authorepriestley <git@epriestley.com>
Tue, 1 Apr 2014 15:21:15 +0000 (08:21 -0700)
committerepriestley <git@epriestley.com>
Tue, 1 Apr 2014 15:21:15 +0000 (08:21 -0700)
Summary:
Fixes T4596. I misunderstood this issue and D8512 was not correct. Specifically:

  - The `hg log` needs to be escaped, since otherwise "arcpatch-x" is interpreted as a revset.
  - The `hg update` does not need to be escaped, since updating to a revset doesn't make sense and the command never treats its argument as a revset.
  - The `hg bookmark` does not need to be escaped, for similar reasons.

Test Plan:
  - Ran these commands in isolation and got sensible, consistent results.
  - Ran `arc patch` several times in a row and got proper bookmark names.

Reviewers: btrahan, durham, rvanvelzen

Reviewed By: rvanvelzen

Subscribers: epriestley

Maniphest Tasks: T4596

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

src/workflow/ArcanistPatchWorkflow.php

index 3bfdad49e4215e88ca61edb80f801e319f03b164..33d199993246a69f56e5542d1a6df77ddf85ed91 100644 (file)
@@ -265,7 +265,7 @@ EOTEXT
 
       list($err) = $repository_api->execManualLocal(
         'log -r %s',
-        $proposed_name);
+        hgsprintf('%s', $proposed_name));
 
       // no error means hg log found a bookmark
       if (!$err) {
@@ -320,12 +320,12 @@ EOTEXT
         echo "Updating to the revision's base commit\n";
         $repository_api->execPassthru(
           'update %s',
-          hgsprintf('%s', $base_revision));
+          $base_revision);
       }
 
       $repository_api->execxLocal(
         'bookmark %s',
-        hgsprintf('%s', $branch_name));
+        $branch_name);
 
       echo phutil_console_format(
         "Created and checked out bookmark %s.\n",