From 64bbcda4310f56ffaaee384453fb61a62f8b819a Mon Sep 17 00:00:00 2001 From: durham Date: Tue, 5 Mar 2013 12:48:53 -0800 Subject: [PATCH] Add arcconfig setting for default arc feature start Summary: Adds arc.feature.start.default arcconfig setting to specify a default value for 'start' in 'arc feature name start'. This lets users always branch from origin/master (or whatever the main branch is). Also cleaned up the 'feature' help text a little. The stuff about sorting and closed/abandoned revisions is explained via the options list already. Test Plan: Ran arc feature with/without a start and with/without the config setting set. Reviewers: epriestley, vrana Reviewed By: epriestley CC: bos, sid0, dschleimer, aran, Korvin Differential Revision: https://secure.phabricator.com/D5184 --- src/workflow/ArcanistFeatureWorkflow.php | 48 ++++++++++++++---------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/workflow/ArcanistFeatureWorkflow.php b/src/workflow/ArcanistFeatureWorkflow.php index b05ac4b6..008a0a54 100644 --- a/src/workflow/ArcanistFeatureWorkflow.php +++ b/src/workflow/ArcanistFeatureWorkflow.php @@ -25,18 +25,16 @@ EOTEXT public function getCommandHelp() { return phutil_console_format(<<getWorkingCopy()->getConfigFromAnySource( + 'arc.land.onto.default'); + } + $branches = $api->getAllBranches(); - if (in_array(reset($names), ipull($branches, 'name'))) { + if (in_array($name, ipull($branches, 'name'))) { list($err, $stdout, $stderr) = $api->execManualLocal( $command, - reset($names)); + $name); } if ($err) { $match = null; - if (preg_match('/^D(\d+)$/', reset($names), $match)) { + if (preg_match('/^D(\d+)$/', $name, $match)) { try { $diff = $this->getConduit()->callMethodSynchronous( 'differential.getdiff', @@ -125,10 +131,10 @@ EOTEXT )); if ($diff['branch'] != '') { - $names[0] = $diff['branch']; + $name = $diff['branch']; list($err, $stdout, $stderr) = $api->execManualLocal( $command, - reset($names)); + $name); } } catch (ConduitException $ex) { } @@ -138,22 +144,24 @@ EOTEXT if ($err) { if ($api instanceof ArcanistMercurialAPI) { $rev = ''; - if (isset($names[1])) { - $rev = csprintf('-r %s', $names[1]); + if ($start) { + $rev = csprintf('-r %s', $start); } $exec = $api->execManualLocal( 'bookmark %C %s', $rev, - $names[0]); + $name); - if (!$exec[0] && isset($names[1])) { - $api->execxLocal('update %s', $names[0]); + if (!$exec[0] && $start) { + $api->execxLocal('update %s', $name); } } else { + $startarg = $start ? csprintf('%s', $start) : ''; $exec = $api->execManualLocal( - 'checkout --track -b %Ls', - $names); + 'checkout --track -b %s %C', + $name, + $startarg); } list($err, $stdout, $stderr) = $exec; -- 2.43.0