2011-03-11 09:34:22 -08:00
|
|
|
<?php
|
|
|
|
|
|
2012-03-09 15:46:25 -08:00
|
|
|
final class DiffusionCommitController extends DiffusionController {
|
2011-03-11 09:34:22 -08:00
|
|
|
|
2011-04-07 14:55:06 -07:00
|
|
|
const CHANGES_LIMIT = 100;
|
|
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
private $commitParents;
|
|
|
|
|
private $commitRefs;
|
|
|
|
|
private $commitMerges;
|
|
|
|
|
private $commitErrors;
|
|
|
|
|
private $commitExists;
|
|
|
|
|
|
2013-09-27 10:49:45 -07:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-05 04:42:07 -08:00
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
|
|
|
$response = $this->loadDiffusionContext();
|
|
|
|
|
if ($response) {
|
|
|
|
|
return $response;
|
|
|
|
|
}
|
2015-01-09 13:29:08 -08:00
|
|
|
|
2016-01-05 04:42:07 -08:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer = $request->getUser();
|
2011-03-11 09:34:22 -08:00
|
|
|
|
2012-05-02 13:43:45 -07:00
|
|
|
if ($request->getStr('diff')) {
|
|
|
|
|
return $this->buildRawDiffResponse($drequest);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-27 09:43:05 -07:00
|
|
|
$repository = $drequest->getRepository();
|
2011-03-30 19:22:11 -07:00
|
|
|
|
2014-04-27 09:43:05 -07:00
|
|
|
$commit = id(new DiffusionCommitQuery())
|
2016-03-17 12:01:22 -07:00
|
|
|
->setViewer($viewer)
|
2014-04-27 09:43:05 -07:00
|
|
|
->withRepository($repository)
|
|
|
|
|
->withIdentifiers(array($drequest->getCommit()))
|
|
|
|
|
->needCommitData(true)
|
|
|
|
|
->needAuditRequests(true)
|
|
|
|
|
->executeOne();
|
2011-03-26 23:52:09 -07:00
|
|
|
|
2013-09-23 12:53:55 -07:00
|
|
|
$crumbs = $this->buildCrumbs(array(
|
|
|
|
|
'commit' => true,
|
|
|
|
|
));
|
2016-03-17 12:01:22 -07:00
|
|
|
$crumbs->setBorder(true);
|
2013-09-23 12:53:55 -07:00
|
|
|
|
2011-03-26 23:52:09 -07:00
|
|
|
if (!$commit) {
|
2015-10-02 16:11:03 -07:00
|
|
|
if (!$this->getCommitExists()) {
|
2012-08-09 09:27:45 -07:00
|
|
|
return new Aphront404Response();
|
|
|
|
|
}
|
2013-09-23 12:53:55 -07:00
|
|
|
|
2015-03-01 14:45:56 -08:00
|
|
|
$error = id(new PHUIInfoView())
|
2013-09-23 12:53:55 -07:00
|
|
|
->setTitle(pht('Commit Still Parsing'))
|
|
|
|
|
->appendChild(
|
|
|
|
|
pht(
|
|
|
|
|
'Failed to load the commit because the commit has not been '.
|
|
|
|
|
'parsed yet.'));
|
|
|
|
|
|
2016-04-04 10:31:58 -07:00
|
|
|
$title = pht('Commit Still Parsing');
|
|
|
|
|
|
|
|
|
|
return $this->newPage()
|
|
|
|
|
->setTitle($title)
|
|
|
|
|
->setCrumbs($crumbs)
|
|
|
|
|
->appendChild($error);
|
|
|
|
|
|
2011-03-26 23:52:09 -07:00
|
|
|
}
|
|
|
|
|
|
2014-04-27 09:43:05 -07:00
|
|
|
$audit_requests = $commit->getAudits();
|
2017-01-25 11:28:42 -08:00
|
|
|
$commit->loadAndAttachAuditAuthority($viewer);
|
2013-07-24 15:29:46 -07:00
|
|
|
|
2014-04-27 09:43:05 -07:00
|
|
|
$commit_data = $commit->getCommitData();
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
2016-03-17 12:01:22 -07:00
|
|
|
$error_panel = null;
|
2016-08-24 05:55:47 -07:00
|
|
|
|
|
|
|
|
$hard_limit = 1000;
|
|
|
|
|
|
|
|
|
|
if ($commit->isImported()) {
|
|
|
|
|
$change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
|
|
|
|
|
$drequest);
|
|
|
|
|
$change_query->setLimit($hard_limit + 1);
|
|
|
|
|
$changes = $change_query->loadChanges();
|
|
|
|
|
} else {
|
|
|
|
|
$changes = array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$was_limited = (count($changes) > $hard_limit);
|
|
|
|
|
if ($was_limited) {
|
|
|
|
|
$changes = array_slice($changes, 0, $hard_limit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$count = count($changes);
|
|
|
|
|
|
|
|
|
|
$is_unreadable = false;
|
|
|
|
|
$hint = null;
|
|
|
|
|
if (!$count || $commit->isUnreachable()) {
|
|
|
|
|
$hint = id(new DiffusionCommitHintQuery())
|
|
|
|
|
->setViewer($viewer)
|
|
|
|
|
->withRepositoryPHIDs(array($repository->getPHID()))
|
|
|
|
|
->withOldCommitIdentifiers(array($commit->getCommitIdentifier()))
|
|
|
|
|
->executeOne();
|
|
|
|
|
if ($hint) {
|
|
|
|
|
$is_unreadable = $hint->isUnreadable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
if ($is_foreign) {
|
|
|
|
|
$subpath = $commit_data->getCommitDetail('svn-subpath');
|
|
|
|
|
|
2015-03-01 14:45:56 -08:00
|
|
|
$error_panel = new PHUIInfoView();
|
2013-05-11 08:23:19 -07:00
|
|
|
$error_panel->setTitle(pht('Commit Not Tracked'));
|
2015-03-01 14:45:56 -08:00
|
|
|
$error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING);
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$error_panel->appendChild(
|
2015-05-22 17:27:56 +10:00
|
|
|
pht(
|
|
|
|
|
"This Diffusion repository is configured to track only one ".
|
|
|
|
|
"subdirectory of the entire Subversion repository, and this commit ".
|
|
|
|
|
"didn't affect the tracked subdirectory ('%s'), so no ".
|
|
|
|
|
"information is available.",
|
|
|
|
|
$subpath));
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
} else {
|
|
|
|
|
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
2016-03-17 12:01:22 -07:00
|
|
|
$engine->setConfig('viewer', $viewer);
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$commit_tag = $this->renderCommitHashTag($drequest);
|
|
|
|
|
$header = id(new PHUIHeaderView())
|
2016-02-11 11:29:07 -08:00
|
|
|
->setHeader(nonempty($commit->getSummary(), pht('Commit Detail')))
|
2016-03-17 12:01:22 -07:00
|
|
|
->setHeaderIcon('fa-code-fork')
|
|
|
|
|
->addTag($commit_tag);
|
|
|
|
|
|
|
|
|
|
if ($commit->getAuditStatus()) {
|
|
|
|
|
$icon = PhabricatorAuditCommitStatusConstants::getStatusIcon(
|
|
|
|
|
$commit->getAuditStatus());
|
|
|
|
|
$color = PhabricatorAuditCommitStatusConstants::getStatusColor(
|
|
|
|
|
$commit->getAuditStatus());
|
|
|
|
|
$status = PhabricatorAuditCommitStatusConstants::getStatusName(
|
|
|
|
|
$commit->getAuditStatus());
|
|
|
|
|
|
|
|
|
|
$header->setStatus($icon, $color, $status);
|
|
|
|
|
}
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$curtain = $this->buildCurtain($commit, $repository);
|
|
|
|
|
$subheader = $this->buildSubheaderView($commit, $commit_data);
|
|
|
|
|
$details = $this->buildPropertyListView(
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
$commit,
|
|
|
|
|
$commit_data,
|
2013-07-24 15:29:46 -07:00
|
|
|
$audit_requests);
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
|
2013-04-19 21:56:13 -07:00
|
|
|
$message = $commit_data->getCommitMessage();
|
|
|
|
|
|
|
|
|
|
$revision = $commit->getCommitIdentifier();
|
2013-09-18 10:13:00 -07:00
|
|
|
$message = $this->linkBugtraq($message);
|
2013-04-19 21:56:13 -07:00
|
|
|
$message = $engine->markupText($message);
|
|
|
|
|
|
2013-10-16 13:09:12 -07:00
|
|
|
$detail_list = new PHUIPropertyListView();
|
|
|
|
|
$detail_list->addTextContent(
|
2013-01-29 11:01:47 -08:00
|
|
|
phutil_tag(
|
|
|
|
|
'div',
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'diffusion-commit-message phabricator-remarkup',
|
|
|
|
|
),
|
2013-04-19 21:56:13 -07:00
|
|
|
$message));
|
2013-09-28 15:55:38 -07:00
|
|
|
|
2016-06-16 07:24:32 -07:00
|
|
|
if ($commit->isUnreachable()) {
|
2016-08-24 05:55:47 -07:00
|
|
|
$did_rewrite = false;
|
|
|
|
|
if ($hint) {
|
|
|
|
|
if ($hint->isRewritten()) {
|
|
|
|
|
$rewritten = id(new DiffusionCommitQuery())
|
|
|
|
|
->setViewer($viewer)
|
|
|
|
|
->withRepository($repository)
|
|
|
|
|
->withIdentifiers(array($hint->getNewCommitIdentifier()))
|
|
|
|
|
->executeOne();
|
|
|
|
|
if ($rewritten) {
|
|
|
|
|
$did_rewrite = true;
|
|
|
|
|
$rewritten_uri = $rewritten->getURI();
|
|
|
|
|
$rewritten_name = $rewritten->getLocalName();
|
|
|
|
|
|
|
|
|
|
$rewritten_link = phutil_tag(
|
|
|
|
|
'a',
|
|
|
|
|
array(
|
|
|
|
|
'href' => $rewritten_uri,
|
|
|
|
|
),
|
|
|
|
|
$rewritten_name);
|
|
|
|
|
|
|
|
|
|
$this->commitErrors[] = pht(
|
|
|
|
|
'This commit was rewritten after it was published, which '.
|
|
|
|
|
'changed the commit hash. This old version of the commit is '.
|
|
|
|
|
'no longer reachable from any branch, tag or ref. The new '.
|
|
|
|
|
'version of this commit is %s.',
|
|
|
|
|
$rewritten_link);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$did_rewrite) {
|
|
|
|
|
$this->commitErrors[] = pht(
|
|
|
|
|
'This commit has been deleted in the repository: it is no longer '.
|
|
|
|
|
'reachable from any branch, tag, or ref.');
|
|
|
|
|
}
|
2016-06-16 07:24:32 -07:00
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
if ($this->getCommitErrors()) {
|
|
|
|
|
$error_panel = id(new PHUIInfoView())
|
|
|
|
|
->appendChild($this->getCommitErrors())
|
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING);
|
|
|
|
|
}
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
}
|
2011-03-13 16:19:39 -07:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$timeline = $this->buildComments($commit);
|
|
|
|
|
$merge_table = $this->buildMergesTable($commit);
|
2012-03-23 15:32:26 -07:00
|
|
|
|
2015-08-15 12:57:20 -07:00
|
|
|
$show_changesets = false;
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = null;
|
|
|
|
|
$change_list = null;
|
|
|
|
|
$change_table = null;
|
2016-08-24 05:24:07 -07:00
|
|
|
if ($is_unreadable) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = $this->renderStatusMessage(
|
2016-08-24 05:24:07 -07:00
|
|
|
pht('Unreadable Commit'),
|
|
|
|
|
pht(
|
|
|
|
|
'This commit has been marked as unreadable by an administrator. '.
|
|
|
|
|
'It may have been corrupted or created improperly by an external '.
|
|
|
|
|
'tool.'));
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
} else if ($is_foreign) {
|
|
|
|
|
// Don't render anything else.
|
2013-10-26 19:16:10 -07:00
|
|
|
} else if (!$commit->isImported()) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = $this->renderStatusMessage(
|
2013-10-26 19:16:10 -07:00
|
|
|
pht('Still Importing...'),
|
|
|
|
|
pht(
|
|
|
|
|
'This commit is still importing. Changes will be visible once '.
|
|
|
|
|
'the import finishes.'));
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
} else if (!count($changes)) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = $this->renderStatusMessage(
|
2013-10-26 19:16:10 -07:00
|
|
|
pht('Empty Commit'),
|
|
|
|
|
pht(
|
|
|
|
|
'This commit is empty and does not affect any paths.'));
|
2013-01-30 12:01:49 -08:00
|
|
|
} else if ($was_limited) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = $this->renderStatusMessage(
|
2013-10-26 19:16:10 -07:00
|
|
|
pht('Enormous Commit'),
|
2013-01-30 12:01:49 -08:00
|
|
|
pht(
|
|
|
|
|
'This commit is enormous, and affects more than %d files. '.
|
|
|
|
|
'Changes are not shown.',
|
|
|
|
|
$hard_limit));
|
2015-10-02 16:11:03 -07:00
|
|
|
} else if (!$this->getCommitExists()) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$info_panel = $this->renderStatusMessage(
|
2015-10-02 16:11:03 -07:00
|
|
|
pht('Commit No Longer Exists'),
|
|
|
|
|
pht('This commit no longer exists in the repository.'));
|
2011-03-26 23:52:09 -07:00
|
|
|
} else {
|
2015-08-15 12:57:20 -07:00
|
|
|
$show_changesets = true;
|
|
|
|
|
|
2013-09-06 10:05:24 -07:00
|
|
|
// The user has clicked "Show All Changes", and we should show all the
|
|
|
|
|
// changes inline even if there are more than the soft limit.
|
|
|
|
|
$show_all_details = $request->getBool('show_all');
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$change_header = id(new PHUIHeaderView())
|
2016-03-12 13:02:32 -08:00
|
|
|
->setHeader(pht('Changes (%s)', new PhutilNumber($count)));
|
2014-01-09 08:51:57 -08:00
|
|
|
|
2016-03-12 13:02:32 -08:00
|
|
|
$warning_view = null;
|
2015-05-25 21:28:49 +10:00
|
|
|
if ($count > self::CHANGES_LIMIT && !$show_all_details) {
|
2014-01-09 08:51:57 -08:00
|
|
|
$button = id(new PHUIButtonView())
|
|
|
|
|
->setText(pht('Show All Changes'))
|
|
|
|
|
->setHref('?show_all=true')
|
|
|
|
|
->setTag('a')
|
2016-01-27 20:38:01 -08:00
|
|
|
->setIcon('fa-files-o');
|
2013-10-26 19:16:10 -07:00
|
|
|
|
2015-03-01 14:45:56 -08:00
|
|
|
$warning_view = id(new PHUIInfoView())
|
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
|
2015-05-22 17:27:56 +10:00
|
|
|
->setTitle(pht('Very Large Commit'))
|
2013-10-30 09:20:48 -07:00
|
|
|
->appendChild(
|
2014-06-09 11:36:49 -07:00
|
|
|
pht('This commit is very large. Load each file individually.'));
|
2016-03-17 12:01:22 -07:00
|
|
|
|
|
|
|
|
$change_header->addActionLink($button);
|
2011-04-07 14:55:06 -07:00
|
|
|
}
|
|
|
|
|
|
2015-08-15 12:57:20 -07:00
|
|
|
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer,
|
2015-08-15 12:57:20 -07:00
|
|
|
$changes);
|
|
|
|
|
|
|
|
|
|
// TODO: This table and panel shouldn't really be separate, but we need
|
|
|
|
|
// to clean up the "Load All Files" interaction first.
|
|
|
|
|
$change_table = $this->buildTableOfContents(
|
2016-03-12 13:02:32 -08:00
|
|
|
$changesets,
|
2016-03-17 12:01:22 -07:00
|
|
|
$change_header,
|
2016-03-12 13:02:32 -08:00
|
|
|
$warning_view);
|
2015-08-15 12:57:20 -07:00
|
|
|
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$vcs = $repository->getVersionControlSystem();
|
|
|
|
|
switch ($vcs) {
|
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
|
|
|
|
$vcs_supports_directory_changes = true;
|
|
|
|
|
break;
|
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
Basic support for Mercurial in Diffusion
Summary: Change import script plus almost all the view stuff. Still some rough
edges but this seems to mostly work. Blame is currently unsupported but I think
everything else works properly.
Test Plan:
Imported the hg repository itself. It doesn't immediately seem completely
broken. Here are some screens:
https://secure.phabricator.com/file/view/PHID-FILE-1438b71cc7c4a2eb4569/
https://secure.phabricator.com/file/view/PHID-FILE-3cec4f72f39e7de2d041/
https://secure.phabricator.com/file/view/PHID-FILE-2ea4883f160e8e5098f9/
https://secure.phabricator.com/file/view/PHID-FILE-35f751a36ebf65399ade/
All the parsers were able to churn through it without errors.
Ran the new "reparse.php" script in various one-commit and repository modes.
Browsed/imported some git repos for good measure.
NOTE: The hg repository is only 15,000 commits and around 1,000 files.
Performance is okay but hg doesn't provide performant, native APIs to get some
data efficiently so we have to do some dumb stuff. If some of these interfaces
are cripplingly slow or whatever, let me know and we can start bundling some
Mercurial extensions with Arcanist.
Reviewers: Makinde, jungejason, nh, tuomaspelkonen, aran
Reviewed By: Makinde
CC: aran, Makinde, epriestley
Differential Revision: 960
2011-09-26 11:07:38 -07:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$vcs_supports_directory_changes = false;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2015-05-22 17:27:56 +10:00
|
|
|
throw new Exception(pht('Unknown VCS.'));
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
}
|
2011-03-30 22:08:41 -07:00
|
|
|
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$references = array();
|
|
|
|
|
foreach ($changesets as $key => $changeset) {
|
|
|
|
|
$file_type = $changeset->getFileType();
|
|
|
|
|
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
|
|
|
|
if (!$vcs_supports_directory_changes) {
|
|
|
|
|
unset($changesets[$key]);
|
|
|
|
|
continue;
|
2011-03-30 22:08:41 -07:00
|
|
|
}
|
2011-03-30 19:22:11 -07:00
|
|
|
}
|
|
|
|
|
|
Fix many encoding and architecture problems in Diffusion request and URI handling
Summary:
Diffusion request/uri handling is currently a big, hastily ported mess. In particular, it has:
- Tons and tons of duplicated code.
- Bugs with handling unusual branch and file names.
- An excessively large (and yet insufficiently expressive) API on DiffusionRequest, including a nonsensical concrete base class.
- Other tools were doing hacky things like passing ":" branch names.
This diff attempts to fix these issues.
- Make the base class abstract (it was concrete ONLY for "/diffusion/").
- Move all URI generation to DiffusionRequest. Make the core static. Add unit tests.
- Delete the 300 copies of URI generation code throughout Diffusion.
- Move all URI parsing to DiffusionRequest. Make the core static. Add unit tests.
- Add an appropriate static initializer for other callers.
- Convert all code calling `newFromAphrontRequestDictionary` outside of Diffusion to the new `newFromDictionary` API.
- Refactor static initializers to be sensibly-sized.
- Refactor derived DiffusionRequest classes to remove duplicated code.
- Properly encode branch names (fixes branches with "/", see <https://github.com/facebook/phabricator/issues/100>).
- Properly encode path names (fixes issues in D1742).
- Properly escape delimiter characters ";" and "$" in path names so files like "$100" are not interpreted as "line 100".
- Fix a couple warnings.
- Fix a couple lint issues.
- Fix a bug where we would not parse filenames with spaces in them correctly in the Git browse query.
- Fix a bug where Git change queries would fail unnecessarily.
- Provide or improve some documentation.
This thing is pretty gigantic but also kind of hard to split up. If it's unreasonably difficult to review, let me know and I can take a stab at it though.
This supplants D1742.
Test Plan:
- Used home, repository, branch, browse, change, history, diff (ajax), lastmodified (ajax) views of Diffusion.
- Used Owners typeaheads and search.
- Used diffusion.getrecentcommitsbypath method.
- Pushed a change to an absurdly-named file on an absurdly-named branch, everything worked properly.
{F9185}
Reviewers: nh, vrana, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1921
2012-03-19 19:52:14 -07:00
|
|
|
$references[$key] = $drequest->generateURI(
|
|
|
|
|
array(
|
|
|
|
|
'action' => 'rendering-ref',
|
|
|
|
|
'path' => $changeset->getFilename(),
|
|
|
|
|
));
|
2011-03-30 19:22:11 -07:00
|
|
|
}
|
2011-03-26 23:52:09 -07:00
|
|
|
|
2012-04-07 11:45:31 -07:00
|
|
|
// TODO: Some parts of the views still rely on properties of the
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 12:56:01 -07:00
|
|
|
// DifferentialChangeset. Make the objects ephemeral to make sure we don't
|
|
|
|
|
// accidentally save them, and then set their ID to the appropriate ID for
|
|
|
|
|
// this application (the path IDs).
|
2012-08-06 23:01:23 -07:00
|
|
|
$path_ids = array_flip(mpull($changes, 'getPath'));
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 12:56:01 -07:00
|
|
|
foreach ($changesets as $changeset) {
|
|
|
|
|
$changeset->makeEphemeral();
|
|
|
|
|
$changeset->setID($path_ids[$changeset->getFilename()]);
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-06 10:05:24 -07:00
|
|
|
if ($count <= self::CHANGES_LIMIT || $show_all_details) {
|
2012-08-06 23:01:23 -07:00
|
|
|
$visible_changesets = $changesets;
|
|
|
|
|
} else {
|
|
|
|
|
$visible_changesets = array();
|
2014-07-24 17:59:28 -07:00
|
|
|
$inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments(
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer,
|
2014-07-24 17:59:28 -07:00
|
|
|
$commit->getPHID());
|
2012-08-06 23:01:23 -07:00
|
|
|
$path_ids = mpull($inlines, null, 'getPathID');
|
|
|
|
|
foreach ($changesets as $key => $changeset) {
|
|
|
|
|
if (array_key_exists($changeset->getID(), $path_ids)) {
|
|
|
|
|
$visible_changesets[$key] = $changeset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-02 11:28:31 -08:00
|
|
|
$change_list_title = $commit->getDisplayName();
|
|
|
|
|
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$change_list = new DifferentialChangesetListView();
|
2012-12-12 21:21:56 -08:00
|
|
|
$change_list->setTitle($change_list_title);
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$change_list->setChangesets($changesets);
|
2012-08-06 23:01:23 -07:00
|
|
|
$change_list->setVisibleChangesets($visible_changesets);
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
$change_list->setRenderingReferences($references);
|
2016-03-17 12:01:22 -07:00
|
|
|
$change_list->setRenderURI($repository->getPathURI('diff/'));
|
2012-04-09 23:42:12 -07:00
|
|
|
$change_list->setRepository($repository);
|
2016-03-17 12:01:22 -07:00
|
|
|
$change_list->setUser($viewer);
|
|
|
|
|
$change_list->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
2014-01-16 14:58:14 -08:00
|
|
|
|
|
|
|
|
// TODO: Try to setBranch() to something reasonable here?
|
Improve several Diffusion UI error states
Summary:
Give users better errors and UI:
- For subpath SVN repositories, default the path to the subdirectory, not to
"/". This makes the home screen useful and things generally less confusing.
- For unparsed commits, show a more descriptive error message without the
"blah blah" silliness.
- For paths outside of the subpath parse tree, short circuit into an
appropriate error message.
- For foreign SVN stub commits (see D892), show an explicit message.
Test Plan: Looked at unparsed commits, subpath repositories, foreign stub
commits, and paths outside of the subpath parse tree. Received sensible error
messages.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: jungejason
CC: aran, jungejason
Differential Revision: 894
2011-09-04 14:39:52 -07:00
|
|
|
|
2012-03-19 19:57:41 -07:00
|
|
|
$change_list->setStandaloneURI(
|
2016-01-02 12:21:13 -08:00
|
|
|
$repository->getPathURI('diff/'));
|
|
|
|
|
|
2012-03-19 19:57:41 -07:00
|
|
|
$change_list->setRawFileURIs(
|
|
|
|
|
// TODO: Implement this, somewhat tricky if there's an octopus merge
|
|
|
|
|
// or whatever?
|
|
|
|
|
null,
|
2016-01-02 12:21:13 -08:00
|
|
|
$repository->getPathURI('diff/?view=r'));
|
2012-03-19 19:57:41 -07:00
|
|
|
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 12:56:01 -07:00
|
|
|
$change_list->setInlineCommentControllerURI(
|
2012-07-23 11:01:28 -07:00
|
|
|
'/diffusion/inline/edit/'.phutil_escape_uri($commit->getPHID()).'/');
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 12:56:01 -07:00
|
|
|
|
2011-03-26 23:52:09 -07:00
|
|
|
}
|
2011-03-13 16:19:39 -07:00
|
|
|
|
2017-01-11 14:01:59 -08:00
|
|
|
$add_comment = $this->renderAddCommentPanel(
|
|
|
|
|
$commit,
|
|
|
|
|
$timeline);
|
2013-01-30 12:01:07 -08:00
|
|
|
|
Convert some loadPreferences() to getUserSetting()
Summary:
Ref T4103. This doesn't get everything, but takes care of most of the easy stuff.
The tricky-ish bit here is that I need to move timezones, pronouns and translations to proper settings. I expect to pursue that next.
Test Plan:
- Grepped for `loadPreferences` to identify callsites.
- Changed start-of-week setting, loaded Calendar, saw correct start.
- Visited welcome page, read "Adjust Settings" point.
- Loaded Conpherence -- I changed behavior here slightly (switching threads drops the title glyph) but it wasn't consistent to start with and this seems like a good thing to push to the next version of Conpherence.
- Enabled Filetree, toggled in Differential.
- Disabled Filetree, no longer visible in Differential.
- Changed "Unified Diffs" preference to "Small Screens" vs "Always".
- Toggled filetree in Diffusion.
- Edited a task, saw sensible projects in policy dropdown.
- Viewed user profile, uncollapsed/collapsed side nav, reloaded page, sticky'd.
- Toggled "monospaced textareas", used a comment box, got appropriate fonts.
- Toggled durable column.
- Disabled title glyphs.
- Changed monospaced font to 18px/36px impact.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4103
Differential Revision: https://secure.phabricator.com/D16004
2016-06-01 13:59:08 -07:00
|
|
|
$filetree_on = $viewer->compareUserSetting(
|
|
|
|
|
PhabricatorShowFiletreeSetting::SETTINGKEY,
|
|
|
|
|
PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE);
|
|
|
|
|
|
2016-06-03 12:23:15 -07:00
|
|
|
$pref_collapse = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
|
Convert some loadPreferences() to getUserSetting()
Summary:
Ref T4103. This doesn't get everything, but takes care of most of the easy stuff.
The tricky-ish bit here is that I need to move timezones, pronouns and translations to proper settings. I expect to pursue that next.
Test Plan:
- Grepped for `loadPreferences` to identify callsites.
- Changed start-of-week setting, loaded Calendar, saw correct start.
- Visited welcome page, read "Adjust Settings" point.
- Loaded Conpherence -- I changed behavior here slightly (switching threads drops the title glyph) but it wasn't consistent to start with and this seems like a good thing to push to the next version of Conpherence.
- Enabled Filetree, toggled in Differential.
- Disabled Filetree, no longer visible in Differential.
- Changed "Unified Diffs" preference to "Small Screens" vs "Always".
- Toggled filetree in Diffusion.
- Edited a task, saw sensible projects in policy dropdown.
- Viewed user profile, uncollapsed/collapsed side nav, reloaded page, sticky'd.
- Toggled "monospaced textareas", used a comment box, got appropriate fonts.
- Toggled durable column.
- Disabled title glyphs.
- Changed monospaced font to 18px/36px impact.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4103
Differential Revision: https://secure.phabricator.com/D16004
2016-06-01 13:59:08 -07:00
|
|
|
$collapsed = $viewer->getUserSetting($pref_collapse);
|
2013-02-04 17:00:27 -08:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$nav = null;
|
Convert some loadPreferences() to getUserSetting()
Summary:
Ref T4103. This doesn't get everything, but takes care of most of the easy stuff.
The tricky-ish bit here is that I need to move timezones, pronouns and translations to proper settings. I expect to pursue that next.
Test Plan:
- Grepped for `loadPreferences` to identify callsites.
- Changed start-of-week setting, loaded Calendar, saw correct start.
- Visited welcome page, read "Adjust Settings" point.
- Loaded Conpherence -- I changed behavior here slightly (switching threads drops the title glyph) but it wasn't consistent to start with and this seems like a good thing to push to the next version of Conpherence.
- Enabled Filetree, toggled in Differential.
- Disabled Filetree, no longer visible in Differential.
- Changed "Unified Diffs" preference to "Small Screens" vs "Always".
- Toggled filetree in Diffusion.
- Edited a task, saw sensible projects in policy dropdown.
- Viewed user profile, uncollapsed/collapsed side nav, reloaded page, sticky'd.
- Toggled "monospaced textareas", used a comment box, got appropriate fonts.
- Toggled durable column.
- Disabled title glyphs.
- Changed monospaced font to 18px/36px impact.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T4103
Differential Revision: https://secure.phabricator.com/D16004
2016-06-01 13:59:08 -07:00
|
|
|
if ($show_changesets && $filetree_on) {
|
2013-01-21 07:45:42 -08:00
|
|
|
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
|
2016-01-02 11:28:31 -08:00
|
|
|
->setTitle($commit->getDisplayName())
|
|
|
|
|
->setBaseURI(new PhutilURI($commit->getURI()))
|
2013-01-21 07:45:42 -08:00
|
|
|
->build($changesets)
|
|
|
|
|
->setCrumbs($crumbs)
|
2016-03-17 12:01:22 -07:00
|
|
|
->setCollapsed((bool)$collapsed);
|
2013-01-21 07:45:42 -08:00
|
|
|
}
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$view = id(new PHUITwoColumnView())
|
|
|
|
|
->setHeader($header)
|
|
|
|
|
->setSubheader($subheader)
|
|
|
|
|
->setMainColumn(array(
|
|
|
|
|
$error_panel,
|
|
|
|
|
$timeline,
|
|
|
|
|
$merge_table,
|
|
|
|
|
$info_panel,
|
|
|
|
|
))
|
|
|
|
|
->setFooter(array(
|
|
|
|
|
$change_table,
|
|
|
|
|
$change_list,
|
|
|
|
|
$add_comment,
|
|
|
|
|
))
|
2016-04-06 15:20:53 -07:00
|
|
|
->addPropertySection(pht('Description'), $detail_list)
|
|
|
|
|
->addPropertySection(pht('Details'), $details)
|
2016-03-17 12:01:22 -07:00
|
|
|
->setCurtain($curtain);
|
|
|
|
|
|
|
|
|
|
$page = $this->newPage()
|
|
|
|
|
->setTitle($commit->getDisplayName())
|
|
|
|
|
->setCrumbs($crumbs)
|
|
|
|
|
->setPageObjectPHIDS(array($commit->getPHID()))
|
|
|
|
|
->appendChild(
|
|
|
|
|
array(
|
|
|
|
|
$view,
|
2013-02-19 13:33:10 -08:00
|
|
|
));
|
2016-03-17 12:01:22 -07:00
|
|
|
|
|
|
|
|
if ($nav) {
|
|
|
|
|
$page->setNavigation($nav);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $page;
|
|
|
|
|
|
2011-03-11 09:34:22 -08:00
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
private function buildPropertyListView(
|
2011-04-01 17:11:05 -07:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
2012-03-26 12:21:48 -07:00
|
|
|
PhabricatorRepositoryCommitData $data,
|
2013-07-24 15:29:46 -07:00
|
|
|
array $audit_requests) {
|
2012-08-08 10:03:41 -07:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer = $this->getViewer();
|
2012-08-08 10:03:41 -07:00
|
|
|
$commit_phid = $commit->getPHID();
|
2013-12-05 11:59:41 -08:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
$repository = $drequest->getRepository();
|
2012-08-08 10:03:41 -07:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$view = id(new PHUIPropertyListView())
|
|
|
|
|
->setUser($this->getRequest()->getUser());
|
|
|
|
|
|
2013-04-15 08:41:41 -07:00
|
|
|
$edge_query = id(new PhabricatorEdgeQuery())
|
2012-08-08 10:03:41 -07:00
|
|
|
->withSourcePHIDs(array($commit_phid))
|
|
|
|
|
->withEdgeTypes(array(
|
2014-07-17 15:42:06 -07:00
|
|
|
DiffusionCommitHasTaskEdgeType::EDGECONST,
|
2015-01-01 14:43:26 +11:00
|
|
|
DiffusionCommitHasRevisionEdgeType::EDGECONST,
|
Write edges for commit reverts
Summary:
Ref T1751. When a commit reverts another commit:
- Add an edge linking them;
- Show the edge in Diffusion.
Next steps are:
- If the reverted commit is associated with a Differential revision, leave a comment;
- Also leave a comment on the commit (no API yet);
- Also trigger an audit by the original commit's author.
Test Plan: Used `scripts/repository/reparse.php --message ...` to parse commits with revert language. Verified they appear correctly in Diffusion, and update Differential.
Reviewers: btrahan, epriestley
Reviewed By: btrahan, epriestley
Subscribers: Korvin, epriestley, cburroughs, joshuaspence, sascha-egerer, aran
Maniphest Tasks: T4896, T1751
Differential Revision: https://secure.phabricator.com/D5846
2015-01-05 06:52:38 +11:00
|
|
|
DiffusionCommitRevertsCommitEdgeType::EDGECONST,
|
|
|
|
|
DiffusionCommitRevertedByCommitEdgeType::EDGECONST,
|
2013-04-15 08:41:41 -07:00
|
|
|
));
|
|
|
|
|
|
|
|
|
|
$edges = $edge_query->execute();
|
2012-08-08 10:03:41 -07:00
|
|
|
|
|
|
|
|
$task_phids = array_keys(
|
2014-07-17 15:42:06 -07:00
|
|
|
$edges[$commit_phid][DiffusionCommitHasTaskEdgeType::EDGECONST]);
|
2013-04-12 22:48:16 -07:00
|
|
|
$revision_phid = key(
|
2015-01-01 14:43:26 +11:00
|
|
|
$edges[$commit_phid][DiffusionCommitHasRevisionEdgeType::EDGECONST]);
|
2012-08-08 10:03:41 -07:00
|
|
|
|
Write edges for commit reverts
Summary:
Ref T1751. When a commit reverts another commit:
- Add an edge linking them;
- Show the edge in Diffusion.
Next steps are:
- If the reverted commit is associated with a Differential revision, leave a comment;
- Also leave a comment on the commit (no API yet);
- Also trigger an audit by the original commit's author.
Test Plan: Used `scripts/repository/reparse.php --message ...` to parse commits with revert language. Verified they appear correctly in Diffusion, and update Differential.
Reviewers: btrahan, epriestley
Reviewed By: btrahan, epriestley
Subscribers: Korvin, epriestley, cburroughs, joshuaspence, sascha-egerer, aran
Maniphest Tasks: T4896, T1751
Differential Revision: https://secure.phabricator.com/D5846
2015-01-05 06:52:38 +11:00
|
|
|
$reverts_phids = array_keys(
|
|
|
|
|
$edges[$commit_phid][DiffusionCommitRevertsCommitEdgeType::EDGECONST]);
|
|
|
|
|
$reverted_by_phids = array_keys(
|
|
|
|
|
$edges[$commit_phid][DiffusionCommitRevertedByCommitEdgeType::EDGECONST]);
|
|
|
|
|
|
2013-04-15 08:41:41 -07:00
|
|
|
$phids = $edge_query->getDestinationPHIDs(array($commit_phid));
|
|
|
|
|
|
2011-04-01 17:11:05 -07:00
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
|
$phids[] = $data->getCommitDetail('authorPHID');
|
|
|
|
|
}
|
|
|
|
|
if ($data->getCommitDetail('reviewerPHID')) {
|
|
|
|
|
$phids[] = $data->getCommitDetail('reviewerPHID');
|
|
|
|
|
}
|
2012-05-23 08:34:36 -07:00
|
|
|
if ($data->getCommitDetail('committerPHID')) {
|
|
|
|
|
$phids[] = $data->getCommitDetail('committerPHID');
|
|
|
|
|
}
|
2011-04-01 17:11:05 -07:00
|
|
|
|
2013-12-05 11:59:41 -08:00
|
|
|
// NOTE: We should never normally have more than a single push log, but
|
|
|
|
|
// it can occur naturally if a commit is pushed, then the branch it was
|
|
|
|
|
// on is deleted, then the commit is pushed again (or through other similar
|
|
|
|
|
// chains of events). This should be rare, but does not indicate a bug
|
|
|
|
|
// or data issue.
|
|
|
|
|
|
|
|
|
|
// NOTE: We never query push logs in SVN because the commiter is always
|
|
|
|
|
// the pusher and the commit time is always the push time; the push log
|
|
|
|
|
// is redundant and we save a query by skipping it.
|
|
|
|
|
|
|
|
|
|
$push_logs = array();
|
|
|
|
|
if ($repository->isHosted() && !$repository->isSVN()) {
|
|
|
|
|
$push_logs = id(new PhabricatorRepositoryPushLogQuery())
|
|
|
|
|
->setViewer($viewer)
|
|
|
|
|
->withRepositoryPHIDs(array($repository->getPHID()))
|
|
|
|
|
->withNewRefs(array($commit->getCommitIdentifier()))
|
|
|
|
|
->withRefTypes(array(PhabricatorRepositoryPushLog::REFTYPE_COMMIT))
|
|
|
|
|
->execute();
|
|
|
|
|
foreach ($push_logs as $log) {
|
|
|
|
|
$phids[] = $log->getPusherPHID();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-01 17:11:05 -07:00
|
|
|
$handles = array();
|
|
|
|
|
if ($phids) {
|
2012-09-04 19:02:56 -07:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-01 17:11:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$props = array();
|
|
|
|
|
|
2013-07-24 15:29:46 -07:00
|
|
|
if ($audit_requests) {
|
2013-10-05 07:54:42 -07:00
|
|
|
$user_requests = array();
|
|
|
|
|
$other_requests = array();
|
2016-05-17 11:56:38 -07:00
|
|
|
|
2013-10-05 07:54:42 -07:00
|
|
|
foreach ($audit_requests as $audit_request) {
|
2016-05-17 11:56:38 -07:00
|
|
|
if (!$audit_request->isInteresting()) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-05 07:54:42 -07:00
|
|
|
if ($audit_request->isUser()) {
|
|
|
|
|
$user_requests[] = $audit_request;
|
|
|
|
|
} else {
|
|
|
|
|
$other_requests[] = $audit_request;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($user_requests) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Auditors'),
|
2017-01-25 11:28:42 -08:00
|
|
|
$this->renderAuditStatusView($commit, $user_requests));
|
2013-10-05 07:54:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($other_requests) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
2016-05-17 11:56:38 -07:00
|
|
|
pht('Group Auditors'),
|
2017-01-25 11:28:42 -08:00
|
|
|
$this->renderAuditStatusView($commit, $other_requests));
|
2013-10-05 07:54:42 -07:00
|
|
|
}
|
2012-03-30 14:12:10 -07:00
|
|
|
}
|
|
|
|
|
|
2013-12-07 11:12:38 -08:00
|
|
|
$author_phid = $data->getCommitDetail('authorPHID');
|
|
|
|
|
$author_name = $data->getAuthorName();
|
2016-03-17 12:01:22 -07:00
|
|
|
$author_epoch = $data->getCommitDetail('authorEpoch');
|
2011-04-01 17:11:05 -07:00
|
|
|
|
2013-12-05 11:59:41 -08:00
|
|
|
$committed_info = id(new PHUIStatusItemView())
|
|
|
|
|
->setNote(phabricator_datetime($commit->getEpoch(), $viewer));
|
|
|
|
|
|
|
|
|
|
$committer_phid = $data->getCommitDetail('committerPHID');
|
|
|
|
|
$committer_name = $data->getCommitDetail('committer');
|
|
|
|
|
if ($committer_phid) {
|
|
|
|
|
$committed_info->setTarget($handles[$committer_phid]->renderLink());
|
|
|
|
|
} else if (strlen($committer_name)) {
|
|
|
|
|
$committed_info->setTarget($committer_name);
|
|
|
|
|
} else if ($author_phid) {
|
|
|
|
|
$committed_info->setTarget($handles[$author_phid]->renderLink());
|
|
|
|
|
} else if (strlen($author_name)) {
|
|
|
|
|
$committed_info->setTarget($author_name);
|
2011-04-01 17:11:05 -07:00
|
|
|
}
|
|
|
|
|
|
2016-03-19 15:34:31 +00:00
|
|
|
$committed_list = new PHUIStatusListView();
|
|
|
|
|
$committed_list->addItem($committed_info);
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Committed'),
|
2016-03-19 15:34:31 +00:00
|
|
|
$committed_list);
|
2013-12-05 11:59:41 -08:00
|
|
|
|
|
|
|
|
if ($push_logs) {
|
|
|
|
|
$pushed_list = new PHUIStatusListView();
|
|
|
|
|
|
|
|
|
|
foreach ($push_logs as $push_log) {
|
|
|
|
|
$pushed_item = id(new PHUIStatusItemView())
|
|
|
|
|
->setTarget($handles[$push_log->getPusherPHID()]->renderLink())
|
|
|
|
|
->setNote(phabricator_datetime($push_log->getEpoch(), $viewer));
|
|
|
|
|
$pushed_list->addItem($pushed_item);
|
2012-05-23 08:34:36 -07:00
|
|
|
}
|
2013-12-05 11:59:41 -08:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Pushed'),
|
|
|
|
|
$pushed_list);
|
2013-12-05 11:59:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$reviewer_phid = $data->getCommitDetail('reviewerPHID');
|
|
|
|
|
if ($reviewer_phid) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Reviewer'),
|
|
|
|
|
$handles[$reviewer_phid]->renderLink());
|
2012-05-23 08:34:36 -07:00
|
|
|
}
|
|
|
|
|
|
2011-04-01 17:11:05 -07:00
|
|
|
if ($revision_phid) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Differential Revision'),
|
|
|
|
|
$handles[$revision_phid]->renderLink());
|
2011-04-01 17:11:05 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
$parents = $this->getCommitParents();
|
2012-03-26 12:21:48 -07:00
|
|
|
if ($parents) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Parents'),
|
|
|
|
|
$viewer->renderHandleList(mpull($parents, 'getPHID')));
|
2012-03-26 12:21:48 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
if ($this->getCommitExists()) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Branches'),
|
|
|
|
|
phutil_tag(
|
2015-10-02 16:11:03 -07:00
|
|
|
'span',
|
|
|
|
|
array(
|
|
|
|
|
'id' => 'commit-branches',
|
|
|
|
|
),
|
2016-03-17 12:01:22 -07:00
|
|
|
pht('Unknown')));
|
|
|
|
|
|
|
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Tags'),
|
|
|
|
|
phutil_tag(
|
2015-10-02 16:11:03 -07:00
|
|
|
'span',
|
|
|
|
|
array(
|
|
|
|
|
'id' => 'commit-tags',
|
|
|
|
|
),
|
2016-03-17 12:01:22 -07:00
|
|
|
pht('Unknown')));
|
2012-01-19 11:49:51 -08:00
|
|
|
|
2016-01-02 12:21:13 -08:00
|
|
|
$identifier = $commit->getCommitIdentifier();
|
|
|
|
|
$root = $repository->getPathURI("commit/{$identifier}");
|
2015-10-02 16:11:03 -07:00
|
|
|
Javelin::initBehavior(
|
|
|
|
|
'diffusion-commit-branches',
|
|
|
|
|
array(
|
|
|
|
|
$root.'/branches/' => 'commit-branches',
|
|
|
|
|
$root.'/tags/' => 'commit-tags',
|
|
|
|
|
));
|
|
|
|
|
}
|
2012-04-23 18:36:25 -07:00
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
$refs = $this->getCommitRefs();
|
2012-04-25 07:21:03 -07:00
|
|
|
if ($refs) {
|
2015-10-02 16:11:03 -07:00
|
|
|
$ref_links = array();
|
|
|
|
|
foreach ($refs as $ref_data) {
|
|
|
|
|
$ref_links[] = phutil_tag(
|
|
|
|
|
'a',
|
|
|
|
|
array(
|
|
|
|
|
'href' => $ref_data['href'],
|
|
|
|
|
),
|
|
|
|
|
$ref_data['ref']);
|
|
|
|
|
}
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('References'),
|
|
|
|
|
phutil_implode_html(', ', $ref_links));
|
2012-04-25 07:21:03 -07:00
|
|
|
}
|
|
|
|
|
|
Write edges for commit reverts
Summary:
Ref T1751. When a commit reverts another commit:
- Add an edge linking them;
- Show the edge in Diffusion.
Next steps are:
- If the reverted commit is associated with a Differential revision, leave a comment;
- Also leave a comment on the commit (no API yet);
- Also trigger an audit by the original commit's author.
Test Plan: Used `scripts/repository/reparse.php --message ...` to parse commits with revert language. Verified they appear correctly in Diffusion, and update Differential.
Reviewers: btrahan, epriestley
Reviewed By: btrahan, epriestley
Subscribers: Korvin, epriestley, cburroughs, joshuaspence, sascha-egerer, aran
Maniphest Tasks: T4896, T1751
Differential Revision: https://secure.phabricator.com/D5846
2015-01-05 06:52:38 +11:00
|
|
|
if ($reverts_phids) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Reverts'),
|
|
|
|
|
$viewer->renderHandleList($reverts_phids));
|
Write edges for commit reverts
Summary:
Ref T1751. When a commit reverts another commit:
- Add an edge linking them;
- Show the edge in Diffusion.
Next steps are:
- If the reverted commit is associated with a Differential revision, leave a comment;
- Also leave a comment on the commit (no API yet);
- Also trigger an audit by the original commit's author.
Test Plan: Used `scripts/repository/reparse.php --message ...` to parse commits with revert language. Verified they appear correctly in Diffusion, and update Differential.
Reviewers: btrahan, epriestley
Reviewed By: btrahan, epriestley
Subscribers: Korvin, epriestley, cburroughs, joshuaspence, sascha-egerer, aran
Maniphest Tasks: T4896, T1751
Differential Revision: https://secure.phabricator.com/D5846
2015-01-05 06:52:38 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($reverted_by_phids) {
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Reverted By'),
|
|
|
|
|
$viewer->renderHandleList($reverted_by_phids));
|
Write edges for commit reverts
Summary:
Ref T1751. When a commit reverts another commit:
- Add an edge linking them;
- Show the edge in Diffusion.
Next steps are:
- If the reverted commit is associated with a Differential revision, leave a comment;
- Also leave a comment on the commit (no API yet);
- Also trigger an audit by the original commit's author.
Test Plan: Used `scripts/repository/reparse.php --message ...` to parse commits with revert language. Verified they appear correctly in Diffusion, and update Differential.
Reviewers: btrahan, epriestley
Reviewed By: btrahan, epriestley
Subscribers: Korvin, epriestley, cburroughs, joshuaspence, sascha-egerer, aran
Maniphest Tasks: T4896, T1751
Differential Revision: https://secure.phabricator.com/D5846
2015-01-05 06:52:38 +11:00
|
|
|
}
|
|
|
|
|
|
2012-04-04 17:34:25 -07:00
|
|
|
if ($task_phids) {
|
|
|
|
|
$task_list = array();
|
|
|
|
|
foreach ($task_phids as $phid) {
|
|
|
|
|
$task_list[] = $handles[$phid]->renderLink();
|
|
|
|
|
}
|
2013-02-13 14:50:15 -08:00
|
|
|
$task_list = phutil_implode_html(phutil_tag('br'), $task_list);
|
2016-03-17 12:01:22 -07:00
|
|
|
$view->addProperty(
|
|
|
|
|
pht('Tasks'),
|
|
|
|
|
$task_list);
|
2012-04-04 17:34:25 -07:00
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
return $view;
|
2011-04-01 17:11:05 -07:00
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
private function buildSubheaderView(
|
|
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
|
PhabricatorRepositoryCommitData $data) {
|
|
|
|
|
|
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
|
|
|
|
|
if ($repository->isSVN()) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$author_phid = $data->getCommitDetail('authorPHID');
|
|
|
|
|
$author_name = $data->getAuthorName();
|
|
|
|
|
$author_epoch = $data->getCommitDetail('authorEpoch');
|
|
|
|
|
$date = null;
|
|
|
|
|
if ($author_epoch !== null) {
|
|
|
|
|
$date = phabricator_datetime($author_epoch, $viewer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($author_phid) {
|
|
|
|
|
$handles = $viewer->loadHandles(array($author_phid));
|
|
|
|
|
$image_uri = $handles[$author_phid]->getImageURI();
|
|
|
|
|
$image_href = $handles[$author_phid]->getURI();
|
|
|
|
|
$author = $handles[$author_phid]->renderLink();
|
|
|
|
|
} else if (strlen($author_name)) {
|
|
|
|
|
$author = $author_name;
|
|
|
|
|
$image_uri = null;
|
|
|
|
|
$image_href = null;
|
2016-03-18 12:01:15 -07:00
|
|
|
} else {
|
|
|
|
|
return null;
|
2016-03-17 12:01:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$author = phutil_tag('strong', array(), $author);
|
|
|
|
|
if ($date) {
|
|
|
|
|
$content = pht('Authored by %s on %s.', $author, $date);
|
|
|
|
|
} else {
|
|
|
|
|
$content = pht('Authored by %s.', $author);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return id(new PHUIHeadThingView())
|
|
|
|
|
->setImage($image_uri)
|
|
|
|
|
->setImageHref($image_href)
|
|
|
|
|
->setContent($content);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-03 16:22:31 -07:00
|
|
|
private function buildComments(PhabricatorRepositoryCommit $commit) {
|
Transactions - deploy buildTransactionTimeline to remaining applications
Summary:
Ref T4712. Specifically...
- Differential
- needed getApplicationTransactionViewObject() implemented
- Audit
- needed getApplicationTransactionViewObject() implemented
- Repository
- one object needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true)
- Ponder
- BONUS BUG FIX - leaving a comment on an answer had a bad redirect URI
- both PonderQuestion and PonderAnswer needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on both "history" controllers
- left a "TODO" on buildAnswers on the question view controller, which is non-standard and should be re-written eventually
- Phortune
- BONUS BUG FIX - fix new user "createNewAccount" code to not fatal
- PhortuneAccount, PhortuneMerchant, and PhortuneCart needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) on Account view, merchant view, and cart view controller
- Fund
- Legalpad
- Nuance
- NuanceSource needed PhabricatorApplicationTransactionInterface implemented
- Releeph (this product is kind of a mess...)
- HACKQUEST - had to manually create an arcanist project to even be able to make a "product" and get started...!
- BONUS BUG FIX - make sure to "setName" on product edit
- ReleephProject (should be ReleepProduct...?), ReleephBranch, and ReleepRequest needed PhabricatorApplicationTransactionInterface implemented
- Harbormaster
- HarbormasterBuildable, HarbormasterBuild, HarbormasterBuildPlan, and HarbormasterBuildStep all needed PhabricatorApplicationTransactionInterface implemented
- setShouldTerminate(true) all over the place
Test Plan: foreach application, viewed the timeline(s) and made sure they still rendered
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10925
2014-12-03 15:35:47 -08:00
|
|
|
$timeline = $this->buildTransactionTimeline(
|
|
|
|
|
$commit,
|
|
|
|
|
new PhabricatorAuditTransactionQuery());
|
2017-02-13 07:39:56 -08:00
|
|
|
|
2015-01-23 11:32:38 -08:00
|
|
|
$commit->willRenderTimeline($timeline, $this->getRequest());
|
2017-02-13 07:39:56 -08:00
|
|
|
|
|
|
|
|
$timeline->setQuoteRef($commit->getMonogram());
|
|
|
|
|
|
2015-01-23 11:32:38 -08:00
|
|
|
return $timeline;
|
2012-02-24 14:14:39 -08:00
|
|
|
}
|
|
|
|
|
|
2012-07-23 09:15:10 -07:00
|
|
|
private function renderAddCommentPanel(
|
2012-04-03 16:22:31 -07:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
2017-01-11 14:01:59 -08:00
|
|
|
$timeline) {
|
2013-09-27 10:49:45 -07:00
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer = $request->getUser();
|
2013-09-27 10:49:45 -07:00
|
|
|
|
2013-01-30 12:01:07 -08:00
|
|
|
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
|
|
|
|
// Differential better.
|
|
|
|
|
require_celerity_resource('differential-core-view-css');
|
|
|
|
|
|
2017-01-11 14:01:59 -08:00
|
|
|
$comment_view = id(new DiffusionCommitEditEngine())
|
|
|
|
|
->setViewer($viewer)
|
|
|
|
|
->buildEditEngineCommentView($commit);
|
2013-11-11 09:23:23 -08:00
|
|
|
|
2017-01-11 14:01:59 -08:00
|
|
|
$comment_view->setTransactionTimeline($timeline);
|
|
|
|
|
|
|
|
|
|
return $comment_view;
|
2012-02-24 15:04:53 -08:00
|
|
|
}
|
|
|
|
|
|
2012-03-23 15:32:26 -07:00
|
|
|
private function buildMergesTable(PhabricatorRepositoryCommit $commit) {
|
2015-09-10 19:28:49 -07:00
|
|
|
$viewer = $this->getViewer();
|
2012-03-23 15:32:26 -07:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2015-02-03 09:54:32 -08:00
|
|
|
$repository = $drequest->getRepository();
|
2012-03-23 15:32:26 -07:00
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
$merges = $this->getCommitMerges();
|
2012-03-23 15:32:26 -07:00
|
|
|
if (!$merges) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2015-10-02 16:11:03 -07:00
|
|
|
|
|
|
|
|
$limit = $this->getMergeDisplayLimit();
|
2012-03-23 15:32:26 -07:00
|
|
|
|
|
|
|
|
$caption = null;
|
|
|
|
|
if (count($merges) > $limit) {
|
|
|
|
|
$merges = array_slice($merges, 0, $limit);
|
2015-03-06 15:32:12 -08:00
|
|
|
$caption = new PHUIInfoView();
|
|
|
|
|
$caption->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
|
|
|
|
|
$caption->appendChild(
|
2015-03-26 17:12:00 -07:00
|
|
|
pht(
|
2015-05-22 17:27:56 +10:00
|
|
|
'This commit merges a very large number of changes. '.
|
|
|
|
|
'Only the first %s are shown.',
|
2015-03-26 17:12:00 -07:00
|
|
|
new PhutilNumber($limit)));
|
2012-03-23 15:32:26 -07:00
|
|
|
}
|
|
|
|
|
|
2015-09-10 19:28:49 -07:00
|
|
|
$history_table = id(new DiffusionHistoryTableView())
|
|
|
|
|
->setUser($viewer)
|
|
|
|
|
->setDiffusionRequest($drequest)
|
|
|
|
|
->setHistory($merges);
|
2012-03-23 15:32:26 -07:00
|
|
|
|
2015-09-10 19:28:49 -07:00
|
|
|
$history_table->loadRevisions();
|
2012-03-23 15:32:26 -07:00
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
$panel = id(new PHUIObjectBoxView())
|
|
|
|
|
->setHeaderText(pht('Merged Changes'))
|
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
|
|
|
->setTable($history_table);
|
2015-03-06 15:32:12 -08:00
|
|
|
if ($caption) {
|
2015-03-06 17:03:18 -08:00
|
|
|
$panel->setInfoView($caption);
|
2015-03-06 15:32:12 -08:00
|
|
|
}
|
2012-03-23 15:32:26 -07:00
|
|
|
|
|
|
|
|
return $panel;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
private function buildCurtain(
|
2012-08-08 10:03:41 -07:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
|
PhabricatorRepository $repository) {
|
2012-03-30 14:12:10 -07:00
|
|
|
|
2012-05-02 13:43:45 -07:00
|
|
|
$request = $this->getRequest();
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
$curtain = $this->newCurtainView($commit);
|
2012-03-30 14:12:10 -07:00
|
|
|
|
2013-09-27 10:49:45 -07:00
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
2016-03-17 12:01:22 -07:00
|
|
|
$viewer,
|
2013-09-27 10:49:45 -07:00
|
|
|
$commit,
|
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
|
2017-01-11 09:43:22 -08:00
|
|
|
$id = $commit->getID();
|
|
|
|
|
$edit_uri = $this->getApplicationURI("/commit/edit/{$id}/");
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
|
|
|
|
|
$action = id(new PhabricatorActionView())
|
2013-05-11 08:23:19 -07:00
|
|
|
->setName(pht('Edit Commit'))
|
2017-01-11 09:43:22 -08:00
|
|
|
->setHref($edit_uri)
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-pencil')
|
2013-09-27 10:49:45 -07:00
|
|
|
->setDisabled(!$can_edit)
|
|
|
|
|
->setWorkflow(!$can_edit);
|
2016-03-17 12:01:22 -07:00
|
|
|
$curtain->addAction($action);
|
2012-03-30 14:12:10 -07:00
|
|
|
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
$action = id(new PhabricatorActionView())
|
2013-05-11 08:23:19 -07:00
|
|
|
->setName(pht('Download Raw Diff'))
|
upgrade diffusion to use modern header UI and fix a few quirks
Summary:
upgrades are CrumbsView, HeaderView, PropertyListView, and ActionListView. I had to modify CrumbsView stuff a bit to handle the "advanced" diffusion crumbs.
Quirks fixed include making file tree view show up in diffusion, the page not have extra space when the file tree is hidden, links no longer breaking once you visit files (since without the change the files always got "/" appended and thus 404'd), and a differential quirk where it read "next step:" and that colon is a no no,
Test Plan: played around in diffusion and differential
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin, chad
Maniphest Tasks: T2048, T2178
Differential Revision: https://secure.phabricator.com/D4169
2012-12-12 17:50:42 -08:00
|
|
|
->setHref($request->getRequestURI()->alter('diff', true))
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-download');
|
2016-03-17 12:01:22 -07:00
|
|
|
$curtain->addAction($action);
|
2012-03-30 14:12:10 -07:00
|
|
|
|
2016-06-28 18:38:45 -07:00
|
|
|
$relationship_list = PhabricatorObjectRelationshipList::newForObject(
|
|
|
|
|
$viewer,
|
|
|
|
|
$commit);
|
|
|
|
|
|
|
|
|
|
$relationship_submenu = $relationship_list->newActionMenu();
|
|
|
|
|
if ($relationship_submenu) {
|
|
|
|
|
$curtain->addAction($relationship_submenu);
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-17 12:01:22 -07:00
|
|
|
return $curtain;
|
2012-03-30 14:12:10 -07:00
|
|
|
}
|
|
|
|
|
|
2012-05-02 13:43:45 -07:00
|
|
|
private function buildRawDiffResponse(DiffusionRequest $drequest) {
|
2016-08-26 09:37:53 -07:00
|
|
|
$diff_info = $this->callConduitWithDiffusionRequest(
|
2013-05-14 13:53:32 -07:00
|
|
|
'diffusion.rawdiffquery',
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $drequest->getCommit(),
|
2014-10-08 00:01:04 +11:00
|
|
|
'path' => $drequest->getPath(),
|
|
|
|
|
));
|
2012-05-02 13:43:45 -07:00
|
|
|
|
2016-08-26 09:37:53 -07:00
|
|
|
$file_phid = $diff_info['filePHID'];
|
2012-05-02 13:43:45 -07:00
|
|
|
|
2016-08-26 09:37:53 -07:00
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
|
->setViewer($this->getViewer())
|
|
|
|
|
->withPHIDs(array($file_phid))
|
|
|
|
|
->executeOne();
|
|
|
|
|
if (!$file) {
|
|
|
|
|
throw new Exception(
|
|
|
|
|
pht(
|
|
|
|
|
'Failed to load file ("%s") returned by "%s".',
|
|
|
|
|
$file_phid,
|
|
|
|
|
'diffusion.rawdiffquery'));
|
|
|
|
|
}
|
2013-12-30 11:27:02 -08:00
|
|
|
|
2014-08-19 15:53:15 -07:00
|
|
|
return $file->getRedirectResponse();
|
2012-05-02 13:43:45 -07:00
|
|
|
}
|
|
|
|
|
|
2017-01-25 11:28:42 -08:00
|
|
|
private function renderAuditStatusView(
|
|
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
|
array $audit_requests) {
|
2013-07-24 15:29:46 -07:00
|
|
|
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
2015-03-30 07:55:33 -07:00
|
|
|
$viewer = $this->getViewer();
|
2013-07-24 15:29:46 -07:00
|
|
|
|
|
|
|
|
$view = new PHUIStatusListView();
|
|
|
|
|
foreach ($audit_requests as $request) {
|
2014-10-20 15:47:10 -07:00
|
|
|
$code = $request->getAuditStatus();
|
2013-07-24 15:29:46 -07:00
|
|
|
$item = new PHUIStatusItemView();
|
2014-10-20 15:47:10 -07:00
|
|
|
$item->setIcon(
|
|
|
|
|
PhabricatorAuditStatusConstants::getStatusIcon($code),
|
|
|
|
|
PhabricatorAuditStatusConstants::getStatusColor($code),
|
|
|
|
|
PhabricatorAuditStatusConstants::getStatusName($code));
|
2013-07-24 15:29:46 -07:00
|
|
|
|
|
|
|
|
$auditor_phid = $request->getAuditorPHID();
|
2015-03-30 07:55:33 -07:00
|
|
|
$target = $viewer->renderHandle($auditor_phid);
|
2013-07-24 15:29:46 -07:00
|
|
|
$item->setTarget($target);
|
|
|
|
|
|
2017-01-25 11:28:42 -08:00
|
|
|
if ($commit->hasAuditAuthority($viewer, $request)) {
|
2013-07-24 15:29:46 -07:00
|
|
|
$item->setHighlighted(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$view->addItem($item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-18 10:13:00 -07:00
|
|
|
private function linkBugtraq($corpus) {
|
|
|
|
|
$url = PhabricatorEnv::getEnvConfig('bugtraq.url');
|
|
|
|
|
if (!strlen($url)) {
|
|
|
|
|
return $corpus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$regexes = PhabricatorEnv::getEnvConfig('bugtraq.logregex');
|
|
|
|
|
if (!$regexes) {
|
|
|
|
|
return $corpus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$parser = id(new PhutilBugtraqParser())
|
|
|
|
|
->setBugtraqPattern("[[ {$url} | %BUGID% ]]")
|
|
|
|
|
->setBugtraqCaptureExpression(array_shift($regexes));
|
|
|
|
|
|
|
|
|
|
$select = array_shift($regexes);
|
|
|
|
|
if ($select) {
|
|
|
|
|
$parser->setBugtraqSelectExpression($select);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $parser->processCorpus($corpus);
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-12 13:02:32 -08:00
|
|
|
private function buildTableOfContents(
|
|
|
|
|
array $changesets,
|
|
|
|
|
$header,
|
|
|
|
|
$info_view) {
|
|
|
|
|
|
2015-08-17 10:14:22 -07:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2015-08-15 12:57:20 -07:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
|
|
$toc_view = id(new PHUIDiffTableOfContentsListView())
|
2016-03-12 13:02:32 -08:00
|
|
|
->setUser($viewer)
|
2016-03-17 12:01:22 -07:00
|
|
|
->setHeader($header)
|
|
|
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
|
2016-03-12 13:02:32 -08:00
|
|
|
|
|
|
|
|
if ($info_view) {
|
|
|
|
|
$toc_view->setInfoView($info_view);
|
|
|
|
|
}
|
2015-08-15 12:57:20 -07:00
|
|
|
|
|
|
|
|
// TODO: This is hacky, we just want access to the linkX() methods on
|
|
|
|
|
// DiffusionView.
|
|
|
|
|
$diffusion_view = id(new DiffusionEmptyResultView())
|
2015-08-17 10:14:22 -07:00
|
|
|
->setDiffusionRequest($drequest);
|
|
|
|
|
|
|
|
|
|
$have_owners = PhabricatorApplication::isClassInstalledForViewer(
|
|
|
|
|
'PhabricatorOwnersApplication',
|
|
|
|
|
$viewer);
|
|
|
|
|
|
|
|
|
|
if (!$changesets) {
|
|
|
|
|
$have_owners = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($have_owners) {
|
|
|
|
|
if ($viewer->getPHID()) {
|
|
|
|
|
$packages = id(new PhabricatorOwnersPackageQuery())
|
|
|
|
|
->setViewer($viewer)
|
2015-08-18 13:36:05 -07:00
|
|
|
->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))
|
2015-08-17 10:14:22 -07:00
|
|
|
->withAuthorityPHIDs(array($viewer->getPHID()))
|
|
|
|
|
->execute();
|
|
|
|
|
$toc_view->setAuthorityPackages($packages);
|
|
|
|
|
}
|
2015-08-15 12:57:20 -07:00
|
|
|
|
2015-08-17 10:14:22 -07:00
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
$repository_phid = $repository->getPHID();
|
|
|
|
|
|
|
|
|
|
$control_query = id(new PhabricatorOwnersPackageQuery())
|
|
|
|
|
->setViewer($viewer)
|
2015-08-18 13:36:05 -07:00
|
|
|
->withStatuses(array(PhabricatorOwnersPackage::STATUS_ACTIVE))
|
2015-08-17 10:14:22 -07:00
|
|
|
->withControl($repository_phid, mpull($changesets, 'getFilename'));
|
|
|
|
|
$control_query->execute();
|
|
|
|
|
}
|
2015-08-15 12:57:20 -07:00
|
|
|
|
|
|
|
|
foreach ($changesets as $changeset_id => $changeset) {
|
|
|
|
|
$path = $changeset->getFilename();
|
2017-09-15 05:33:08 -07:00
|
|
|
$anchor = $changeset->getAnchorName();
|
2015-08-15 12:57:20 -07:00
|
|
|
|
|
|
|
|
$history_link = $diffusion_view->linkHistory($path);
|
2015-09-10 19:28:49 -07:00
|
|
|
$browse_link = $diffusion_view->linkBrowse(
|
|
|
|
|
$path,
|
|
|
|
|
array(
|
|
|
|
|
'type' => $changeset->getFileType(),
|
|
|
|
|
));
|
2015-08-15 12:57:20 -07:00
|
|
|
|
|
|
|
|
$item = id(new PHUIDiffTableOfContentsItemView())
|
|
|
|
|
->setChangeset($changeset)
|
|
|
|
|
->setAnchor($anchor)
|
|
|
|
|
->setContext(
|
|
|
|
|
array(
|
|
|
|
|
$history_link,
|
|
|
|
|
' ',
|
|
|
|
|
$browse_link,
|
|
|
|
|
));
|
|
|
|
|
|
2015-08-17 10:14:22 -07:00
|
|
|
if ($have_owners) {
|
2015-08-20 04:46:17 -07:00
|
|
|
$packages = $control_query->getControllingPackagesForPath(
|
2015-08-17 10:14:22 -07:00
|
|
|
$repository_phid,
|
|
|
|
|
$changeset->getFilename());
|
2015-08-20 04:46:17 -07:00
|
|
|
$item->setPackages($packages);
|
2015-08-17 10:14:22 -07:00
|
|
|
}
|
|
|
|
|
|
2015-08-15 12:57:20 -07:00
|
|
|
$toc_view->addItem($item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $toc_view;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-02 16:11:03 -07:00
|
|
|
private function loadCommitState() {
|
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
|
$commit = $drequest->getCommit();
|
|
|
|
|
|
|
|
|
|
// TODO: We could use futures here and resolve these calls in parallel.
|
|
|
|
|
|
|
|
|
|
$exceptions = array();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$parent_refs = $this->callConduitWithDiffusionRequest(
|
|
|
|
|
'diffusion.commitparentsquery',
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $commit,
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
if ($parent_refs) {
|
|
|
|
|
$parents = id(new DiffusionCommitQuery())
|
|
|
|
|
->setViewer($viewer)
|
|
|
|
|
->withRepository($repository)
|
|
|
|
|
->withIdentifiers($parent_refs)
|
|
|
|
|
->execute();
|
|
|
|
|
} else {
|
|
|
|
|
$parents = array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->commitParents = $parents;
|
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
|
$this->commitParents = false;
|
|
|
|
|
$exceptions[] = $ex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$merge_limit = $this->getMergeDisplayLimit();
|
|
|
|
|
|
|
|
|
|
try {
|
2015-10-05 15:57:41 -07:00
|
|
|
if ($repository->isSVN()) {
|
|
|
|
|
$this->commitMerges = array();
|
|
|
|
|
} else {
|
|
|
|
|
$merges = $this->callConduitWithDiffusionRequest(
|
|
|
|
|
'diffusion.mergedcommitsquery',
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $commit,
|
|
|
|
|
'limit' => $merge_limit + 1,
|
|
|
|
|
));
|
|
|
|
|
$this->commitMerges = DiffusionPathChange::newFromConduit($merges);
|
|
|
|
|
}
|
2015-10-02 16:11:03 -07:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
|
$this->commitMerges = false;
|
|
|
|
|
$exceptions[] = $ex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if ($repository->isGit()) {
|
|
|
|
|
$refs = $this->callConduitWithDiffusionRequest(
|
|
|
|
|
'diffusion.refsquery',
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $commit,
|
|
|
|
|
));
|
|
|
|
|
} else {
|
|
|
|
|
$refs = array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->commitRefs = $refs;
|
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
|
$this->commitRefs = false;
|
|
|
|
|
$exceptions[] = $ex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($exceptions) {
|
|
|
|
|
$exists = $this->callConduitWithDiffusionRequest(
|
|
|
|
|
'diffusion.existsquery',
|
|
|
|
|
array(
|
|
|
|
|
'commit' => $commit,
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
if ($exists) {
|
|
|
|
|
$this->commitExists = true;
|
|
|
|
|
foreach ($exceptions as $exception) {
|
|
|
|
|
$this->commitErrors[] = $exception->getMessage();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$this->commitExists = false;
|
|
|
|
|
$this->commitErrors[] = pht(
|
|
|
|
|
'This commit no longer exists in the repository. It may have '.
|
|
|
|
|
'been part of a branch which was deleted.');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$this->commitExists = true;
|
|
|
|
|
$this->commitErrors = array();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getMergeDisplayLimit() {
|
|
|
|
|
return 50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getCommitExists() {
|
|
|
|
|
if ($this->commitExists === null) {
|
|
|
|
|
$this->loadCommitState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->commitExists;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getCommitParents() {
|
|
|
|
|
if ($this->commitParents === null) {
|
|
|
|
|
$this->loadCommitState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->commitParents;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getCommitRefs() {
|
|
|
|
|
if ($this->commitRefs === null) {
|
|
|
|
|
$this->loadCommitState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->commitRefs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getCommitMerges() {
|
|
|
|
|
if ($this->commitMerges === null) {
|
|
|
|
|
$this->loadCommitState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->commitMerges;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getCommitErrors() {
|
|
|
|
|
if ($this->commitErrors === null) {
|
|
|
|
|
$this->loadCommitState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->commitErrors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-03-11 09:34:22 -08:00
|
|
|
}
|