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;