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();
|
2015-09-11 04:28:49 +02:00
|
|
|
$repository = $drequest->getRepository();
|
2012-02-01 19:59:20 +01:00
|
|
|
|
|
|
|
$commit = $drequest->getCommit();
|
|
|
|
if ($commit) {
|
2015-09-11 04:28:49 +02:00
|
|
|
$commit = $repository->formatCommitName($commit);
|
2012-02-01 19:59:20 +01:00
|
|
|
} 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.
|
2014-06-09 20:36:49 +02:00
|
|
|
$body = pht('This path does not exist anywhere.');
|
2015-03-01 23:45:56 +01:00
|
|
|
$severity = PHUIInfoView::SEVERITY_ERROR;
|
2012-02-01 19:59:20 +01:00
|
|
|
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');
|
2015-09-11 04:28:49 +02:00
|
|
|
$body = pht('This path was an empty directory at %s.', $commit);
|
2015-03-01 23:45:56 +01:00
|
|
|
$severity = PHUIInfoView::SEVERITY_NOTICE;
|
2012-02-01 19:59:20 +01:00
|
|
|
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
|
|
|
|
2015-09-11 04:28:49 +02:00
|
|
|
$existed_text = $repository->formatCommitName($existed);
|
|
|
|
$existed_href = $drequest->generateURI(
|
2012-02-01 19:59:20 +01:00
|
|
|
array(
|
2015-09-11 04:28:49 +02:00
|
|
|
'action' => 'browse',
|
|
|
|
'path' => $drequest->getPath(),
|
2012-02-01 19:59:20 +01:00
|
|
|
'commit' => $existed,
|
2015-09-11 04:28:49 +02:00
|
|
|
'params' => array(
|
|
|
|
'view' => $this->view,
|
|
|
|
),
|
2013-02-19 22:33:10 +01:00
|
|
|
));
|
2012-02-01 19:59:20 +01:00
|
|
|
|
2015-09-11 04:28:49 +02:00
|
|
|
$existed_link = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $existed_href,
|
|
|
|
),
|
|
|
|
$existed_text);
|
|
|
|
|
2013-05-11 17:23:19 +02:00
|
|
|
$title = pht('Path Was Deleted');
|
|
|
|
$body = pht(
|
2015-09-11 04:28:49 +02:00
|
|
|
'This path does not exist at %s. It was deleted in %s and last '.
|
|
|
|
'existed at %s.',
|
2013-02-07 01:53:49 +01:00
|
|
|
$commit,
|
|
|
|
self::linkCommit($drequest->getRepository(), $deleted),
|
2015-09-11 04:28:49 +02:00
|
|
|
$existed_link);
|
2015-03-01 23:45:56 +01:00
|
|
|
$severity = PHUIInfoView::SEVERITY_WARNING;
|
2012-02-01 19:59:20 +01:00
|
|
|
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 =
|
2015-05-22 09:27:56 +02:00
|
|
|
pht(
|
|
|
|
"This repository is configured to track only one subdirectory ".
|
|
|
|
"of the entire repository ('%s'), but you aren't looking at ".
|
|
|
|
"something in that subdirectory, so no information is available.",
|
|
|
|
$subdir);
|
2015-03-01 23:45:56 +01:00
|
|
|
$severity = PHUIInfoView::SEVERITY_WARNING;
|
2012-02-01 19:59:20 +01:00
|
|
|
break;
|
|
|
|
default:
|
2015-05-22 09:27:56 +02:00
|
|
|
throw new Exception(pht('Unknown failure reason: %s', $reason));
|
2012-02-01 19:59:20 +01:00
|
|
|
}
|
|
|
|
|
2015-03-01 23:45:56 +01:00
|
|
|
$error_view = new PHUIInfoView();
|
2012-02-01 19:59:20 +01:00
|
|
|
$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();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|