From 62794e4494e0180f2fc3e62e7840099521f8ae5c Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 11 Nov 2013 16:26:58 -0800 Subject: [PATCH] Don't allow "autoclose only" to be set in Mercurial Summary: We don't actually support this yet, so hide the configuration. Test Plan: Edited branches for an hg repo. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7563 --- ...fusionRepositoryEditBranchesController.php | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php index 9cd546c92a..b22cf68cfb 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php @@ -22,9 +22,15 @@ final class DiffusionRepositoryEditBranchesController return new Aphront404Response(); } + $is_git = false; + $is_hg = false; + switch ($repository->getVersionControlSystem()) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: + $is_git = true; + break; case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: + $is_hg = true; break; case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: throw new Exception( @@ -64,9 +70,11 @@ final class DiffusionRepositoryEditBranchesController ->setTransactionType($type_track) ->setNewValue($v_track); - $xactions[] = id(clone $template) - ->setTransactionType($type_autoclose) - ->setNewValue($v_autoclose); + if (!$is_hg) { + $xactions[] = id(clone $template) + ->setTransactionType($type_autoclose) + ->setNewValue($v_autoclose); + } id(new PhabricatorRepositoryEditor()) ->setContinueOnNoEffect(true) @@ -119,18 +127,22 @@ final class DiffusionRepositoryEditBranchesController ->setLabel(pht('Track Only')) ->setValue($v_track) ->setCaption( - pht('Example: %s', phutil_tag('tt', array(), 'master, develop')))) - ->appendChild( + pht('Example: %s', phutil_tag('tt', array(), 'master, develop')))); + + if (!$is_hg) { + $form->appendChild( id(new AphrontFormTextControl()) ->setName('autoclose') ->setLabel(pht('Autoclose Only')) ->setValue($v_autoclose) ->setCaption( - pht('Example: %s', phutil_tag('tt', array(), 'master, release')))) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->setValue(pht('Save Branches')) - ->addCancelButton($edit_uri)); + pht('Example: %s', phutil_tag('tt', array(), 'master, release')))); + } + + $form->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue(pht('Save Branches')) + ->addCancelButton($edit_uri)); $form_box = id(new PHUIObjectBoxView()) ->setHeaderText($title)