当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorRepositoryCommit::save方法代码示例

本文整理汇总了PHP中PhabricatorRepositoryCommit::save方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorRepositoryCommit::save方法的具体用法?PHP PhabricatorRepositoryCommit::save怎么用?PHP PhabricatorRepositoryCommit::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorRepositoryCommit的用法示例。


在下文中一共展示了PhabricatorRepositoryCommit::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:28,代码来源:PhabricatorRepositoryCommitDiscoveryDaemon.php

示例2: recordCommit

 private function recordCommit(PhabricatorRepository $repository, $commit_identifier, $epoch, $close_immediately, array $parents)
 {
     $commit = new PhabricatorRepositoryCommit();
     $commit->setRepositoryID($repository->getID());
     $commit->setCommitIdentifier($commit_identifier);
     $commit->setEpoch($epoch);
     if ($close_immediately) {
         $commit->setImportStatus(PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE);
     }
     $data = new PhabricatorRepositoryCommitData();
     $conn_w = $repository->establishConnection('w');
     try {
         // If this commit has parents, look up their IDs. The parent commits
         // should always exist already.
         $parent_ids = array();
         if ($parents) {
             $parent_rows = queryfx_all($conn_w, 'SELECT id, commitIdentifier FROM %T
         WHERE commitIdentifier IN (%Ls) AND repositoryID = %d', $commit->getTableName(), $parents, $repository->getID());
             $parent_map = ipull($parent_rows, 'id', 'commitIdentifier');
             foreach ($parents as $parent) {
                 if (empty($parent_map[$parent])) {
                     throw new Exception(pht('Unable to identify parent "%s"!', $parent));
                 }
                 $parent_ids[] = $parent_map[$parent];
             }
         } else {
             // Write an explicit 0 so we can distinguish between "really no
             // parents" and "data not available".
             if (!$repository->isSVN()) {
                 $parent_ids = array(0);
             }
         }
         $commit->openTransaction();
         $commit->save();
         $data->setCommitID($commit->getID());
         $data->save();
         foreach ($parent_ids as $parent_id) {
             queryfx($conn_w, 'INSERT IGNORE INTO %T (childCommitID, parentCommitID)
           VALUES (%d, %d)', PhabricatorRepository::TABLE_PARENTS, $commit->getID(), $parent_id);
         }
         $commit->saveTransaction();
         $this->insertTask($repository, $commit);
         queryfx($conn_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);
         if ($this->repairMode) {
             // Normally, the query should throw a duplicate key exception. If we
             // reach this in repair mode, we've actually performed a repair.
             $this->log(pht('Repaired commit "%s".', $commit_identifier));
         }
         PhutilEventEngine::dispatchEvent(new PhabricatorEvent(PhabricatorEventType::TYPE_DIFFUSION_DIDDISCOVERCOMMIT, array('repository' => $repository, 'commit' => $commit)));
     } catch (AphrontDuplicateKeyQueryException $ex) {
         $commit->killTransaction();
         // 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.
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:63,代码来源:PhabricatorRepositoryDiscoveryEngine.php

示例3: lookupSvnCommits

 private function lookupSvnCommits(PhabricatorRepository $repository, array $commits)
 {
     if (!$commits) {
         return array();
     }
     $commit_table = new PhabricatorRepositoryCommit();
     $commit_data = queryfx_all($commit_table->establishConnection('w'), 'SELECT id, commitIdentifier FROM %T
     WHERE repositoryID = %d AND commitIdentifier in (%Ls)', $commit_table->getTableName(), $repository->getID(), $commits);
     $commit_map = ipull($commit_data, 'id', 'commitIdentifier');
     $need = array();
     foreach ($commits as $commit) {
         if (empty($commit_map[$commit])) {
             $need[] = $commit;
         }
     }
     // If we are parsing a Subversion repository and have been configured to
     // import only some subdirectory of it, we may find commits which reference
     // other foreign commits outside of the directory (for instance, because of
     // a move or copy). Rather than trying to execute full parses on them, just
     // create stub commits and identify the stubs as foreign commits.
     if ($need) {
         $subpath = $repository->getDetail('svn-subpath');
         if (!$subpath) {
             $commits = implode(', ', $need);
             throw new Exception("Missing commits ({$need}) in a SVN repository which is not " . "configured for subdirectory-only parsing!");
         }
         foreach ($need as $foreign_commit) {
             $commit = new PhabricatorRepositoryCommit();
             $commit->setRepositoryID($repository->getID());
             $commit->setCommitIdentifier($foreign_commit);
             $commit->setEpoch(0);
             // Mark this commit as imported so it doesn't prevent the repository
             // from transitioning into the "Imported" state.
             $commit->setImportStatus(PhabricatorRepositoryCommit::IMPORTED_ALL);
             $commit->save();
             $data = new PhabricatorRepositoryCommitData();
             $data->setCommitID($commit->getID());
             $data->setAuthorName('');
             $data->setCommitMessage('');
             $data->setCommitDetails(array('foreign-svn-stub' => true, 'svn-subpath' => $subpath));
             $data->save();
             $commit_map[$foreign_commit] = $commit->getID();
         }
     }
     return $commit_map;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:46,代码来源:PhabricatorRepositorySvnCommitChangeParserWorker.php

示例4: createAuditsFromCommitMessage

 /**
  * Find audit requests in the "Auditors" field if it is present and trigger
  * explicit audit requests.
  */
 private function createAuditsFromCommitMessage(PhabricatorRepositoryCommit $commit, PhabricatorRepositoryCommitData $data)
 {
     $message = $data->getCommitMessage();
     $matches = null;
     if (!preg_match('/^Auditors:\\s*(.*)$/im', $message, $matches)) {
         return array();
     }
     $phids = id(new PhabricatorObjectListQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->setAllowPartialResults(true)->setAllowedTypes(array(PhabricatorPeopleUserPHIDType::TYPECONST, PhabricatorProjectProjectPHIDType::TYPECONST))->setObjectList($matches[1])->execute();
     if (!$phids) {
         return array();
     }
     $requests = id(new PhabricatorRepositoryAuditRequest())->loadAllWhere('commitPHID = %s', $commit->getPHID());
     $requests = mpull($requests, null, 'getAuditorPHID');
     foreach ($phids as $phid) {
         if (isset($requests[$phid])) {
             continue;
         }
         $request = new PhabricatorRepositoryAuditRequest();
         $request->setCommitPHID($commit->getPHID());
         $request->setAuditorPHID($phid);
         $request->setAuditStatus(PhabricatorAuditStatusConstants::AUDIT_REQUESTED);
         $request->setAuditReasons(array('Requested by Author'));
         $request->save();
         $requests[$phid] = $request;
     }
     $commit->updateAuditStatus($requests);
     $commit->save();
     return $phids;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:33,代码来源:PhabricatorRepositoryCommitHeraldWorker.php

示例5: createAuditsFromCommitMessage

 /**
  * Find audit requests in the "Auditors" field if it is present and trigger
  * explicit audit requests.
  */
 private function createAuditsFromCommitMessage(PhabricatorRepositoryCommit $commit, PhabricatorRepositoryCommitData $data)
 {
     $message = $data->getCommitMessage();
     $matches = null;
     if (!preg_match('/^Auditors:\\s*(.*)$/im', $message, $matches)) {
         return array();
     }
     $phids = DifferentialFieldSpecification::parseCommitMessageObjectList($matches[1], $include_mailables = false, $allow_partial = true);
     if (!$phids) {
         return array();
     }
     $requests = id(new PhabricatorRepositoryAuditRequest())->loadAllWhere('commitPHID = %s', $commit->getPHID());
     $requests = mpull($requests, null, 'getAuditorPHID');
     foreach ($phids as $phid) {
         if (isset($requests[$phid])) {
             continue;
         }
         $request = new PhabricatorRepositoryAuditRequest();
         $request->setCommitPHID($commit->getPHID());
         $request->setAuditorPHID($phid);
         $request->setAuditStatus(PhabricatorAuditStatusConstants::AUDIT_REQUESTED);
         $request->setAuditReasons(array('Requested by Author'));
         $request->save();
         $requests[$phid] = $request;
     }
     $commit->updateAuditStatus($requests);
     $commit->save();
     return $phids;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:33,代码来源:PhabricatorRepositoryCommitHeraldWorker.php

示例6: recordCommit

 private function recordCommit(PhabricatorRepository $repository, $commit_identifier, $epoch, $branch = null)
 {
     $commit = new PhabricatorRepositoryCommit();
     $commit->setRepositoryID($repository->getID());
     $commit->setCommitIdentifier($commit_identifier);
     $commit->setEpoch($epoch);
     $data = new PhabricatorRepositoryCommitData();
     if ($branch) {
         $data->setCommitDetail('seenOnBranches', array($branch));
     }
     try {
         $commit->openTransaction();
         $commit->save();
         $data->setCommitID($commit->getID());
         $data->save();
         $commit->saveTransaction();
         $event = new PhabricatorTimelineEvent('cmit', array('id' => $commit->getID()));
         $event->recordEvent();
         $this->insertTask($repository, $commit);
         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);
         if ($this->repair) {
             // Normally, the query should throw a duplicate key exception. If we
             // reach this in repair mode, we've actually performed a repair.
             $this->log("Repaired commit '{$commit_identifier}'.");
         }
         $this->setCache($repository, $commit_identifier);
         PhutilEventEngine::dispatchEvent(new PhabricatorEvent(PhabricatorEventType::TYPE_DIFFUSION_DIDDISCOVERCOMMIT, array('repository' => $repository, 'commit' => $commit)));
     } catch (AphrontQueryDuplicateKeyException $ex) {
         $commit->killTransaction();
         // 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->setCache($repository, $commit_identifier);
     }
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:42,代码来源:PhabricatorRepositoryPullLocalDaemon.php


注:本文中的PhabricatorRepositoryCommit::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。