2012-02-01 19:59:20 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DiffusionEmptyResultView extends DiffusionView {
|
|
|
|
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
private $browseResultSet;
|
2012-04-02 20:12:42 +02:00
|
|
|
private $view;
|
2012-02-01 19:59:20 +01:00
|
|
|
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
public function setDiffusionBrowseResultSet(DiffusionBrowseResultSet $set) {
|
|
|
|
$this->browseResultSet = $set;
|
2012-04-03 03:35:09 +02:00
|
|
|
return $this;
|
2012-02-01 19:59:20 +01:00
|
|
|
}
|
|
|
|
|
2012-04-02 20:12:42 +02:00
|
|
|
public function setView($view) {
|
|
|
|
$this->view = $view;
|
2012-04-03 03:35:09 +02:00
|
|
|
return $this;
|
2012-04-02 20:12:42 +02:00
|
|
|
}
|
|
|
|
|
2012-02-01 19:59:20 +01:00
|
|
|
public function render() {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
|
|
|
$commit = $drequest->getCommit();
|
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
|
|
|
if ($commit) {
|
|
|
|
$commit = "r{$callsign}{$commit}";
|
|
|
|
} else {
|
|
|
|
$commit = 'HEAD';
|
|
|
|
}
|
|
|
|
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
$reason = $this->browseResultSet->getReasonForEmptyResultSet();
|
|
|
|
switch ($reason) {
|
|
|
|
case DiffusionBrowseResultSet::REASON_IS_NONEXISTENT:
|
2013-05-11 17:23:19 +02:00
|
|
|
$title = pht('Path Does Not Exist');
|
2012-02-01 19:59:20 +01:00
|
|
|
// TODO: Under git, this error message should be more specific. It
|
|
|
|
// may exist on some other branch.
|
2013-05-11 17:23:19 +02:00
|
|
|
$body = pht("This path does not exist anywhere.");
|
2012-02-01 19:59:20 +01:00
|
|
|
$severity = AphrontErrorView::SEVERITY_ERROR;
|
|
|
|
break;
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
case DiffusionBrowseResultSet::REASON_IS_EMPTY:
|
2013-05-11 17:23:19 +02:00
|
|
|
$title = pht('Empty Directory');
|
|
|
|
$body = pht("This path was an empty directory at %s.\n", $commit);
|
2012-02-01 19:59:20 +01:00
|
|
|
$severity = AphrontErrorView::SEVERITY_NOTICE;
|
|
|
|
break;
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
case DiffusionBrowseResultSet::REASON_IS_DELETED:
|
|
|
|
$deleted = $this->browseResultSet->getDeletedAtCommit();
|
|
|
|
$existed = $this->browseResultSet->getExistedAtCommit();
|
2012-02-01 19:59:20 +01:00
|
|
|
|
|
|
|
$browse = $this->linkBrowse(
|
|
|
|
$drequest->getPath(),
|
|
|
|
array(
|
|
|
|
'text' => 'existed',
|
|
|
|
'commit' => $existed,
|
2012-04-02 20:12:42 +02:00
|
|
|
'params' => array('view' => $this->view),
|
2013-02-19 22:33:10 +01:00
|
|
|
));
|
2012-02-01 19:59:20 +01:00
|
|
|
|
2013-05-11 17:23:19 +02:00
|
|
|
$title = pht('Path Was Deleted');
|
|
|
|
$body = pht(
|
2013-02-07 01:53:49 +01:00
|
|
|
"This path does not exist at %s. It was deleted in %s and last %s ".
|
|
|
|
"at %s.",
|
|
|
|
$commit,
|
|
|
|
self::linkCommit($drequest->getRepository(), $deleted),
|
|
|
|
$browse,
|
|
|
|
"r{$callsign}{$existed}");
|
2012-02-01 19:59:20 +01:00
|
|
|
$severity = AphrontErrorView::SEVERITY_WARNING;
|
|
|
|
break;
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
case DiffusionBrowseResultSet::REASON_IS_UNTRACKED_PARENT:
|
2012-02-01 19:59:20 +01:00
|
|
|
$subdir = $drequest->getRepository()->getDetail('svn-subpath');
|
2013-05-11 17:23:19 +02:00
|
|
|
$title = pht('Directory Not Tracked');
|
2012-02-01 19:59:20 +01:00
|
|
|
$body =
|
2013-05-11 17:23:19 +02:00
|
|
|
pht("This repository is configured to track only one subdirectory ".
|
|
|
|
"of the entire repository ('%s'), ".
|
2012-02-01 19:59:20 +01:00
|
|
|
"but you aren't looking at something in that subdirectory, so no ".
|
2013-05-11 17:23:19 +02:00
|
|
|
"information is available.", $subdir);
|
2012-02-01 19:59:20 +01:00
|
|
|
$severity = AphrontErrorView::SEVERITY_WARNING;
|
|
|
|
break;
|
|
|
|
default:
|
Diffusion - move DiffusionBrowseQuery => Conduit
Summary: see title. Ref T2784.
Test Plan:
In diffusion, for each of SVN, Mercurial, and Git, I loaded up /diffusion/CALLSIGN/. I verified the README was displayed and things looked good. Next I clicked on "browse" on the top-most commit and verified things looked correct. Also clicked through to a file for a good measure and things looked good.
In owners, for each of SVN, Mercurial, and Git, I played around with the path typeahead / validator. It worked correctly!
Reviewers: epriestley
Reviewed By: epriestley
CC: chad, aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5883
2013-05-10 20:02:58 +02:00
|
|
|
throw new Exception("Unknown failure reason: $reason");
|
2012-02-01 19:59:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$error_view = new AphrontErrorView();
|
|
|
|
$error_view->setSeverity($severity);
|
|
|
|
$error_view->setTitle($title);
|
2013-02-07 01:53:49 +01:00
|
|
|
$error_view->appendChild(phutil_tag('p', array(), $body));
|
2012-02-01 19:59:20 +01:00
|
|
|
|
|
|
|
return $error_view->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|