From 7f81058ead6d36523f9816442dcb99c2b0e4ac88 Mon Sep 17 00:00:00 2001 From: durham Date: Wed, 20 Feb 2013 20:06:16 -0800 Subject: [PATCH] fix 'arc feature' not creating bookmarks on mercurial Summary: The arc feature command wasn't actually creating bookmarks on mercurial. It needs to call 'hg bookmark' instead of 'hg update' Also removed an unnecessary hgsprintf since there were no arguments. Test Plan: Ran 'arc feature foo' and 'arc feature bar tip^'. The former created a bookmark at my current location. The latter created a bookmark at tip^ and moved me to that revision. Reviewers: vrana, epriestley Reviewed By: epriestley CC: sid0, bos, dschleimer, aran, Korvin Differential Revision: https://secure.phabricator.com/D5023 --- src/workflow/ArcanistFeatureWorkflow.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php index 927dd454..2d8a0800 100644 --- a/src/workflow/ArcanistFeatureWorkflow.php +++ b/src/workflow/ArcanistFeatureWorkflow.php @@ -105,9 +105,14 @@ EOTEXT $command = 'checkout %s'; } - list($err, $stdout, $stderr) = $api->execManualLocal( - $command, - reset($names)); + $err = 1; + + $branches = $api->getAllBranches(); + if (in_array(reset($names), ipull($branches, 'name'))) { + list($err, $stdout, $stderr) = $api->execManualLocal( + $command, + reset($names)); + } if ($err) { $match = null; @@ -134,13 +139,17 @@ EOTEXT if ($api instanceof ArcanistMercurialAPI) { $rev = ''; if (isset($names[1])) { - $rev = csprintf('-r %s', hgsprintf($names[1])); + $rev = csprintf('-r %s', $names[1]); } + $exec = $api->execManualLocal( - 'update %C %s', + 'bookmark %C %s', $rev, $names[0]); + if (!$exec[0] && isset($names[1])) { + $api->execxLocal('update %s', $names[0]); + } } else { $exec = $api->execManualLocal( 'checkout -b %Ls', -- 2.43.0