1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Excluded authored commits from "Ready to Audit"; handle unreachable commits better

Summary:
Ref T10978. I'm inching toward cleaning up our audit state. Two issues are:

  - Authored commits show up in "Ready to Audit", but should not.
  - Unreachable commits (like that stacked of unsquashed stuff) show up too, but we don't really care about them.

Kick authored stuff out of the "Ready to Audit" bucket and hide unreachable commits by default, with constraints for filtering. Also give them a closed/disabled/strikethru style.

Test Plan:
  - Viewed audit buckets.
  - Searched for reachable/unreachable commits.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10978

Differential Revision: https://secure.phabricator.com/D17279
This commit is contained in:
epriestley 2017-01-31 13:16:09 -08:00
parent b2de149009
commit 4890d66795
4 changed files with 43 additions and 1 deletions

View file

@ -49,6 +49,10 @@ final class PhabricatorCommitSearchEngine
$query->withPackagePHIDs($map['packagePHIDs']); $query->withPackagePHIDs($map['packagePHIDs']);
} }
if ($map['unreachable'] !== null) {
$query->withUnreachable($map['unreachable']);
}
return $query; return $query;
} }
@ -88,6 +92,17 @@ final class PhabricatorCommitSearchEngine
->setConduitKey('packages') ->setConduitKey('packages')
->setAliases(array('package', 'packages', 'packagePHID')) ->setAliases(array('package', 'packages', 'packagePHID'))
->setDatasource(new PhabricatorOwnersPackageDatasource()), ->setDatasource(new PhabricatorOwnersPackageDatasource()),
id(new PhabricatorSearchThreeStateField())
->setLabel(pht('Unreachable'))
->setKey('unreachable')
->setOptions(
pht('(Show All)'),
pht('Show Only Unreachable Commits'),
pht('Hide Unreachable Commits'))
->setDescription(
pht(
'Find or exclude unreachable commits which are not ancestors of '.
'any branch, tag, or ref.')),
); );
} }
@ -126,7 +141,8 @@ final class PhabricatorCommitSearchEngine
$query $query
->setParameter('responsiblePHIDs', array($viewer_phid)) ->setParameter('responsiblePHIDs', array($viewer_phid))
->setParameter('statuses', $open) ->setParameter('statuses', $open)
->setParameter('bucket', $bucket_key); ->setParameter('bucket', $bucket_key)
->setParameter('unreachable', false);
return $query; return $query;
case 'authored': case 'authored':
$query $query

View file

@ -140,6 +140,7 @@ final class PhabricatorAuditListView extends AphrontView {
->setObjectName($commit_name) ->setObjectName($commit_name)
->setHeader($commit_desc) ->setHeader($commit_desc)
->setHref($commit_link) ->setHref($commit_link)
->setDisabled($commit->isUnreachable())
->addByline(pht('Author: %s', $author_name)) ->addByline(pht('Author: %s', $author_name))
->addIcon('none', $committed); ->addIcon('none', $committed);

View file

@ -14,6 +14,7 @@ final class DiffusionCommitQuery
private $responsiblePHIDs; private $responsiblePHIDs;
private $statuses; private $statuses;
private $packagePHIDs; private $packagePHIDs;
private $unreachable;
private $needAuditRequests; private $needAuditRequests;
private $auditIDs; private $auditIDs;
@ -130,6 +131,11 @@ final class DiffusionCommitQuery
return $this; return $this;
} }
public function withUnreachable($unreachable) {
$this->unreachable = $unreachable;
return $this;
}
public function withStatuses(array $statuses) { public function withStatuses(array $statuses) {
$this->statuses = $statuses; $this->statuses = $statuses;
return $this; return $this;
@ -503,6 +509,21 @@ final class DiffusionCommitQuery
$this->packagePHIDs); $this->packagePHIDs);
} }
if ($this->unreachable !== null) {
if ($this->unreachable) {
$where[] = qsprintf(
$conn,
'(commit.importStatus & %d) = %d',
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE,
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE);
} else {
$where[] = qsprintf(
$conn,
'(commit.importStatus & %d) = 0',
PhabricatorRepositoryCommit::IMPORTED_UNREACHABLE);
}
}
return $where; return $where;
} }

View file

@ -128,6 +128,10 @@ final class DiffusionCommitRequiredActionResultBucket
$should_audit = array_fuse($should_audit); $should_audit = array_fuse($should_audit);
foreach ($objects as $key => $object) { foreach ($objects as $key => $object) {
if (isset($phids[$object->getAuthorPHID()])) {
continue;
}
if (!$this->hasAuditorsWithStatus($object, $phids, $should_audit)) { if (!$this->hasAuditorsWithStatus($object, $phids, $should_audit)) {
continue; continue;
} }