Differential D10600 Diff 27430 src/applications/diffusion/controller/DiffusionBrowseFileController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionBrowseFileController.php
Show First 20 Lines • Show All 488 Lines • ▼ Show 20 Lines | foreach ($ranges as $range) { | ||||
$line_arr[] = array( | $line_arr[] = array( | ||||
'min' => $range, | 'min' => $range, | ||||
'max' => $range, | 'max' => $range, | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
$display = array(); | $display = array(); | ||||
$commit_phids = array(); | |||||
$line_number = 1; | $line_number = 1; | ||||
$last_rev = null; | $last_rev = null; | ||||
$color = null; | $color = null; | ||||
foreach ($text_list as $k => $line) { | foreach ($text_list as $k => $line) { | ||||
$display_line = array( | $display_line = array( | ||||
'epoch' => null, | 'epoch' => null, | ||||
'commit' => null, | 'commit' => null, | ||||
Show All 26 Lines | foreach ($text_list as $k => $line) { | ||||
$color_value, | $color_value, | ||||
0xF6, | 0xF6, | ||||
$color_value); | $color_value); | ||||
} | } | ||||
$display_line['epoch'] = idx($blame, 'epoch'); | $display_line['epoch'] = idx($blame, 'epoch'); | ||||
$display_line['color'] = $color; | $display_line['color'] = $color; | ||||
$display_line['commit'] = $rev; | $display_line['commit'] = $rev; | ||||
$commit_phids[] = idx($blame, 'commitPHID'); | |||||
$author_phid = idx($blame, 'authorPHID'); | $author_phid = idx($blame, 'authorPHID'); | ||||
if ($author_phid && $handles[$author_phid]) { | if ($author_phid && $handles[$author_phid]) { | ||||
$author_link = $handles[$author_phid]->renderLink(); | $author_link = $handles[$author_phid]->renderLink(); | ||||
} else { | } else { | ||||
$author_link = $blame['author']; | $author_link = $blame['author']; | ||||
} | } | ||||
$display_line['author'] = $author_link; | $display_line['author'] = $author_link; | ||||
Show All 16 Lines | foreach ($text_list as $k => $line) { | ||||
$display[] = $display_line; | $display[] = $display_line; | ||||
++$line_number; | ++$line_number; | ||||
} | } | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$commits = array_filter(ipull($display, 'commit')); | // If we have commitIDs try to find corresponding differential revisions | ||||
if ($commits) { | if ($commit_phids) { | ||||
$commit_phids = array_unique($commit_phids); | |||||
$commits = id(new DiffusionCommitQuery()) | $commits = id(new DiffusionCommitQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withRepository($drequest->getRepository()) | ->withRepository($drequest->getRepository()) | ||||
->withIdentifiers($commits) | ->withPHIDs($commit_phids) | ||||
->execute(); | ->execute(); | ||||
$commits = mpull($commits, null, 'getCommitIdentifier'); | $commits = mpull($commits, null, 'getCommitIdentifier'); | ||||
} | |||||
$revision_ids = id(new DifferentialRevision()) | $revision_ids = id(new DifferentialRevision()) | ||||
->loadIDsByCommitPHIDs(mpull($commits, 'getPHID')); | ->loadIDsByCommitPHIDs($commit_phids); | ||||
$revisions = array(); | $revisions = array(); | ||||
if ($revision_ids) { | if ($revision_ids) { | ||||
$revisions = id(new DifferentialRevisionQuery()) | $revisions = id(new DifferentialRevisionQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withIDs($revision_ids) | ->withIDs($revision_ids) | ||||
->execute(); | ->execute(); | ||||
} | } | ||||
$phids = array(); | $phids = array(); | ||||
foreach ($commits as $commit) { | foreach ($commits as $commit) { | ||||
if ($commit->getAuthorPHID()) { | if ($commit->getAuthorPHID()) { | ||||
$phids[] = $commit->getAuthorPHID(); | $phids[] = $commit->getAuthorPHID(); | ||||
} | } | ||||
} | } | ||||
foreach ($revisions as $revision) { | foreach ($revisions as $revision) { | ||||
if ($revision->getAuthorPHID()) { | if ($revision->getAuthorPHID()) { | ||||
$phids[] = $revision->getAuthorPHID(); | $phids[] = $revision->getAuthorPHID(); | ||||
} | } | ||||
} | } | ||||
$handles = $this->loadViewerHandles($phids); | $handles = $this->loadViewerHandles($phids); | ||||
} | |||||
Javelin::initBehavior('phabricator-oncopy', array()); | Javelin::initBehavior('phabricator-oncopy', array()); | ||||
$engine = null; | $engine = null; | ||||
$inlines = array(); | $inlines = array(); | ||||
if ($this->getRequest()->getStr('lint') !== null && $this->lintMessages) { | if ($this->getRequest()->getStr('lint') !== null && $this->lintMessages) { | ||||
$engine = new PhabricatorMarkupEngine(); | $engine = new PhabricatorMarkupEngine(); | ||||
$engine->setViewer($viewer); | $engine->setViewer($viewer); | ||||
▲ Show 20 Lines • Show All 482 Lines • Show Last 20 Lines |