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


PHP DifferentialDiff类代码示例

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


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

示例1: loadPage

 protected function loadPage()
 {
     $table = new DifferentialDiff();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $table->loadAllFromArray($data);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialDiffQuery.php

示例2: renderDiffPropertyViewValue

 public function renderDiffPropertyViewValue(DifferentialDiff $diff)
 {
     $host = $diff->getSourceMachine();
     if (!$host) {
         return null;
     }
     return $host;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:DifferentialHostField.php

示例3: renderDiffPropertyViewValue

 public function renderDiffPropertyViewValue(DifferentialDiff $diff)
 {
     $colors = array(DifferentialUnitStatus::UNIT_NONE => 'grey', DifferentialUnitStatus::UNIT_OKAY => 'green', DifferentialUnitStatus::UNIT_WARN => 'yellow', DifferentialUnitStatus::UNIT_FAIL => 'red', DifferentialUnitStatus::UNIT_SKIP => 'blue', DifferentialUnitStatus::UNIT_AUTO_SKIP => 'blue');
     $icon_color = idx($colors, $diff->getUnitStatus(), 'grey');
     $message = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff->getUnitStatus());
     $status = id(new PHUIStatusListView())->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)->setTarget($message));
     return $status;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:8,代码来源:DifferentialUnitField.php

