mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
make "browse in diffusion" action work for commits in branches other than master
Summary: we do this by passing the "seenOnBranches" commit data detail through the stack Test Plan: browse in diffusion link worked for non-master checkins under git Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1949 Differential Revision: https://secure.phabricator.com/D3853
This commit is contained in:
parent
6c36efed72
commit
4edf8ae2fc
3 changed files with 19 additions and 2 deletions
|
@ -32,9 +32,18 @@ final class DifferentialChangesetListView extends AphrontView {
|
||||||
private $user;
|
private $user;
|
||||||
private $symbolIndexes = array();
|
private $symbolIndexes = array();
|
||||||
private $repository;
|
private $repository;
|
||||||
|
private $branch;
|
||||||
private $diff;
|
private $diff;
|
||||||
private $vsMap = array();
|
private $vsMap = array();
|
||||||
|
|
||||||
|
public function setBranch($branch) {
|
||||||
|
$this->branch = $branch;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
private function getBranch() {
|
||||||
|
return $this->branch;
|
||||||
|
}
|
||||||
|
|
||||||
public function setChangesets($changesets) {
|
public function setChangesets($changesets) {
|
||||||
$this->changesets = $changesets;
|
$this->changesets = $changesets;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -257,7 +266,8 @@ final class DifferentialChangesetListView extends AphrontView {
|
||||||
if ($repository) {
|
if ($repository) {
|
||||||
$meta['diffusionURI'] = (string)$repository->getDiffusionBrowseURIForPath(
|
$meta['diffusionURI'] = (string)$repository->getDiffusionBrowseURIForPath(
|
||||||
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
|
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
|
||||||
idx($changeset->getMetadata(), 'line:first'));
|
idx($changeset->getMetadata(), 'line:first'),
|
||||||
|
$this->getBranch());
|
||||||
}
|
}
|
||||||
|
|
||||||
$change = $changeset->getChangeType();
|
$change = $changeset->getChangeType();
|
||||||
|
|
|
@ -269,6 +269,10 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
$change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
||||||
$change_list->setRepository($repository);
|
$change_list->setRepository($repository);
|
||||||
$change_list->setUser($user);
|
$change_list->setUser($user);
|
||||||
|
// pick the first branch for "Browse in Diffusion" View Option
|
||||||
|
$branches = $commit_data->getCommitDetail('seenOnBranches');
|
||||||
|
$first_branch = reset($branches);
|
||||||
|
$change_list->setBranch($first_branch);
|
||||||
|
|
||||||
$change_list->setStandaloneURI(
|
$change_list->setStandaloneURI(
|
||||||
'/diffusion/'.$callsign.'/diff/');
|
'/diffusion/'.$callsign.'/diff/');
|
||||||
|
|
|
@ -60,11 +60,14 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDiffusionBrowseURIForPath($path, $line = null) {
|
public function getDiffusionBrowseURIForPath($path,
|
||||||
|
$line = null,
|
||||||
|
$branch = null) {
|
||||||
$drequest = DiffusionRequest::newFromDictionary(
|
$drequest = DiffusionRequest::newFromDictionary(
|
||||||
array(
|
array(
|
||||||
'repository' => $this,
|
'repository' => $this,
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
|
'branch' => $branch,
|
||||||
));
|
));
|
||||||
|
|
||||||
return $drequest->generateURI(
|
return $drequest->generateURI(
|
||||||
|
|
Loading…
Reference in a new issue