mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Show "hold reasons" on commit page, not on "Edit" page
Summary: Depends on D20465. Ref T13277. Currently, when a commit is unpublished, we put a single line about it on the "Edit Commit" page. This is pretty much impossible to find. Move it to the main page. This treatment is more big/bold than I'd probably like to end up, but we should probably overshoot on the explanatory text until users get used to this behavior. Also, allow searching for only published / unpublished commits. Test Plan: {F6395705} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13277 Differential Revision: https://secure.phabricator.com/D20466
This commit is contained in:
parent
8f43c773b8
commit
0fab41ff3c
10 changed files with 194 additions and 72 deletions
|
@ -4408,6 +4408,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryParsedChange' => 'applications/repository/data/PhabricatorRepositoryParsedChange.php',
|
'PhabricatorRepositoryParsedChange' => 'applications/repository/data/PhabricatorRepositoryParsedChange.php',
|
||||||
'PhabricatorRepositoryPermanentRefsTransaction' => 'applications/repository/xaction/PhabricatorRepositoryPermanentRefsTransaction.php',
|
'PhabricatorRepositoryPermanentRefsTransaction' => 'applications/repository/xaction/PhabricatorRepositoryPermanentRefsTransaction.php',
|
||||||
'PhabricatorRepositoryPublisher' => 'applications/repository/query/PhabricatorRepositoryPublisher.php',
|
'PhabricatorRepositoryPublisher' => 'applications/repository/query/PhabricatorRepositoryPublisher.php',
|
||||||
|
'PhabricatorRepositoryPublisherHoldReason' => 'applications/repository/query/PhabricatorRepositoryPublisherHoldReason.php',
|
||||||
'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php',
|
'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php',
|
||||||
'PhabricatorRepositoryPullEvent' => 'applications/repository/storage/PhabricatorRepositoryPullEvent.php',
|
'PhabricatorRepositoryPullEvent' => 'applications/repository/storage/PhabricatorRepositoryPullEvent.php',
|
||||||
'PhabricatorRepositoryPullEventPHIDType' => 'applications/repository/phid/PhabricatorRepositoryPullEventPHIDType.php',
|
'PhabricatorRepositoryPullEventPHIDType' => 'applications/repository/phid/PhabricatorRepositoryPullEventPHIDType.php',
|
||||||
|
@ -10690,6 +10691,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryParsedChange' => 'Phobject',
|
'PhabricatorRepositoryParsedChange' => 'Phobject',
|
||||||
'PhabricatorRepositoryPermanentRefsTransaction' => 'PhabricatorRepositoryTransactionType',
|
'PhabricatorRepositoryPermanentRefsTransaction' => 'PhabricatorRepositoryTransactionType',
|
||||||
'PhabricatorRepositoryPublisher' => 'Phobject',
|
'PhabricatorRepositoryPublisher' => 'Phobject',
|
||||||
|
'PhabricatorRepositoryPublisherHoldReason' => 'Phobject',
|
||||||
'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine',
|
'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine',
|
||||||
'PhabricatorRepositoryPullEvent' => array(
|
'PhabricatorRepositoryPullEvent' => array(
|
||||||
'PhabricatorRepositoryDAO',
|
'PhabricatorRepositoryDAO',
|
||||||
|
|
|
@ -54,6 +54,10 @@ final class PhabricatorCommitSearchEngine
|
||||||
$query->withUnreachable($map['unreachable']);
|
$query->withUnreachable($map['unreachable']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($map['unpublished'] !== null) {
|
||||||
|
$query->withUnpublished($map['unpublished']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($map['ancestorsOf']) {
|
if ($map['ancestorsOf']) {
|
||||||
$query->withAncestorsOf($map['ancestorsOf']);
|
$query->withAncestorsOf($map['ancestorsOf']);
|
||||||
}
|
}
|
||||||
|
@ -127,6 +131,17 @@ final class PhabricatorCommitSearchEngine
|
||||||
pht(
|
pht(
|
||||||
'Find or exclude unreachable commits which are not ancestors of '.
|
'Find or exclude unreachable commits which are not ancestors of '.
|
||||||
'any branch, tag, or ref.')),
|
'any branch, tag, or ref.')),
|
||||||
|
id(new PhabricatorSearchThreeStateField())
|
||||||
|
->setLabel(pht('Unpublished'))
|
||||||
|
->setKey('unpublished')
|
||||||
|
->setOptions(
|
||||||
|
pht('(Show All)'),
|
||||||
|
pht('Show Only Unpublished Commits'),
|
||||||
|
pht('Hide Unpublished Commits'))
|
||||||
|
->setDescription(
|
||||||
|
pht(
|
||||||
|
'Find or exclude unpublished commits which are not ancestors of '.
|
||||||
|
'any permanent branch, tag, or ref.')),
|
||||||
id(new PhabricatorSearchStringListField())
|
id(new PhabricatorSearchStringListField())
|
||||||
->setLabel(pht('Ancestors Of'))
|
->setLabel(pht('Ancestors Of'))
|
||||||
->setKey('ancestorsOf')
|
->setKey('ancestorsOf')
|
||||||
|
|
|
@ -116,6 +116,7 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$commit_data = $commit->getCommitData();
|
$commit_data = $commit->getCommitData();
|
||||||
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
||||||
$error_panel = null;
|
$error_panel = null;
|
||||||
|
$unpublished_panel = null;
|
||||||
|
|
||||||
$hard_limit = 1000;
|
$hard_limit = 1000;
|
||||||
|
|
||||||
|
@ -248,9 +249,41 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
|
|
||||||
$header->addTag($nonpermanent_tag);
|
$header->addTag($nonpermanent_tag);
|
||||||
|
|
||||||
$this->commitErrors[] = pht(
|
$holds = $commit_data->newPublisherHoldReasons();
|
||||||
'This commit is not reachable from any permanent branch, tag, '.
|
|
||||||
'or ref.');
|
$reasons = array();
|
||||||
|
foreach ($holds as $hold) {
|
||||||
|
$reasons[] = array(
|
||||||
|
phutil_tag('strong', array(), pht('%s:', $hold->getName())),
|
||||||
|
' ',
|
||||||
|
$hold->getSummary(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$holds) {
|
||||||
|
$reasons[] = pht('No further details are available.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$doc_href = PhabricatorEnv::getDoclink(
|
||||||
|
'Diffusion User Guide: Permanent Refs');
|
||||||
|
$doc_link = phutil_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => $doc_href,
|
||||||
|
'target' => '_blank',
|
||||||
|
),
|
||||||
|
pht('Learn More'));
|
||||||
|
|
||||||
|
$title = array(
|
||||||
|
pht('Unpublished Commit'),
|
||||||
|
pht(" \xC2\xB7 "),
|
||||||
|
$doc_link,
|
||||||
|
);
|
||||||
|
|
||||||
|
$unpublished_panel = id(new PHUIInfoView())
|
||||||
|
->setTitle($title)
|
||||||
|
->setErrors($reasons)
|
||||||
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,23 +478,36 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
->setWidth((int)$width);
|
->setWidth((int)$width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$description_box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Description'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->appendChild($detail_list);
|
||||||
|
|
||||||
|
$detail_box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText(pht('Details'))
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->appendChild($details);
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->setSubheader($subheader)
|
->setSubheader($subheader)
|
||||||
->setMainColumn(array(
|
->setCurtain($curtain)
|
||||||
$error_panel,
|
->setMainColumn(
|
||||||
$timeline,
|
array(
|
||||||
$merge_table,
|
$unpublished_panel,
|
||||||
$info_panel,
|
$error_panel,
|
||||||
))
|
$description_box,
|
||||||
->setFooter(array(
|
$detail_box,
|
||||||
$change_table,
|
$timeline,
|
||||||
$change_list,
|
$merge_table,
|
||||||
$add_comment,
|
$info_panel,
|
||||||
))
|
))
|
||||||
->addPropertySection(pht('Description'), $detail_list)
|
->setFooter(
|
||||||
->addPropertySection(pht('Details'), $details)
|
array(
|
||||||
->setCurtain($curtain);
|
$change_table,
|
||||||
|
$change_list,
|
||||||
|
$add_comment,
|
||||||
|
));
|
||||||
|
|
||||||
$page = $this->newPage()
|
$page = $this->newPage()
|
||||||
->setTitle($commit->getDisplayName())
|
->setTitle($commit->getDisplayName())
|
||||||
|
|
|
@ -113,30 +113,6 @@ final class DiffusionCommitEditEngine
|
||||||
->setConduitTypeDescription(pht('New auditors.'))
|
->setConduitTypeDescription(pht('New auditors.'))
|
||||||
->setValue($object->getAuditorPHIDsForEdit());
|
->setValue($object->getAuditorPHIDsForEdit());
|
||||||
|
|
||||||
$holds = $data->getPublisherHoldReasons();
|
|
||||||
if ($holds) {
|
|
||||||
$hold_names = array();
|
|
||||||
foreach ($holds as $hold) {
|
|
||||||
$hold_names[] = id(new PhabricatorRepositoryPublisher())
|
|
||||||
->getHoldName($hold);
|
|
||||||
}
|
|
||||||
$desc = implode('; ', $hold_names);
|
|
||||||
|
|
||||||
$doc_href = PhabricatorEnv::getDoclink(
|
|
||||||
'Diffusion User Guide: Permanent Refs');
|
|
||||||
$doc_link = phutil_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => $doc_href,
|
|
||||||
'target' => '_blank',
|
|
||||||
),
|
|
||||||
pht('Learn More'));
|
|
||||||
|
|
||||||
$fields[] = id(new PhabricatorStaticEditField())
|
|
||||||
->setLabel(pht('Unpublished'))
|
|
||||||
->setValue(array($desc, " \xC2\xB7 ", $doc_link));
|
|
||||||
}
|
|
||||||
|
|
||||||
$actions = DiffusionCommitActionTransaction::loadAllActions();
|
$actions = DiffusionCommitActionTransaction::loadAllActions();
|
||||||
$actions = msortv($actions, 'getCommitActionOrderVector');
|
$actions = msortv($actions, 'getCommitActionOrderVector');
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ final class DiffusionCommitQuery
|
||||||
private $statuses;
|
private $statuses;
|
||||||
private $packagePHIDs;
|
private $packagePHIDs;
|
||||||
private $unreachable;
|
private $unreachable;
|
||||||
|
private $unpublished;
|
||||||
|
|
||||||
private $needAuditRequests;
|
private $needAuditRequests;
|
||||||
private $needAuditAuthority;
|
private $needAuditAuthority;
|
||||||
|
@ -153,6 +154,11 @@ final class DiffusionCommitQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withUnpublished($unpublished) {
|
||||||
|
$this->unpublished = $unpublished;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function withStatuses(array $statuses) {
|
public function withStatuses(array $statuses) {
|
||||||
$this->statuses = $statuses;
|
$this->statuses = $statuses;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -853,6 +859,21 @@ final class DiffusionCommitQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->unpublished !== null) {
|
||||||
|
if ($this->unpublished) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'(commit.importStatus & %d) = 0',
|
||||||
|
PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE);
|
||||||
|
} else {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'(commit.importStatus & %d) = %d',
|
||||||
|
PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE,
|
||||||
|
PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $where;
|
return $where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,13 @@ abstract class DiffusionHistoryView extends DiffusionView {
|
||||||
foreach ($history as $item) {
|
foreach ($history as $item) {
|
||||||
$commit = $item->getCommit();
|
$commit = $item->getCommit();
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
|
|
||||||
|
// NOTE: The "commit" objects in the history list may be undiscovered,
|
||||||
|
// and thus not yet have PHIDs. Only load data for commits with PHIDs.
|
||||||
|
if (!$commit->getPHID()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$commits[] = $commit;
|
$commits[] = $commit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,32 +89,4 @@ final class PhabricatorRepositoryPublisher
|
||||||
return $reasons;
|
return $reasons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -( Rendering )---------------------------------------------------------- */
|
|
||||||
|
|
||||||
public function getHoldName($hold) {
|
|
||||||
$map = array(
|
|
||||||
self::HOLD_IMPORTING => array(
|
|
||||||
'name' => pht('Repository Importing'),
|
|
||||||
),
|
|
||||||
self::HOLD_PUBLISHING_DISABLED => array(
|
|
||||||
'name' => pht('Repository Publishing Disabled'),
|
|
||||||
),
|
|
||||||
self::HOLD_REF_NOT_BRANCH => array(
|
|
||||||
'name' => pht('Not a Branch'),
|
|
||||||
),
|
|
||||||
self::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF => array(
|
|
||||||
'name' => pht('Not Reachable from Permanent Ref'),
|
|
||||||
),
|
|
||||||
self::HOLD_UNTRACKED => array(
|
|
||||||
'name' => pht('Untracked Ref'),
|
|
||||||
),
|
|
||||||
self::HOLD_NOT_PERMANENT_REF => array(
|
|
||||||
'name' => pht('Not a Permanent Ref'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$spec = idx($map, $hold, array());
|
|
||||||
return idx($spec, 'name', pht('Unknown ("%s")', $hold));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorRepositoryPublisherHoldReason
|
||||||
|
extends Phobject {
|
||||||
|
|
||||||
|
private $key;
|
||||||
|
private $spec;
|
||||||
|
|
||||||
|
public static function newForHoldKey($key) {
|
||||||
|
$spec = self::getSpecForHoldKey($key);
|
||||||
|
|
||||||
|
$hold = new self();
|
||||||
|
$hold->key = $key;
|
||||||
|
$hold->spec = $spec;
|
||||||
|
|
||||||
|
return $hold;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getSpecForHoldKey($key) {
|
||||||
|
$specs = self::getHoldReasonSpecs();
|
||||||
|
|
||||||
|
$spec = idx($specs, $key);
|
||||||
|
|
||||||
|
if (!$spec) {
|
||||||
|
$spec = array(
|
||||||
|
'name' => pht('Unknown Hold ("%s")', $key),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() {
|
||||||
|
return $this->getProperty('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSummary() {
|
||||||
|
return $this->getProperty('summary');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getProperty($key, $default = null) {
|
||||||
|
return idx($this->spec, $key, $default);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getHoldReasonSpecs() {
|
||||||
|
$map = array(
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_IMPORTING => array(
|
||||||
|
'name' => pht('Repository Importing'),
|
||||||
|
'summary' => pht('This repository is still importing.'),
|
||||||
|
),
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_PUBLISHING_DISABLED => array(
|
||||||
|
'name' => pht('Publishing Disabled'),
|
||||||
|
'summary' => pht('All publishing is disabled for this repository.'),
|
||||||
|
),
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF =>
|
||||||
|
array(
|
||||||
|
'name' => pht('Not On Permanent Ref'),
|
||||||
|
'summary' => pht(
|
||||||
|
'This commit is not an ancestor of any permanent ref.'),
|
||||||
|
),
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_REF_NOT_BRANCH => array(
|
||||||
|
'name' => pht('Not a Branch'),
|
||||||
|
'summary' => pht('This ref is not a branch.'),
|
||||||
|
),
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_UNTRACKED => array(
|
||||||
|
'name' => pht('Untracked Ref'),
|
||||||
|
'summary' => pht('This ref is configured as untracked.'),
|
||||||
|
),
|
||||||
|
PhabricatorRepositoryPublisher::HOLD_NOT_PERMANENT_REF => array(
|
||||||
|
'name' => pht('Not a Permanent Ref'),
|
||||||
|
'summary' => pht('This ref is not configured as a permanent ref.'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -68,7 +68,7 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
|
||||||
->loadFromArray($dict);
|
->loadFromArray($dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPublisherHoldReasons() {
|
public function newPublisherHoldReasons() {
|
||||||
$holds = $this->getCommitDetail('holdReasons');
|
$holds = $this->getCommitDetail('holdReasons');
|
||||||
|
|
||||||
// Look for the legacy "autocloseReason" if we don't have a modern list
|
// Look for the legacy "autocloseReason" if we don't have a modern list
|
||||||
|
@ -84,7 +84,12 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
|
||||||
$holds = array();
|
$holds = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $holds;
|
foreach ($holds as $key => $reason) {
|
||||||
|
$holds[$key] = PhabricatorRepositoryPublisherHoldReason::newForHoldKey(
|
||||||
|
$reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_values($holds);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ final class PHUIInfoView extends AphrontTagView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = $this->title;
|
$title = $this->title;
|
||||||
if (strlen($title)) {
|
if ($title || strlen($title)) {
|
||||||
$title = phutil_tag(
|
$title = phutil_tag(
|
||||||
'h1',
|
'h1',
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in a new issue