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


PHP DifferentialDiff::getRevisionID方法代码示例

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


在下文中一共展示了DifferentialDiff::getRevisionID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addDiff

 public function addDiff(DifferentialDiff $diff, $comments)
 {
     if ($diff->getRevisionID() && $diff->getRevisionID() != $this->getRevision()->getID()) {
         $diff_id = (int) $diff->getID();
         $targ_id = (int) $this->getRevision()->getID();
         $real_id = (int) $diff->getRevisionID();
         throw new Exception("Can not attach diff #{$diff_id} to Revision D{$targ_id}, it is " . "already attached to D{$real_id}.");
     }
     $this->diff = $diff;
     $this->comments = $comments;
     return $this;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:12,代码来源:DifferentialRevisionEditor.php

示例2: createDiffDict

 public static function createDiffDict(DifferentialDiff $diff)
 {
     $dict = array('id' => $diff->getID(), 'parent' => $diff->getParentRevisionID(), 'revisionID' => $diff->getRevisionID(), 'sourceControlBaseRevision' => $diff->getSourceControlBaseRevision(), 'sourceControlPath' => $diff->getSourceControlPath(), 'changes' => array(), 'properties' => array());
     foreach ($diff->getChangesets() as $changeset) {
         $hunks = array();
         foreach ($changeset->getHunks() as $hunk) {
             $hunks[] = array('oldOffset' => $hunk->getOldOffset(), 'newOffset' => $hunk->getNewOffset(), 'oldLength' => $hunk->getOldLen(), 'newLength' => $hunk->getNewLen(), 'addLines' => null, 'delLines' => null, 'isMissingOldNewline' => null, 'isMissingNewNewline' => null, 'corpus' => $hunk->getChanges());
         }
         $change = array('metadata' => $changeset->getMetadata(), 'oldPath' => $changeset->getOldFile(), 'currentPath' => $changeset->getFileName(), 'awayPaths' => $changeset->getAwayPaths(), 'oldProperties' => $changeset->getOldProperties(), 'newProperties' => $changeset->getNewProperties(), 'type' => $changeset->getChangeType(), 'fileType' => $changeset->getFileType(), 'commitHash' => null, 'hunks' => $hunks);
         $dict['changes'][] = $change;
     }
     $properties = id(new DifferentialDiffProperty())->loadAllWhere('diffID = %d', $diff->getID());
     foreach ($properties as $property) {
         $dict['properties'][$property->getName()] = $property->getData();
     }
     return $dict;
 }
开发者ID:hwang36,项目名称:phabricator,代码行数:17,代码来源:ConduitAPI_differential_getdiff_Method.php

示例3: loadChangedByCommit

 private function loadChangedByCommit(DifferentialDiff $diff)
 {
     $repository = $this->repository;
     $vs_changesets = array();
     $vs_diff = id(new DifferentialDiff())->loadOneWhere('revisionID = %d AND creationMethod != %s ORDER BY id DESC LIMIT 1', $diff->getRevisionID(), 'commit');
     foreach ($vs_diff->loadChangesets() as $changeset) {
         $path = $changeset->getAbsoluteRepositoryPath($repository, $vs_diff);
         $path = ltrim($path, '/');
         $vs_changesets[$path] = $changeset;
     }
     $changesets = array();
     foreach ($diff->getChangesets() as $changeset) {
         $path = $changeset->getAbsoluteRepositoryPath($repository, $diff);
         $path = ltrim($path, '/');
         $changesets[$path] = $changeset;
     }
     if (array_fill_keys(array_keys($changesets), true) != array_fill_keys(array_keys($vs_changesets), true)) {
         return $vs_diff;
     }
     $hunks = id(new DifferentialHunk())->loadAllWhere('changesetID IN (%Ld)', mpull($vs_changesets, 'getID'));
     $hunks = mgroup($hunks, 'getChangesetID');
     foreach ($vs_changesets as $changeset) {
         $changeset->attachHunks(idx($hunks, $changeset->getID(), array()));
     }
     $file_phids = array();
     foreach ($vs_changesets as $changeset) {
         $metadata = $changeset->getMetadata();
         $file_phid = idx($metadata, 'new:binary-phid');
         if ($file_phid) {
             $file_phids[$file_phid] = $file_phid;
         }
     }
     $files = array();
     if ($file_phids) {
         $files = id(new PhabricatorFile())->loadAllWhere('phid IN (%Ls)', $file_phids);
         $files = mpull($files, null, 'getPHID');
     }
     foreach ($changesets as $path => $changeset) {
         $vs_changeset = $vs_changesets[$path];
         $file_phid = idx($vs_changeset->getMetadata(), 'new:binary-phid');
         if ($file_phid) {
             if (!isset($files[$file_phid])) {
                 return $vs_diff;
             }
             $drequest = DiffusionRequest::newFromDictionary(array('repository' => $this->repository, 'commit' => $this->commit->getCommitIdentifier(), 'path' => $path));
             $corpus = DiffusionFileContentQuery::newFromDiffusionRequest($drequest)->loadFileContent()->getCorpus();
             if ($files[$file_phid]->loadFileData() != $corpus) {
                 return $vs_diff;
             }
         } else {
             $context = implode("\n", $changeset->makeChangesWithContext());
             $vs_context = implode("\n", $vs_changeset->makeChangesWithContext());
             // We couldn't just compare $context and $vs_context because following
             // diffs will be considered different:
             //
             //   -(empty line)
             //   -echo 'test';
             //    (empty line)
             //
             //    (empty line)
             //   -echo "test";
             //   -(empty line)
             $hunk = id(new DifferentialHunk())->setChanges($context);
             $vs_hunk = id(new DifferentialHunk())->setChanges($vs_context);
             if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() || $hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
                 return $vs_diff;
             }
         }
     }
     return null;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:71,代码来源:PhabricatorRepositoryCommitMessageParserWorker.php


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