From 61b728b19df6ddaa4e4f23ce0b2d1486673f6573 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 10 May 2012 14:18:56 -0700 Subject: [PATCH] Add a setting to blanket-disable autoclosing revisions in a repository Summary: For git workflows where developers push personal feature branches to the origin, this is a quick workaround until T1210 is implemented properly. I'll also mention this in D2446. Test Plan: - Committed a revision in an "autoclose" repository; it was autoclosed. Committed a revision in a no-autoclose repository, it was not autoclosed. - Edited repositories, saving the "autoclose" setting as enabled/disabled. Reviewers: aurelijus, btrahan Reviewed By: aurelijus CC: aran Maniphest Tasks: T1210 Differential Revision: https://secure.phabricator.com/D2448 --- .../PhabricatorRepositoryEditController.php | 20 +++++++++++++++++++ ...torRepositoryCommitMessageParserWorker.php | 6 ++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php index 5e91d74170..a498eca592 100644 --- a/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php @@ -248,6 +248,10 @@ final class PhabricatorRepositoryEditController $repository->setDetail('branch-filter', $branch_filter); } + $repository->setDetail( + 'disable-autoclose', + $request->getStr('autoclose') == 'disabled' ? true : false); + $repository->setDetail( 'pull-frequency', max(1, $request->getInt('frequency'))); @@ -606,6 +610,22 @@ final class PhabricatorRepositoryEditController 'Default branch to show in Diffusion.')); } + $inset + ->appendChild(id(new AphrontFormSelectControl()) + ->setName('autoclose') + ->setLabel('Autoclose') + ->setOptions(array( + 'enabled' => 'Enabled: Automatically Close Pushed Revisions', + 'disabled' => 'Disabled: Ignore Pushed Revisions', + )) + ->setCaption( + "Automatically close Differential revisions which are pushed to ". + "this repository.") + ->setValue( + $repository->getDetail('disable-autoclose', false) + ? 'disabled' + : 'enabled')); + $inset ->appendChild( id(new AphrontFormTextControl()) diff --git a/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php index eeab1b2731..e8dc74330f 100644 --- a/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php @@ -93,9 +93,11 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker $revision->getID(), $commit->getPHID()); - if ($revision->getStatus() != - ArcanistDifferentialRevisionStatus::CLOSED) { + $status_closed = ArcanistDifferentialRevisionStatus::CLOSED; + $should_close = ($revision->getStatus() != $status_closed) && + (!$repository->getDetail('disable-autoclose', false)); + if ($should_close) { $revision->setDateCommitted($commit->getEpoch()); $message = null;