本文整理汇总了PHP中PhabricatorRepositoryCommit::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepositoryCommit::getID方法的具体用法?PHP PhabricatorRepositoryCommit::getID怎么用?PHP PhabricatorRepositoryCommit::getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorRepositoryCommit
的用法示例。
在下文中一共展示了PhabricatorRepositoryCommit::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recordCommit
protected function recordCommit($commit_identifier, $epoch)
{
$repository = $this->getRepository();
$commit = new PhabricatorRepositoryCommit();
$commit->setRepositoryID($repository->getID());
$commit->setCommitIdentifier($commit_identifier);
$commit->setEpoch($epoch);
try {
$commit->save();
$event = new PhabricatorTimelineEvent('cmit', array('id' => $commit->getID()));
$event->recordEvent();
queryfx($repository->establishConnection('w'), 'INSERT INTO %T (repositoryID, size, lastCommitID, epoch)
VALUES (%d, 1, %d, %d)
ON DUPLICATE KEY UPDATE
size = size + 1,
lastCommitID =
IF(VALUES(epoch) > epoch, VALUES(lastCommitID), lastCommitID),
epoch = IF(VALUES(epoch) > epoch, VALUES(epoch), epoch)', PhabricatorRepository::TABLE_SUMMARY, $repository->getID(), $commit->getID(), $epoch);
$this->commitCache[$commit_identifier] = true;
} catch (AphrontQueryDuplicateKeyException $ex) {
// Ignore. This can happen because we discover the same new commit
// more than once when looking at history, or because of races or
// data inconsistency or cosmic radiation; in any case, we're still
// in a good state if we ignore the failure.
$this->commitCache[$commit_identifier] = true;
}
$this->stillWorking();
}
示例2: checkAuditReasons
private function checkAuditReasons(PhabricatorRepositoryCommit $commit, PhabricatorOwnersPackage $package)
{
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
$reasons = array();
if ($data->getCommitDetail('vsDiff')) {
$reasons[] = pht('Changed After Revision Was Accepted');
}
$commit_author_phid = $data->getCommitDetail('authorPHID');
if (!$commit_author_phid) {
$reasons[] = pht('Commit Author Not Recognized');
}
$revision_id = $data->getCommitDetail('differential.revisionID');
$revision_author_phid = null;
$commit_reviewedby_phid = null;
if ($revision_id) {
$revision = id(new DifferentialRevisionQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withIDs(array($revision_id))->executeOne();
if ($revision) {
$revision_author_phid = $revision->getAuthorPHID();
$commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
if ($revision_author_phid !== $commit_author_phid) {
$reasons[] = pht('Author Not Matching with Revision');
}
} else {
$reasons[] = pht('Revision Not Found');
}
} else {
$reasons[] = pht('No Revision Specified');
}
$owners_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(array($package->getID()));
if (!($commit_author_phid && in_array($commit_author_phid, $owners_phids) || $commit_reviewedby_phid && in_array($commit_reviewedby_phid, $owners_phids))) {
$reasons[] = pht('Owners Not Involved');
}
return $reasons;
}
示例3: indexCommit
public static function indexCommit(PhabricatorRepositoryCommit $commit)
{
$commit_data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
$date_created = $commit->getEpoch();
$commit_message = $commit_data->getCommitMessage();
$author_phid = $commit_data->getCommitDetail('authorPHID');
$repository = id(new PhabricatorRepository())->loadOneWhere('id = %d', $commit->getRepositoryID());
if (!$repository) {
return;
}
$title = 'r' . $repository->getCallsign() . $commit->getCommitIdentifier() . " " . $commit_data->getSummary();
$doc = new PhabricatorSearchAbstractDocument();
$doc->setPHID($commit->getPHID());
$doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_CMIT);
$doc->setDocumentCreated($date_created);
$doc->setDocumentModified($date_created);
$doc->setDocumentTitle($title);
$doc->addField(PhabricatorSearchField::FIELD_BODY, $commit_message);
if ($author_phid) {
$doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR, $author_phid, PhabricatorPHIDConstants::PHID_TYPE_USER, $date_created);
}
$doc->addRelationship(PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, $repository->getPHID(), PhabricatorPHIDConstants::PHID_TYPE_REPO, $date_created);
$comments = id(new PhabricatorAuditComment())->loadAllWhere('targetPHID = %s', $commit->getPHID());
foreach ($comments as $comment) {
if (strlen($comment->getContent())) {
$doc->addField(PhabricatorSearchField::FIELD_COMMENT, $comment->getContent());
}
}
self::reindexAbstractDocument($doc);
}
示例4: parseCommitWithRef
protected function parseCommitWithRef(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, DiffusionCommitRef $ref)
{
$this->updateCommitData($ref);
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask('PhabricatorRepositoryMercurialCommitChangeParserWorker', array('commitID' => $commit->getID()));
}
}
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PhabricatorRepositoryMercurialCommitMessageParserWorker.php
示例5: parseCommit
public function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
$ref = id(new DiffusionLowLevelCommitQuery())->setRepository($repository)->withIdentifier($commit->getCommitIdentifier())->execute();
$this->updateCommitData($ref);
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask('PhabricatorRepositorySvnCommitChangeParserWorker', array('commitID' => $commit->getID()));
}
}
示例6: parseCommit
public function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
// NOTE: %B was introduced somewhat recently in git's history, so pull
// commit message information with %s and %b instead.
// Even though we pass --encoding here, git doesn't always succeed, so
// we try a little harder, since git *does* tell us what the actual encoding
// is correctly (unless it doesn't; encoding is sometimes empty).
list($info) = $repository->execxLocalCommand('log -n 1 --encoding=%s --format=%s %s --', 'UTF-8', implode('%x00', array('%e', '%cn', '%ce', '%an', '%ae', '%s%n%n%b')), $commit->getCommitIdentifier());
$parts = explode("", $info);
$encoding = array_shift($parts);
// See note above - git doesn't always convert the encoding correctly.
$do_convert = false;
if (strlen($encoding) && strtoupper($encoding) != 'UTF-8') {
if (function_exists('mb_convert_encoding')) {
$do_convert = true;
}
}
foreach ($parts as $key => $part) {
if ($do_convert) {
$parts[$key] = mb_convert_encoding($part, 'UTF-8', $encoding);
}
$parts[$key] = phutil_utf8ize($part);
}
$committer_name = $parts[0];
$committer_email = $parts[1];
$author_name = $parts[2];
$author_email = $parts[3];
$message = $parts[4];
if (strlen($author_email)) {
$author = "{$author_name} <{$author_email}>";
} else {
$author = "{$author_name}";
}
if (strlen($committer_email)) {
$committer = "{$committer_name} <{$committer_email}>";
} else {
$committer = "{$committer_name}";
}
if ($committer == $author) {
$committer = null;
}
$this->updateCommitData($author, $message, $committer);
if ($this->shouldQueueFollowupTasks()) {
$task = new PhabricatorWorkerTask();
$task->setTaskClass('PhabricatorRepositoryGitCommitChangeParserWorker');
$task->setData(array('commitID' => $commit->getID()));
$task->save();
}
}
示例7: parseCommit
public function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
list($stdout) = $repository->execxLocalCommand('log --template %s --rev %s', '{author}\\n{desc}', $commit->getCommitIdentifier());
list($author, $message) = explode("\n", $stdout, 2);
$author = phutil_utf8ize($author);
$message = phutil_utf8ize($message);
$message = trim($message);
$this->updateCommitData($author, $message);
if ($this->shouldQueueFollowupTasks()) {
$task = new PhabricatorWorkerTask();
$task->setTaskClass('PhabricatorRepositoryMercurialCommitChangeParserWorker');
$task->setData(array('commitID' => $commit->getID()));
$task->save();
}
}
开发者ID:netcomtec,项目名称:phabricator,代码行数:15,代码来源:PhabricatorRepositoryMercurialCommitMessageParserWorker.php
示例8: parseCommit
protected final function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
if (!$this->shouldSkipImportStep()) {
$viewer = PhabricatorUser::getOmnipotentUser();
$refs_raw = DiffusionQuery::callConduitWithDiffusionRequest($viewer, DiffusionRequest::newFromDictionary(array('repository' => $repository, 'user' => $viewer)), 'diffusion.querycommits', array('repositoryPHID' => $repository->getPHID(), 'phids' => array($commit->getPHID()), 'bypassCache' => true, 'needMessages' => true));
if (empty($refs_raw['data'])) {
throw new Exception(pht('Unable to retrieve details for commit "%s"!', $commit->getPHID()));
}
$ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data']));
$this->updateCommitData($ref);
}
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask($this->getFollowupTaskClass(), array('commitID' => $commit->getID()), array('priority' => PhabricatorWorker::PRIORITY_DEFAULT));
}
}
示例9: parseCommit
public function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
$uri = $repository->getDetail('remote-uri');
$log = $this->getSVNLogXMLObject($uri, $commit->getCommitIdentifier(), $verbose = false);
$entry = $log->logentry[0];
$author = (string) $entry->author;
$message = (string) $entry->msg;
$this->updateCommitData($author, $message);
if ($this->shouldQueueFollowupTasks()) {
$task = new PhabricatorWorkerTask();
$task->setTaskClass('PhabricatorRepositorySvnCommitChangeParserWorker');
$task->setData(array('commitID' => $commit->getID()));
$task->save();
}
}
示例10: parseCommit
public function parseCommit(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit)
{
// NOTE: %B was introduced somewhat recently in git's history, so pull
// commit message information with %s and %b instead.
list($info) = $repository->execxLocalCommand("log -n 1 --encoding='UTF-8' --pretty=format:%%an%%x00%%s%%n%%n%%b %s", $commit->getCommitIdentifier());
list($author, $message) = explode("", $info);
// Make sure these are valid UTF-8.
$author = phutil_utf8ize($author);
$message = phutil_utf8ize($message);
$message = trim($message);
$this->updateCommitData($author, $message);
if ($this->shouldQueueFollowupTasks()) {
$task = new PhabricatorWorkerTask();
$task->setTaskClass('PhabricatorRepositoryGitCommitChangeParserWorker');
$task->setData(array('commitID' => $commit->getID()));
$task->save();
}
}
示例11: checkAuditReasons
private function checkAuditReasons(PhabricatorRepositoryCommit $commit, PhabricatorOwnersPackage $package)
{
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
$reasons = array();
if ($data->getCommitDetail('vsDiff')) {
$reasons[] = "Changed After Revision Was Accepted";
}
$commit_author_phid = $data->getCommitDetail('authorPHID');
if (!$commit_author_phid) {
$reasons[] = "Commit Author Not Recognized";
}
$revision_id = $data->getCommitDetail('differential.revisionID');
$revision_author_phid = null;
$commit_reviewedby_phid = null;
$commit_author_phid = null;
if ($revision_id) {
$revision = id(new DifferentialRevision())->load($revision_id);
if ($revision) {
$revision->loadRelationships();
$revision_author_phid = $revision->getAuthorPHID();
$revision_reviewedby_phid = $revision->loadReviewedBy();
$commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
$commit_author_phid = $data->getCommitDetail('authorPHID');
if ($revision_author_phid !== $commit_author_phid) {
$reasons[] = "Author Not Matching with Revision";
}
if ($revision_reviewedby_phid !== $commit_reviewedby_phid) {
$reasons[] = "ReviewedBy Not Matching with Revision";
}
} else {
$reasons[] = "Revision Not Found";
}
} else {
$reasons[] = "No Revision Specified";
}
$owners_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(array($package->getID()));
if (!($commit_author_phid && in_array($commit_author_phid, $owners_phids) || $commit_reviewedby_phid && in_array($commit_reviewedby_phid, $owners_phids))) {
$reasons[] = "Owners Not Involved";
}
return $reasons;
}
示例12: writeCommitChanges
private function writeCommitChanges(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, array $changes)
{
$repository_id = (int) $repository->getID();
$commit_id = (int) $commit->getID();
// NOTE: This SQL is being built manually instead of with qsprintf()
// because some SVN changes affect an enormous number of paths (millions)
// and this showed up as significantly slow on a profile at some point.
$changes_sql = array();
foreach ($changes as $change) {
$values = array($repository_id, (int) $change->getPathID(), $commit_id, nonempty((int) $change->getTargetPathID(), 'null'), nonempty((int) $change->getTargetCommitID(), 'null'), (int) $change->getChangeType(), (int) $change->getFileType(), (int) $change->getIsDirect(), (int) $change->getCommitSequence());
$changes_sql[] = '(' . implode(', ', $values) . ')';
}
$conn_w = $repository->establishConnection('w');
queryfx($conn_w, 'DELETE FROM %T WHERE commitID = %d', PhabricatorRepository::TABLE_PATHCHANGE, $commit_id);
foreach (PhabricatorLiskDAO::chunkSQL($changes_sql) as $chunk) {
queryfx($conn_w, 'INSERT INTO %T
(repositoryID, pathID, commitID, targetPathID, targetCommitID,
changeType, fileType, isDirect, commitSequence)
VALUES %Q', PhabricatorRepository::TABLE_PATHCHANGE, $chunk);
}
}
示例13: checkAuditReasons
private function checkAuditReasons(PhabricatorRepositoryCommit $commit, PhabricatorOwnersPackage $package)
{
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere('commitID = %d', $commit->getID());
$reasons = array();
if ($data->getCommitDetail('vsDiff')) {
$reasons[] = 'Changed After Revision Was Accepted';
}
$commit_author_phid = $data->getCommitDetail('authorPHID');
if (!$commit_author_phid) {
$reasons[] = 'Commit Author Not Recognized';
}
$revision_id = $data->getCommitDetail('differential.revisionID');
$revision_author_phid = null;
$commit_reviewedby_phid = null;
if ($revision_id) {
// TODO: (T603) This is probably safe to use an omnipotent user on,
// but check things more closely.
$revision = id(new DifferentialRevision())->load($revision_id);
if ($revision) {
$revision_author_phid = $revision->getAuthorPHID();
$commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
if ($revision_author_phid !== $commit_author_phid) {
$reasons[] = 'Author Not Matching with Revision';
}
} else {
$reasons[] = 'Revision Not Found';
}
} else {
$reasons[] = 'No Revision Specified';
}
$owners_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(array($package->getID()));
if (!($commit_author_phid && in_array($commit_author_phid, $owners_phids) || $commit_reviewedby_phid && in_array($commit_reviewedby_phid, $owners_phids))) {
$reasons[] = 'Owners Not Involved';
}
return $reasons;
}
示例14: insertTask
private function insertTask(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, $data = array())
{
$vcs = $repository->getVersionControlSystem();
switch ($vcs) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$class = 'PhabricatorRepositoryGitCommitMessageParserWorker';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$class = 'PhabricatorRepositorySvnCommitMessageParserWorker';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$class = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
break;
default:
throw new Exception("Unknown repository type '{$vcs}'!");
}
$task = new PhabricatorWorkerTask();
$task->setTaskClass($class);
$data['commitID'] = $commit->getID();
$task->setData($data);
$task->save();
}
示例15: insertTask
private function insertTask(PhabricatorRepository $repository, PhabricatorRepositoryCommit $commit, $data = array())
{
$vcs = $repository->getVersionControlSystem();
switch ($vcs) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$class = 'PhabricatorRepositoryGitCommitMessageParserWorker';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$class = 'PhabricatorRepositorySvnCommitMessageParserWorker';
break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$class = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
break;
default:
throw new Exception(pht("Unknown repository type '%s'!", $vcs));
}
$data['commitID'] = $commit->getID();
PhabricatorWorker::scheduleTask($class, $data);
}