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


PHP DifferentialDiff::getSourceControlSystem方法代码示例

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


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

示例1: renderBaseRevision

 private function renderBaseRevision(DifferentialDiff $diff)
 {
     switch ($diff->getSourceControlSystem()) {
         case 'git':
             $base = $diff->getSourceControlBaseRevision();
             if (strpos($base, '@') === false) {
                 $label = substr($base, 0, 7);
             } else {
                 // The diff is from git-svn
                 $base = explode('@', $base);
                 $base = last($base);
                 $label = $base;
             }
             break;
         case 'svn':
             $base = $diff->getSourceControlBaseRevision();
             $base = explode('@', $base);
             $base = last($base);
             $label = $base;
             break;
         default:
             $label = null;
             break;
     }
     $link = null;
     if ($label) {
         $commit_for_link = idx($this->commitsForLinks, $diff->getSourceControlBaseRevision());
         if ($commit_for_link) {
             $link = phutil_tag('a', array('href' => $commit_for_link->getURI()), $label);
         } else {
             $link = $label;
         }
     }
     return $link;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:35,代码来源:DifferentialRevisionUpdateHistoryView.php

示例2: updateRevisionHashTable

 /**
  * Update the table connecting revisions to DVCS local hashes, so we can
  * identify revisions by commit/tree hashes.
  */
 private function updateRevisionHashTable(DifferentialRevision $revision, DifferentialDiff $diff)
 {
     $vcs = $diff->getSourceControlSystem();
     if ($vcs == DifferentialRevisionControlSystem::SVN) {
         // Subversion has no local commit or tree hash information, so we don't
         // have to do anything.
         return;
     }
     $property = id(new DifferentialDiffProperty())->loadOneWhere('diffID = %d AND name = %s', $diff->getID(), 'local:commits');
     if (!$property) {
         return;
     }
     $hashes = array();
     $data = $property->getData();
     switch ($vcs) {
         case DifferentialRevisionControlSystem::GIT:
             foreach ($data as $commit) {
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_GIT_COMMIT, $commit['commit']);
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_GIT_TREE, $commit['tree']);
             }
             break;
         case DifferentialRevisionControlSystem::MERCURIAL:
             foreach ($data as $commit) {
                 $hashes[] = array(ArcanistDifferentialRevisionHash::HASH_MERCURIAL_COMMIT, $commit['rev']);
             }
             break;
     }
     $conn_w = $revision->establishConnection('w');
     $sql = array();
     foreach ($hashes as $info) {
         list($type, $hash) = $info;
         $sql[] = qsprintf($conn_w, '(%d, %s, %s)', $revision->getID(), $type, $hash);
     }
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', ArcanistDifferentialRevisionHash::TABLE_NAME, $revision->getID());
     if ($sql) {
         queryfx($conn_w, 'INSERT INTO %T (revisionID, type, hash) VALUES %Q', ArcanistDifferentialRevisionHash::TABLE_NAME, implode(', ', $sql));
     }
 }
开发者ID:kristain,项目名称:phabricator,代码行数:42,代码来源:DifferentialTransactionEditor.php

