From: durham Date: Thu, 21 Feb 2013 04:06:16 +0000 (-0800) Subject: fix 'arc feature' not creating bookmarks on mercurial X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7f81058ead6d36523f9816442dcb99c2b0e4ac88;p=arcanist.git 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 --- 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',