示例4: renderDiffPropertyViewValue

 public function renderDiffPropertyViewValue(DifferentialDiff $diff)
 {
     $path = $diff->getSourcePath();
     if (!$path) {
         return null;
     }
     return $path;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:DifferentialPathField.php

示例5: getDefaultRefName

 private function getDefaultRefName(PhabricatorRepository $repository, DifferentialDiff $diff)
 {
     $onto = $diff->loadTargetBranch();
     if ($onto !== null) {
         return $onto;
     }
     return $repository->getDefaultBranch();
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:DifferentialRevisionOperationController.php

示例6: loadDiffs

 private function loadDiffs(array $revisions)
 {
     if (!$revisions) {
         return array();
     }
     $diff_teml = new DifferentialDiff();
     $diffs = $diff_teml->loadAllWhere('revisionID in (%Ld)', array_keys($revisions));
     return $diffs;
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:9,代码来源:DifferentialRevisionStatsController.php

示例7: 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

示例8: renderHarbormasterStatus

 protected function renderHarbormasterStatus(DifferentialDiff $diff, array $messages)
 {
     $colors = array(DifferentialLintStatus::LINT_NONE => 'grey', DifferentialLintStatus::LINT_OKAY => 'green', DifferentialLintStatus::LINT_WARN => 'yellow', DifferentialLintStatus::LINT_FAIL => 'red', DifferentialLintStatus::LINT_SKIP => 'blue', DifferentialLintStatus::LINT_AUTO_SKIP => 'blue');
     $icon_color = idx($colors, $diff->getLintStatus(), 'grey');
     $message = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
     $excuse = $diff->getProperty('arc:lint-excuse');
     if (strlen($excuse)) {
         $excuse = array(phutil_tag('strong', array(), pht('Excuse:')), ' ', phutil_escape_html_newlines($excuse));
     }
     $status = id(new PHUIStatusListView())->addItem(id(new PHUIStatusItemView())->setIcon(PHUIStatusItemView::ICON_STAR, $icon_color)->setTarget($message)->setNote($excuse));
     return $status;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:12,代码来源:DifferentialLintField.php

示例9: testGenerateHarbormasterAutotargets

    public function testGenerateHarbormasterAutotargets()
    {
        $viewer = $this->generateNewTestUser();
        $raw_diff = <<<EODIFF
diff --git a/fruit b/fruit
new file mode 100644
index 0000000..1c0f49d
--- /dev/null
+++ b/fruit
@@ -0,0 +1,2 @@
+apal
+banan
EODIFF;
        $parser = new ArcanistDiffParser();
        $changes = $parser->parseDiff($raw_diff);
        $diff = DifferentialDiff::newFromRawChanges($viewer, $changes)->setLintStatus(DifferentialLintStatus::LINT_AUTO_SKIP)->setUnitStatus(DifferentialUnitStatus::UNIT_AUTO_SKIP)->attachRevision(null)->save();
        $params = array('objectPHID' => $diff->getPHID(), 'targetKeys' => array(HarbormasterArcLintBuildStepImplementation::STEPKEY, HarbormasterArcUnitBuildStepImplementation::STEPKEY));
        // Creation of autotargets should work from an empty state.
        $result = id(new ConduitCall('harbormaster.queryautotargets', $params))->setUser($viewer)->execute();
        $targets = idx($result, 'targetMap');
        foreach ($params['targetKeys'] as $target_key) {
            $this->assertTrue((bool) $result['targetMap'][$target_key]);
        }
        // Querying the same autotargets again should produce the same results,
        // not make new ones.
        $retry = id(new ConduitCall('harbormaster.queryautotargets', $params))->setUser($viewer)->execute();
        $this->assertEqual($result, $retry);
    }
开发者ID:pugong,项目名称:phabricator,代码行数:28,代码来源:HarbormasterAutotargetsTestCase.php

示例10: buildChangesetParser

 private function buildChangesetParser($type, $data, $file)
 {
     $parser = new ArcanistDiffParser();
     $changes = $parser->parseDiff($data);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     if (count($diff->getChangesets()) !== 1) {
         throw new Exception("Expected one changeset: {$file}");
     }
     $changeset = head($diff->getChangesets());
     $engine = new PhabricatorMarkupEngine();
     $engine->setViewer(new PhabricatorUser());
     $cparser = new DifferentialChangesetParser();
     $cparser->setDisableCache(true);
     $cparser->setChangeset($changeset);
     $cparser->setMarkupEngine($engine);
     if ($type == 'one') {
         $cparser->setRenderer(new DifferentialChangesetOneUpTestRenderer());
     } else {
         if ($type == 'two') {
             $cparser->setRenderer(new DifferentialChangesetTwoUpTestRenderer());
         } else {
             throw new Exception("Unknown renderer type '{$type}'!");
         }
     }
     return $cparser;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:26,代码来源:DifferentialParseRenderTestCase.php

示例11: testDetectSlowCopiedCode

    public function testDetectSlowCopiedCode()
    {
        // This tests that the detector has a reasonable runtime when a diff
        // contains a very large number of identical lines. See T5041.
        $parser = new ArcanistDiffParser();
        $line = str_repeat('x', 60);
        $oline = '-' . $line . "\n";
        $nline = '+' . $line . "\n";
        $n = 1000;
        $oblock = str_repeat($oline, $n);
        $nblock = str_repeat($nline, $n);
        $raw_diff = <<<EODIFF
diff --git a/dst b/dst
new file mode 100644
index 0000000..1234567
--- /dev/null
+++ b/dst
@@ -0,0 +1,{$n} @@
{$nblock}
diff --git a/src b/src
deleted file mode 100644
index 123457..0000000
--- a/src
+++ /dev/null
@@ -1,{$n} +0,0 @@
{$oblock}
EODIFF;
        $diff = DifferentialDiff::newFromRawChanges($parser->parseDiff($raw_diff));
        $this->assertTrue(true);
    }
开发者ID:denghp,项目名称:phabricator,代码行数:30,代码来源:DifferentialDiffTestCase.php

示例12: execute

 protected function execute(ConduitAPIRequest $request)
 {
     $viewer = $request->getUser();
     $raw_diff = $request->getValue('diff');
     $repository_phid = $request->getValue('repositoryPHID');
     if ($repository_phid) {
         $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withPHIDs(array($repository_phid))->executeOne();
         if (!$repository) {
             throw new Exception(pht('No such repository "%s"!', $repository_phid));
         }
     } else {
         $repository = null;
     }
     $parser = new ArcanistDiffParser();
     $changes = $parser->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     $diff->setLintStatus(DifferentialLintStatus::LINT_SKIP);
     $diff->setUnitStatus(DifferentialUnitStatus::UNIT_SKIP);
     $diff->setAuthorPHID($viewer->getPHID());
     $diff->setCreationMethod('web');
     if ($repository) {
         $diff->setRepositoryPHID($repository->getPHID());
     }
     id(new DifferentialDiffEditor())->setActor($viewer)->setContentSource(PhabricatorContentSource::newFromConduitRequest($request))->saveDiff($diff);
     return $this->buildDiffInfoDictionary($diff);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:26,代码来源:DifferentialCreateRawDiffConduitAPIMethod.php

示例13: executeQuery

 protected function executeQuery()
 {
     $drequest = $this->getRequest();
     $repository = $drequest->getRepository();
     if (!$drequest->getRawCommit()) {
         $effective_commit = $this->getEffectiveCommit();
         if (!$effective_commit) {
             return null;
         }
         // TODO: This side effect is kind of skethcy.
         $drequest->setCommit($effective_commit);
     } else {
         $effective_commit = $drequest->getCommit();
     }
     $options = array('-M', '-C', '--no-ext-diff', '--no-color', '--src-prefix=a/', '--dst-prefix=b/', '-U65535');
     $options = implode(' ', $options);
     list($raw_diff) = execx("(cd %s && git diff {$options} %s^ %s -- %s)", $repository->getDetail('local-path'), $effective_commit, $effective_commit, $drequest->getPath());
     $parser = new ArcanistDiffParser();
     $parser->setDetectBinaryFiles(true);
     $changes = $parser->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     $changesets = $diff->getChangesets();
     $changeset = reset($changesets);
     $this->renderingReference = $drequest->getBranchURIComponent($drequest->getBranch()) . $drequest->getPath() . ';' . $drequest->getCommit();
     return $changeset;
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:26,代码来源:DiffusionGitDiffQuery.php

示例14: executeQuery

 protected function executeQuery()
 {
     $drequest = $this->getRequest();
     $repository = $drequest->getRepository();
     $effective_commit = $this->getEffectiveCommit();
     if (!$effective_commit) {
         return null;
     }
     // TODO: This side effect is kind of skethcy.
     $drequest->setCommit($effective_commit);
     $query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest);
     $raw_diff = $query->loadRawDiff();
     $parser = new ArcanistDiffParser();
     $try_encoding = $repository->getDetail('encoding');
     if ($try_encoding) {
         $parser->setTryEncoding($try_encoding);
     }
     $parser->setDetectBinaryFiles(true);
     $changes = $parser->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     $changesets = $diff->getChangesets();
     $changeset = reset($changesets);
     $this->renderingReference = $drequest->generateURI(array('action' => 'rendering-ref'));
     return $changeset;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:25,代码来源:DiffusionMercurialDiffQuery.php

示例15: executeQuery

 protected function executeQuery()
 {
     $drequest = $this->getRequest();
     $repository = $drequest->getRepository();
     $effective_commit = $this->getEffectiveCommit();
     if (!$effective_commit) {
         return null;
     }
     // TODO: This side effect is kind of skethcy.
     $drequest->setCommit($effective_commit);
     $path = $drequest->getPath();
     list($raw_diff) = $repository->execxLocalCommand('diff -U %d --git --change %s -- %s', 65535, $effective_commit, $path);
     $parser = new ArcanistDiffParser();
     $try_encoding = $repository->getDetail('encoding');
     if ($try_encoding) {
         $parser->setTryEncoding($try_encoding);
     }
     $parser->setDetectBinaryFiles(true);
     $changes = $parser->parseDiff($raw_diff);
     $diff = DifferentialDiff::newFromRawChanges($changes);
     $changesets = $diff->getChangesets();
     $changeset = reset($changesets);
     $this->renderingReference = $drequest->getBranchURIComponent($drequest->getBranch()) . $drequest->getPath() . ';' . $drequest->getCommit();
     return $changeset;
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:25,代码来源:DiffusionMercurialDiffQuery.php


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