diff --git a/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php index 5a3bca339d..c2cfed251d 100644 --- a/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php +++ b/src/applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php @@ -40,10 +40,11 @@ final class PhabricatorRepositoryRepositoryPHIDType $monogram = $repository->getMonogram(); $callsign = $repository->getCallsign(); $name = $repository->getName(); + $uri = $repository->getURI(); $handle->setName($monogram); $handle->setFullName("{$monogram} {$name}"); - $handle->setURI("/diffusion/{$callsign}/"); + $handle->setURI($uri); } } diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php index 04333384f9..1abc964f6c 100644 --- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php @@ -155,15 +155,15 @@ final class PhabricatorRepositorySearchEngine ->setUser($viewer) ->setObject($repository) ->setHeader($repository->getName()) - ->setObjectName('r'.$repository->getCallsign()) - ->setHref($this->getApplicationURI($repository->getCallsign().'/')); + ->setObjectName($repository->getMonogram()) + ->setHref($repository->getURI()); $commit = $repository->getMostRecentCommit(); if ($commit) { $commit_link = DiffusionView::linkCommit( - $repository, - $commit->getCommitIdentifier(), - $commit->getSummary()); + $repository, + $commit->getCommitIdentifier(), + $commit->getSummary()); $item->setSubhead($commit_link); $item->setEpoch($commit->getEpoch()); } diff --git a/src/applications/repository/search/DiffusionCommitFulltextEngine.php b/src/applications/repository/search/DiffusionCommitFulltextEngine.php index 51d2ead5fa..dd87a8bda5 100644 --- a/src/applications/repository/search/DiffusionCommitFulltextEngine.php +++ b/src/applications/repository/search/DiffusionCommitFulltextEngine.php @@ -20,8 +20,10 @@ final class DiffusionCommitFulltextEngine $commit_message = $commit_data->getCommitMessage(); $author_phid = $commit_data->getCommitDetail('authorPHID'); - $title = 'r'.$repository->getCallsign().$commit->getCommitIdentifier(). - ' '.$commit_data->getSummary(); + $monogram = $commit->getMonogram(); + $summary = $commit_data->getSummary(); + + $title = "{$monogram} {$summary}"; $document ->setDocumentCreated($date_created) diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index da6d56b915..70478bb681 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -203,10 +203,7 @@ final class PhabricatorRepositoryCommit } public function getURI() { - $repository = $this->getRepository(); - $callsign = $repository->getCallsign(); - $commit_identifier = $this->getCommitIdentifier(); - return '/r'.$callsign.$commit_identifier; + return '/'.$this->getMonogram(); } /** @@ -251,6 +248,14 @@ final class PhabricatorRepositoryCommit return $this->setAuditStatus($status); } + public function getMonogram() { + $repository = $this->getRepository(); + $callsign = $repository->getCallsign(); + $identifier = $this->getCommitIdentifier(); + + return "r{$callsign}{$identifier}"; + } + /* -( PhabricatorPolicyInterface )----------------------------------------- */ diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php index cafb28d7f6..aa2aaa270b 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php @@ -17,30 +17,26 @@ abstract class PhabricatorRepositoryCommitParserWorker pht('No "%s" in task data.', 'commitID')); } - $commit = id(new PhabricatorRepositoryCommit())->load($commit_id); - + $commit = id(new DiffusionCommitQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withIDs(array($commit_id)) + ->executeOne(); if (!$commit) { throw new PhabricatorWorkerPermanentFailureException( pht('Commit "%s" does not exist.', $commit_id)); } - return $this->commit = $commit; + $this->commit = $commit; + + return $commit; } final protected function doWork() { - if (!$this->loadCommit()) { - return; - } - - $repository = id(new PhabricatorRepositoryQuery()) - ->setViewer(PhabricatorUser::getOmnipotentUser()) - ->withIDs(array($this->commit->getRepositoryID())) - ->executeOne(); - if (!$repository) { - return; - } + $commit = $this->loadCommit(); + $repository = $commit->getRepository(); $this->repository = $repository; + $this->parseCommit($repository, $this->commit); } @@ -52,14 +48,14 @@ abstract class PhabricatorRepositoryCommitParserWorker PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit); - protected function isBadCommit($full_commit_name) { + protected function isBadCommit(PhabricatorRepositoryCommit $commit) { $repository = new PhabricatorRepository(); $bad_commit = queryfx_one( $repository->establishConnection('w'), 'SELECT * FROM %T WHERE fullCommitName = %s', PhabricatorRepository::TABLE_BADCOMMIT, - $full_commit_name); + $commit->getMonogram()); return (bool)$bad_commit; } diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php index 6563c4442c..6a0161fd06 100644 --- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php +++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php @@ -17,12 +17,8 @@ abstract class PhabricatorRepositoryCommitChangeParserWorker PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit) { - $identifier = $commit->getCommitIdentifier(); - $callsign = $repository->getCallsign(); - $full_name = 'r'.$callsign.$identifier; - - $this->log("%s\n", pht('Parsing %s...', $full_name)); - if ($this->isBadCommit($full_name)) { + $this->log("%s\n", pht('Parsing "%s"...', $commit->getMonogram())); + if ($this->isBadCommit($commit)) { $this->log(pht('This commit is marked bad!')); return; } diff --git a/src/applications/search/engine/PhabricatorJumpNavHandler.php b/src/applications/search/engine/PhabricatorJumpNavHandler.php index 9e810e3977..6c30af98dd 100644 --- a/src/applications/search/engine/PhabricatorJumpNavHandler.php +++ b/src/applications/search/engine/PhabricatorJumpNavHandler.php @@ -57,7 +57,7 @@ final class PhabricatorJumpNavHandler extends Phobject { ->execute(); if (count($repositories) == 1) { // Just one match, jump to repository. - $uri = '/diffusion/'.head($repositories)->getCallsign().'/'; + $uri = head($repositories)->getURI(); } else { // More than one match, jump to search. $uri = urisprintf('/diffusion/?order=name&name=%s', $name);