本文整理汇总了PHP中DifferentialDiff::getBranch方法的典型用法代码示例。如果您正苦于以下问题:PHP DifferentialDiff::getBranch方法的具体用法?PHP DifferentialDiff::getBranch怎么用?PHP DifferentialDiff::getBranch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DifferentialDiff
的用法示例。
在下文中一共展示了DifferentialDiff::getBranch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBranchDescription
private function getBranchDescription(DifferentialDiff $diff)
{
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
if (strlen($branch) && strlen($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
} else {
if (strlen($bookmark)) {
return pht('%s (bookmark)', $bookmark);
} else {
if (strlen($branch)) {
return $branch;
} else {
return null;
}
}
}
}
示例2: getBranchDescription
private function getBranchDescription(DifferentialDiff $diff)
{
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();
if (strlen($branch) && strlen($bookmark)) {
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
} else {
if (strlen($bookmark)) {
return pht('%s (bookmark)', $bookmark);
} else {
if (strlen($branch)) {
$onto = $diff->loadTargetBranch();
if (strlen($onto) && $onto !== $branch) {
return pht('%s (branched from %s)', $branch, $onto);
} else {
return $branch;
}
} else {
return null;
}
}
}
}
示例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 = ' · ' . '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();
//.........这里部分代码省略.........