From 11e2c1688fef4a569ab45e9eb41156bf30bedf73 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 1 Apr 2014 08:21:15 -0700 Subject: [PATCH] Fix escaping of bookmarknames properly for `arc patch` 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php index 3bfdad49..33d19999 100644 --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -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",