Skip to content

Commit 61b728b

Browse files
author
epriestley
committed
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
1 parent d24c81c commit 61b728b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/applications/repository/controller/edit/PhabricatorRepositoryEditController.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ private function processTrackingRequest() {
248248
$repository->setDetail('branch-filter', $branch_filter);
249249
}
250250

251+
$repository->setDetail(
252+
'disable-autoclose',
253+
$request->getStr('autoclose') == 'disabled' ? true : false);
254+
251255
$repository->setDetail(
252256
'pull-frequency',
253257
max(1, $request->getInt('frequency')));
@@ -606,6 +610,22 @@ private function processTrackingRequest() {
606610
'Default branch to show in Diffusion.'));
607611
}
608612

613+
$inset
614+
->appendChild(id(new AphrontFormSelectControl())
615+
->setName('autoclose')
616+
->setLabel('Autoclose')
617+
->setOptions(array(
618+
'enabled' => 'Enabled: Automatically Close Pushed Revisions',
619+
'disabled' => 'Disabled: Ignore Pushed Revisions',
620+
))
621+
->setCaption(
622+
"Automatically close Differential revisions which are pushed to ".
623+
"this repository.")
624+
->setValue(
625+
$repository->getDetail('disable-autoclose', false)
626+
? 'disabled'
627+
: 'enabled'));
628+
609629
$inset
610630
->appendChild(
611631
id(new AphrontFormTextControl())

src/applications/repository/worker/commitmessageparser/base/PhabricatorRepositoryCommitMessageParserWorker.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ final protected function updateCommitData($author, $message) {
9393
$revision->getID(),
9494
$commit->getPHID());
9595

96-
if ($revision->getStatus() !=
97-
ArcanistDifferentialRevisionStatus::CLOSED) {
96+
$status_closed = ArcanistDifferentialRevisionStatus::CLOSED;
97+
$should_close = ($revision->getStatus() != $status_closed) &&
98+
(!$repository->getDetail('disable-autoclose', false));
9899

100+
if ($should_close) {
99101
$revision->setDateCommitted($commit->getEpoch());
100102

101103
$message = null;

0 commit comments

Comments
 (0)