示例3: getRevisionProperties

 private function getRevisionProperties(DifferentialRevision $revision, DifferentialDiff $diff, array $handles, array $diff_properties)
 {
     $properties = array();
     $status = $revision->getStatus();
     $next_step = null;
     if ($status == DifferentialRevisionStatus::ACCEPTED) {
         switch ($diff->getSourceControlSystem()) {
             case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
                 $next_step = 'arc amend --revision ' . $revision->getID();
                 break;
             case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
                 $next_step = 'arc commit --revision ' . $revision->getID();
                 break;
         }
         if ($next_step) {
             $next_step = ' &middot; ' . 'Next step: <tt>' . phutil_escape_html($next_step) . '</tt>';
         }
     }
     $status = DifferentialRevisionStatus::getNameForRevisionStatus($status);
     $properties['Revision Status'] = '<strong>' . $status . '</strong>' . $next_step;
     $author = $handles[$revision->getAuthorPHID()];
     $properties['Author'] = $author->renderLink();
     $properties['Reviewers'] = $this->renderHandleLinkList(array_select_keys($handles, $revision->getReviewers()));
     $properties['CCs'] = $this->renderHandleLinkList(array_select_keys($handles, $revision->getCCPHIDs()));
     $host = $diff->getSourceMachine();
     if ($host) {
         $properties['Host'] = phutil_escape_html($host);
     }
     $path = $diff->getSourcePath();
     if ($path) {
         $branch = $diff->getBranch() ? ' (' . $diff->getBranch() . ')' : '';
         $properties['Path'] = phutil_escape_html("{$path} {$branch}");
     }
     $lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
     $lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
     $ldata = idx($diff_properties, 'arc:lint');
     $ltail = null;
     if ($ldata) {
         $ldata = igroup($ldata, 'path');
         $lint_messages = array();
         foreach ($ldata as $path => $messages) {
             $message_markup = array();
             foreach ($messages as $message) {
                 $path = idx($message, 'path');
                 $line = idx($message, 'line');
                 $code = idx($message, 'code');
                 $severity = idx($message, 'severity');
                 $name = idx($message, 'name');
                 $description = idx($message, 'description');
                 $message_markup[] = '<li>' . '<span class="lint-severity-' . phutil_escape_html($severity) . '">' . phutil_escape_html(ucwords($severity)) . '</span>' . ' ' . '(' . phutil_escape_html($code) . ') ' . phutil_escape_html($name) . ' at line ' . phutil_escape_html($line) . '<p>' . phutil_escape_html($description) . '</p>' . '</li>';
             }
             $lint_messages[] = '<li class="lint-file-block">' . 'Lint for <strong>' . phutil_escape_html($path) . '</strong>' . '<ul>' . implode("\n", $message_markup) . '</ul>' . '</li>';
         }
         $ltail = '<div class="differential-lint-block">' . '<ul>' . implode("\n", $lint_messages) . '</ul>' . '</div>';
     }
     $properties['Lint'] = $lstar . ' ' . $lmsg . $ltail;
     $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
     $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
     $postponed_count = 0;
     $udata = idx($diff_properties, 'arc:unit');
     $utail = null;
     if ($udata) {
         $unit_messages = array();
         foreach ($udata as $test) {
             $name = phutil_escape_html(idx($test, 'name'));
             $result = phutil_escape_html(idx($test, 'result'));
             if ($result != DifferentialUnitTestResult::RESULT_POSTPONED && $result != DifferentialUnitTestResult::RESULT_PASS) {
                 $userdata = phutil_escape_html(idx($test, 'userdata'));
                 if (strlen($userdata) > 256) {
                     $userdata = substr($userdata, 0, 256) . '...';
                 }
                 $userdata = str_replace("\n", '<br />', $userdata);
                 $unit_messages[] = '<tr>' . '<th>' . $name . '</th>' . '<th class="unit-test-result">' . '<div class="result-' . $result . '">' . strtoupper($result) . '</div>' . '</th>' . '<td>' . $userdata . '</td>' . '</tr>';
                 $utail = '<div class="differential-unit-block">' . '<table class="differential-unit-table">' . implode("\n", $unit_messages) . '</table>' . '</div>';
             } else {
                 if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) {
                     $postponed_count++;
                 }
             }
         }
     }
     if ($postponed_count > 0 && $diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
         $umsg = $postponed_count . ' ' . $umsg;
     }
     $properties['Unit'] = $ustar . ' ' . $umsg . $utail;
     if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
         $tasks = $revision->getAttachedPHIDs(PhabricatorPHIDConstants::PHID_TYPE_TASK);
         if ($tasks) {
             $links = array();
             foreach ($tasks as $task_phid) {
                 $links[] = $handles[$task_phid]->renderLink();
             }
             $properties['Maniphest Tasks'] = implode('<br />', $links);
         }
     }
     $commit_phids = $revision->getCommitPHIDs();
     if ($commit_phids) {
         $links = array();
         foreach ($commit_phids as $commit_phid) {
             $links[] = $handles[$commit_phid]->renderLink();
//.........这里部分代码省略.........
开发者ID:hunterbridges,项目名称:phabricator,代码行数:101,代码来源:DifferentialRevisionViewController.php

示例4: renderBaseRevision

 private function renderBaseRevision(DifferentialDiff $diff)
 {
     switch ($diff->getSourceControlSystem()) {
         case 'git':
             $base = $diff->getSourceControlBaseRevision();
             if (strpos($base, '@') === false) {
                 return substr($base, 0, 7);
             } else {
                 // The diff is from git-svn
                 $base = explode('@', $base);
                 $base = last($base);
                 return $base;
             }
         case 'svn':
             $base = $diff->getSourceControlBaseRevision();
             $base = explode('@', $base);
             $base = last($base);
             return $base;
         default:
             return null;
     }
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:22,代码来源:DifferentialRevisionUpdateHistoryView.php

示例5: renderBaseRevision

 private function renderBaseRevision(DifferentialDiff $diff)
 {
     switch ($diff->getSourceControlSystem()) {
         case 'git':
             return substr($diff->getSourceControlBaseRevision(), 0, 7);
         case 'svn':
             $base = $diff->getSourceControlBaseRevision();
             $base = explode('@', $base);
             $base = end($base);
             return $base;
         default:
             return null;
     }
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:14,代码来源:DifferentialRevisionUpdateHistoryView.php


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