mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 02:40:58 +01:00
Use Application PHIDs for commits
Summary: Ref T2716. Ref T2715. Move CMIT to use Application PHIDs. Nothing too special here, but I consolidated some code into DiffusionCommitQuery. Depends on D6514. Test Plan: Browsed Diffusion. Browsed Differential/Maniphest with linked commits. Used jump nav; used `phid.lookup` and `phid.query`. Used remarkup for Git and SVN repos. Grepped for PHID_TYPE_CMIT. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2715, T2716 Differential Revision: https://secure.phabricator.com/D6515
This commit is contained in:
parent
c5a06a624a
commit
0e3cb3b393
13 changed files with 166 additions and 133 deletions
|
@ -1451,6 +1451,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryManagementWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementWorkflow.php',
|
'PhabricatorRepositoryManagementWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementWorkflow.php',
|
||||||
'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryMercurialCommitChangeParserWorker.php',
|
'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryMercurialCommitChangeParserWorker.php',
|
||||||
'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php',
|
'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php',
|
||||||
|
'PhabricatorRepositoryPHIDTypeCommit' => 'applications/repository/phid/PhabricatorRepositoryPHIDTypeCommit.php',
|
||||||
'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php',
|
'PhabricatorRepositoryPullEngine' => 'applications/repository/engine/PhabricatorRepositoryPullEngine.php',
|
||||||
'PhabricatorRepositoryPullLocalDaemon' => 'applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php',
|
'PhabricatorRepositoryPullLocalDaemon' => 'applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php',
|
||||||
'PhabricatorRepositoryQuery' => 'applications/repository/query/PhabricatorRepositoryQuery.php',
|
'PhabricatorRepositoryQuery' => 'applications/repository/query/PhabricatorRepositoryQuery.php',
|
||||||
|
@ -3445,6 +3446,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryManagementWorkflow' => 'PhutilArgumentWorkflow',
|
'PhabricatorRepositoryManagementWorkflow' => 'PhutilArgumentWorkflow',
|
||||||
'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
'PhabricatorRepositoryMercurialCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
||||||
'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
'PhabricatorRepositoryMercurialCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
||||||
|
'PhabricatorRepositoryPHIDTypeCommit' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine',
|
'PhabricatorRepositoryPullEngine' => 'PhabricatorRepositoryEngine',
|
||||||
'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon',
|
'PhabricatorRepositoryPullLocalDaemon' => 'PhabricatorDaemon',
|
||||||
'PhabricatorRepositoryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorRepositoryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
|
|
@ -7,6 +7,7 @@ final class DiffusionCommitQuery
|
||||||
private $identifiers;
|
private $identifiers;
|
||||||
private $phids;
|
private $phids;
|
||||||
private $defaultRepository;
|
private $defaultRepository;
|
||||||
|
private $identifierMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load commits by partial or full identifiers, e.g. "rXab82393", "rX1234",
|
* Load commits by partial or full identifiers, e.g. "rXab82393", "rX1234",
|
||||||
|
@ -43,7 +44,19 @@ final class DiffusionCommitQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIdentifierMap() {
|
||||||
|
if ($this->identifierMap === null) {
|
||||||
|
throw new Exception(
|
||||||
|
"You must execute() the query before accessing the identifier map.");
|
||||||
|
}
|
||||||
|
return $this->identifierMap;
|
||||||
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
|
if ($this->identifierMap === null) {
|
||||||
|
$this->identifierMap = array();
|
||||||
|
}
|
||||||
|
|
||||||
$table = new PhabricatorRepositoryCommit();
|
$table = new PhabricatorRepositoryCommit();
|
||||||
$conn_r = $table->establishConnection('r');
|
$conn_r = $table->establishConnection('r');
|
||||||
|
|
||||||
|
@ -59,10 +72,6 @@ final class DiffusionCommitQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willFilterPage(array $commits) {
|
public function willFilterPage(array $commits) {
|
||||||
if (!$commits) {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$repository_ids = mpull($commits, 'getRepositoryID', 'getRepositoryID');
|
$repository_ids = mpull($commits, 'getRepositoryID', 'getRepositoryID');
|
||||||
$repos = id(new PhabricatorRepositoryQuery())
|
$repos = id(new PhabricatorRepositoryQuery())
|
||||||
->setViewer($this->getViewer())
|
->setViewer($this->getViewer())
|
||||||
|
@ -78,6 +87,47 @@ final class DiffusionCommitQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->identifiers !== null) {
|
||||||
|
$ids = array_fuse($this->identifiers);
|
||||||
|
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
foreach ($commits as $commit) {
|
||||||
|
$prefix = 'r'.$commit->getRepository()->getCallsign();
|
||||||
|
$suffix = $commit->getCommitIdentifier();
|
||||||
|
|
||||||
|
if ($commit->getRepository()->isSVN()) {
|
||||||
|
if (isset($ids[$prefix.$suffix])) {
|
||||||
|
$result[$prefix.$suffix][] = $commit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// This awkward contruction is so we can link the commits up in O(N)
|
||||||
|
// time instead of O(N^2).
|
||||||
|
for ($ii = $min_qualified; $ii <= strlen($suffix); $ii++) {
|
||||||
|
$part = substr($suffix, 0, $ii);
|
||||||
|
if (isset($ids[$prefix.$part])) {
|
||||||
|
$result[$prefix.$part][] = $commit;
|
||||||
|
}
|
||||||
|
if (isset($ids[$part])) {
|
||||||
|
$result[$part][] = $commit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($result as $identifier => $matching_commits) {
|
||||||
|
if (count($matching_commits) == 1) {
|
||||||
|
$result[$identifier] = head($matching_commits);
|
||||||
|
} else {
|
||||||
|
// This reference is ambiguous (it matches more than one commit) so
|
||||||
|
// don't link it
|
||||||
|
unset($result[$identifier]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->identifierMap += $result;
|
||||||
|
}
|
||||||
|
|
||||||
return $commits;
|
return $commits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,4 +240,14 @@ final class DiffusionCommitQuery
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function didFilterResults(array $filtered) {
|
||||||
|
if ($this->identifierMap) {
|
||||||
|
foreach ($this->identifierMap as $name => $commit) {
|
||||||
|
if (isset($filtered[$commit->getPHID()])) {
|
||||||
|
unset($this->identifierMap[$name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,68 +12,19 @@ final class DiffusionRemarkupRule
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getObjectIDPattern() {
|
protected function getObjectIDPattern() {
|
||||||
$min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH;
|
return PhabricatorRepositoryPHIDTypeCommit::getCommitObjectNamePattern();
|
||||||
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
|
||||||
|
|
||||||
return
|
|
||||||
'r[A-Z]+[1-9]\d*'.
|
|
||||||
'|'.
|
|
||||||
'r[A-Z]+[a-f0-9]{'.$min_qualified.',40}'.
|
|
||||||
'|'.
|
|
||||||
'[a-f0-9]{'.$min_unqualified.',40}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadObjects(array $ids) {
|
protected function loadObjects(array $ids) {
|
||||||
$viewer = $this->getEngine()->getConfig('viewer');
|
$viewer = $this->getEngine()->getConfig('viewer');
|
||||||
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
|
||||||
|
|
||||||
$commits = id(new DiffusionCommitQuery())
|
$query = id(new DiffusionCommitQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIdentifiers($ids)
|
->withIdentifiers($ids);
|
||||||
->execute();
|
|
||||||
|
|
||||||
if (!$commits) {
|
$query->execute();
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$ids = array_fuse($ids);
|
return $query->getIdentifierMap();
|
||||||
|
|
||||||
$result = array();
|
|
||||||
foreach ($commits as $commit) {
|
|
||||||
$prefix = 'r'.$commit->getRepository()->getCallsign();
|
|
||||||
$suffix = $commit->getCommitIdentifier();
|
|
||||||
|
|
||||||
if ($commit->getRepository()->isSVN()) {
|
|
||||||
if (isset($ids[$prefix.$suffix])) {
|
|
||||||
$result[$prefix.$suffix][] = $commit;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// This awkward contruction is so we can link the commits up in O(N)
|
|
||||||
// time instead of O(N^2).
|
|
||||||
for ($ii = $min_qualified; $ii <= strlen($suffix); $ii++) {
|
|
||||||
$part = substr($suffix, 0, $ii);
|
|
||||||
if (isset($ids[$prefix.$part])) {
|
|
||||||
$result[$prefix.$part][] = $commit;
|
|
||||||
}
|
|
||||||
if (isset($ids[$part])) {
|
|
||||||
$result[$part][] = $commit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($result as $identifier => $commits) {
|
|
||||||
if (count($commits) == 1) {
|
|
||||||
$result[$identifier] = head($commits);
|
|
||||||
} else {
|
|
||||||
// This reference is ambiguous -- it matches more than one commit -- so
|
|
||||||
// don't link it. We could potentially improve this, but it's a bit
|
|
||||||
// tricky since the superclass expects a single object.
|
|
||||||
unset($result[$identifier]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,6 @@ final class PhabricatorObjectHandle
|
||||||
static $map = array(
|
static $map = array(
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'User',
|
PhabricatorPHIDConstants::PHID_TYPE_USER => 'User',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Task',
|
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Task',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_CMIT => 'Commit',
|
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction Document',
|
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction Document',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_MCRO => 'Image Macro',
|
PhabricatorPHIDConstants::PHID_TYPE_MCRO => 'Image Macro',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_MOCK => 'Pholio Mock',
|
PhabricatorPHIDConstants::PHID_TYPE_MOCK => 'Pholio Mock',
|
||||||
|
|
|
@ -9,7 +9,6 @@ final class PhabricatorPHIDConstants {
|
||||||
const PHID_TYPE_UNKNOWN = '????';
|
const PHID_TYPE_UNKNOWN = '????';
|
||||||
const PHID_TYPE_MAGIC = '!!!!';
|
const PHID_TYPE_MAGIC = '!!!!';
|
||||||
const PHID_TYPE_REPO = 'REPO';
|
const PHID_TYPE_REPO = 'REPO';
|
||||||
const PHID_TYPE_CMIT = 'CMIT';
|
|
||||||
const PHID_TYPE_OPKG = 'OPKG';
|
const PHID_TYPE_OPKG = 'OPKG';
|
||||||
const PHID_TYPE_PSTE = 'PSTE';
|
const PHID_TYPE_PSTE = 'PSTE';
|
||||||
const PHID_TYPE_STRY = 'STRY';
|
const PHID_TYPE_STRY = 'STRY';
|
||||||
|
|
|
@ -56,13 +56,6 @@ final class PhabricatorObjectHandleData {
|
||||||
$phids);
|
$phids);
|
||||||
return mpull($users, null, 'getPHID');
|
return mpull($users, null, 'getPHID');
|
||||||
|
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
|
|
||||||
$commits = id(new DiffusionCommitQuery())
|
|
||||||
->setViewer($this->viewer)
|
|
||||||
->withPHIDs($phids)
|
|
||||||
->execute();
|
|
||||||
return mpull($commits, null, 'getPHID');
|
|
||||||
|
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
||||||
// TODO: Update this to ManiphestTaskQuery, //especially// after we have
|
// TODO: Update this to ManiphestTaskQuery, //especially// after we have
|
||||||
// policy-awareness
|
// policy-awareness
|
||||||
|
@ -325,39 +318,6 @@ final class PhabricatorObjectHandleData {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
|
|
||||||
foreach ($phids as $phid) {
|
|
||||||
$handle = new PhabricatorObjectHandle();
|
|
||||||
$handle->setPHID($phid);
|
|
||||||
$handle->setType($type);
|
|
||||||
|
|
||||||
if (empty($objects[$phid])) {
|
|
||||||
$handle->setName('Unknown Commit');
|
|
||||||
} else {
|
|
||||||
$repository = $objects[$phid]->getRepository();
|
|
||||||
$commit = $objects[$phid];
|
|
||||||
$callsign = $repository->getCallsign();
|
|
||||||
$commit_identifier = $commit->getCommitIdentifier();
|
|
||||||
|
|
||||||
$name = $repository->formatCommitName($commit_identifier);
|
|
||||||
$handle->setName($name);
|
|
||||||
|
|
||||||
$summary = $commit->getSummary();
|
|
||||||
if (strlen($summary)) {
|
|
||||||
$handle->setFullName($name.': '.$summary);
|
|
||||||
} else {
|
|
||||||
$handle->setFullName($name);
|
|
||||||
}
|
|
||||||
|
|
||||||
$handle->setURI('/r'.$callsign.$commit_identifier);
|
|
||||||
$handle->setTimestamp($commit->getEpoch());
|
|
||||||
$handle->setComplete(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$handles[$phid] = $handle;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
case PhabricatorPHIDConstants::PHID_TYPE_TASK:
|
||||||
foreach ($phids as $phid) {
|
foreach ($phids as $phid) {
|
||||||
$handle = new PhabricatorObjectHandle();
|
$handle = new PhabricatorObjectHandle();
|
||||||
|
|
|
@ -43,28 +43,8 @@ final class PhabricatorPHID {
|
||||||
// It's already a PHID! Yay.
|
// It's already a PHID! Yay.
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
if (preg_match('/^r([A-Z]+)(\S*)$/', $name, $match)) {
|
|
||||||
$repository = id(new PhabricatorRepository())
|
if (preg_match('/^t(\d+)$/i', $name, $match)) {
|
||||||
->loadOneWhere('callsign = %s', $match[1]);
|
|
||||||
if ($match[2] == '') {
|
|
||||||
$object = $repository;
|
|
||||||
} else if ($repository) {
|
|
||||||
$object = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
|
||||||
'repositoryID = %d AND commitIdentifier = %s',
|
|
||||||
$repository->getID(),
|
|
||||||
$match[2]);
|
|
||||||
if (!$object) {
|
|
||||||
try {
|
|
||||||
$object = id(new PhabricatorRepositoryCommit())->loadOneWhere(
|
|
||||||
'repositoryID = %d AND commitIdentifier LIKE %>',
|
|
||||||
$repository->getID(),
|
|
||||||
$match[2]);
|
|
||||||
} catch (AphrontQueryCountException $ex) {
|
|
||||||
// Ambiguous; return nothing.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (preg_match('/^t(\d+)$/i', $name, $match)) {
|
|
||||||
$object = id(new ManiphestTask())->load($match[1]);
|
$object = id(new ManiphestTask())->load($match[1]);
|
||||||
} else if (preg_match('/^m(\d+)$/i', $name, $match)) {
|
} else if (preg_match('/^m(\d+)$/i', $name, $match)) {
|
||||||
$objects = id(new PholioMockQuery())
|
$objects = id(new PholioMockQuery())
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorRepositoryPHIDTypeCommit extends PhabricatorPHIDType {
|
||||||
|
|
||||||
|
const TYPECONST = 'CMIT';
|
||||||
|
|
||||||
|
public function getTypeConstant() {
|
||||||
|
return self::TYPECONST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTypeName() {
|
||||||
|
return pht('Commit');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newObject() {
|
||||||
|
return new PhabricatorRepositoryCommit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadObjects(
|
||||||
|
PhabricatorObjectQuery $query,
|
||||||
|
array $phids) {
|
||||||
|
|
||||||
|
return id(new DiffusionCommitQuery())
|
||||||
|
->setViewer($query->getViewer())
|
||||||
|
->withPHIDs($phids)
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadHandles(
|
||||||
|
PhabricatorHandleQuery $query,
|
||||||
|
array $handles,
|
||||||
|
array $objects) {
|
||||||
|
|
||||||
|
foreach ($handles as $phid => $handle) {
|
||||||
|
$commit = $objects[$phid];
|
||||||
|
$repository = $commit->getRepository();
|
||||||
|
$callsign = $repository->getCallsign();
|
||||||
|
$commit_identifier = $commit->getCommitIdentifier();
|
||||||
|
|
||||||
|
$name = $repository->formatCommitName($commit_identifier);
|
||||||
|
$summary = $commit->getSummary();
|
||||||
|
if (strlen($summary)) {
|
||||||
|
$full_name = $name.': '.$summary;
|
||||||
|
} else {
|
||||||
|
$full_name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$handle->setName($name);
|
||||||
|
$handle->setFullName($full_name);
|
||||||
|
$handle->setURI('/r'.$callsign.$commit_identifier);
|
||||||
|
$handle->setTimestamp($commit->getEpoch());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCommitObjectNamePattern() {
|
||||||
|
$min_unqualified = PhabricatorRepository::MINIMUM_UNQUALIFIED_HASH;
|
||||||
|
$min_qualified = PhabricatorRepository::MINIMUM_QUALIFIED_HASH;
|
||||||
|
|
||||||
|
return
|
||||||
|
'r[A-Z]+[1-9]\d*'.
|
||||||
|
'|'.
|
||||||
|
'r[A-Z]+[a-f0-9]{'.$min_qualified.',40}'.
|
||||||
|
'|'.
|
||||||
|
'[a-f0-9]{'.$min_unqualified.',40}';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function canLoadNamedObject($name) {
|
||||||
|
$pattern = self::getCommitObjectNamePattern();
|
||||||
|
return preg_match('(^'.$pattern.'$)', $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadNamedObjects(
|
||||||
|
PhabricatorObjectQuery $query,
|
||||||
|
array $names) {
|
||||||
|
|
||||||
|
$query = id(new DiffusionCommitQuery())
|
||||||
|
->setViewer($query->getViewer())
|
||||||
|
->withIdentifiers($names);
|
||||||
|
|
||||||
|
$query->execute();
|
||||||
|
|
||||||
|
return $query->getIdentifierMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ final class PhabricatorRepositoryCommit
|
||||||
private $commitData;
|
private $commitData;
|
||||||
private $audits;
|
private $audits;
|
||||||
private $isUnparsed;
|
private $isUnparsed;
|
||||||
private $repository;
|
private $repository = self::ATTACHABLE;
|
||||||
|
|
||||||
public function attachRepository(PhabricatorRepository $repository) {
|
public function attachRepository(PhabricatorRepository $repository) {
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
|
@ -25,10 +25,7 @@ final class PhabricatorRepositoryCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRepository() {
|
public function getRepository() {
|
||||||
if ($this->repository === null) {
|
return $this->assertAttached($this->repository);
|
||||||
throw new Exception("Call attachRepository() before getRepository()!");
|
|
||||||
}
|
|
||||||
return $this->repository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setIsUnparsed($is_unparsed) {
|
public function setIsUnparsed($is_unparsed) {
|
||||||
|
@ -49,7 +46,7 @@ final class PhabricatorRepositoryCommit
|
||||||
|
|
||||||
public function generatePHID() {
|
public function generatePHID() {
|
||||||
return PhabricatorPHID::generateNewPHID(
|
return PhabricatorPHID::generateNewPHID(
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_CMIT);
|
PhabricatorRepositoryPHIDTypeCommit::TYPECONST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadCommitData() {
|
public function loadCommitData() {
|
||||||
|
|
|
@ -206,7 +206,7 @@ final class PhabricatorSearchAttachController
|
||||||
$noun = 'Tasks';
|
$noun = 'Tasks';
|
||||||
$selected = 'assigned';
|
$selected = 'assigned';
|
||||||
break;
|
break;
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
|
case PhabricatorRepositoryPHIDTypeCommit::TYPECONST:
|
||||||
$noun = 'Commits';
|
$noun = 'Commits';
|
||||||
$selected = 'created';
|
$selected = 'created';
|
||||||
break;
|
break;
|
||||||
|
@ -269,7 +269,7 @@ final class PhabricatorSearchAttachController
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getEdgeType($src_type, $dst_type) {
|
private function getEdgeType($src_type, $dst_type) {
|
||||||
$t_cmit = PhabricatorPHIDConstants::PHID_TYPE_CMIT;
|
$t_cmit = PhabricatorRepositoryPHIDTypeCommit::TYPECONST;
|
||||||
$t_task = PhabricatorPHIDConstants::PHID_TYPE_TASK;
|
$t_task = PhabricatorPHIDConstants::PHID_TYPE_TASK;
|
||||||
$t_drev = DifferentialPHIDTypeRevision::TYPECONST;
|
$t_drev = DifferentialPHIDTypeRevision::TYPECONST;
|
||||||
$t_mock = PhabricatorPHIDConstants::PHID_TYPE_MOCK;
|
$t_mock = PhabricatorPHIDConstants::PHID_TYPE_MOCK;
|
||||||
|
|
|
@ -63,7 +63,7 @@ final class PhabricatorSearchController
|
||||||
case PhabricatorSearchScope::SCOPE_COMMITS:
|
case PhabricatorSearchScope::SCOPE_COMMITS:
|
||||||
$query->setParameter(
|
$query->setParameter(
|
||||||
'type',
|
'type',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_CMIT);
|
PhabricatorRepositoryPHIDTypeCommit::TYPECONST);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,7 +16,7 @@ final class PhabricatorSearchAbstractDocument {
|
||||||
public static function getSupportedTypes() {
|
public static function getSupportedTypes() {
|
||||||
return array(
|
return array(
|
||||||
DifferentialPHIDTypeRevision::TYPECONST => 'Differential Revisions',
|
DifferentialPHIDTypeRevision::TYPECONST => 'Differential Revisions',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_CMIT => 'Repository Commits',
|
PhabricatorRepositoryPHIDTypeCommit::TYPECONST => 'Repository Commits',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Maniphest Tasks',
|
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'Maniphest Tasks',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction Documents',
|
PhabricatorPHIDConstants::PHID_TYPE_WIKI => 'Phriction Documents',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'Phabricator Users',
|
PhabricatorPHIDConstants::PHID_TYPE_USER => 'Phabricator Users',
|
||||||
|
|
|
@ -155,7 +155,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
||||||
|
|
||||||
static $class_map = array(
|
static $class_map = array(
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'ManiphestTask',
|
PhabricatorPHIDConstants::PHID_TYPE_TASK => 'ManiphestTask',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_CMIT => 'PhabricatorRepository',
|
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_FILE => 'PhabricatorFile',
|
PhabricatorPHIDConstants::PHID_TYPE_FILE => 'PhabricatorFile',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_USER => 'PhabricatorUser',
|
PhabricatorPHIDConstants::PHID_TYPE_USER => 'PhabricatorUser',
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_PROJ => 'PhabricatorProject',
|
PhabricatorPHIDConstants::PHID_TYPE_PROJ => 'PhabricatorProject',
|
||||||
|
|
Loading…
Reference in a new issue