2011-03-11 18:34:22 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DiffusionCommitController extends DiffusionController {
|
2011-03-11 18:34:22 +01:00
|
|
|
|
2011-04-07 23:55:06 +02:00
|
|
|
const CHANGES_LIMIT = 100;
|
|
|
|
|
2012-03-26 18:44:06 +02:00
|
|
|
private $auditAuthorityPHIDs;
|
2012-07-17 00:00:32 +02:00
|
|
|
private $highlightedAudits;
|
2012-03-26 18:44:06 +02:00
|
|
|
|
2013-09-27 19:49:45 +02:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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-20 03:52:14 +01:00
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
// This controller doesn't use blob/path stuff, just pass the dictionary
|
|
|
|
// in directly instead of using the AphrontRequest parsing mechanism.
|
2013-05-15 00:32:19 +02:00
|
|
|
$data['user'] = $this->getRequest()->getUser();
|
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-20 03:52:14 +01:00
|
|
|
$drequest = DiffusionRequest::newFromDictionary($data);
|
|
|
|
$this->diffusionRequest = $drequest;
|
|
|
|
}
|
|
|
|
|
2011-03-11 18:34:22 +01:00
|
|
|
public function processRequest() {
|
2011-03-14 00:19:39 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
2011-04-07 23:55:06 +02:00
|
|
|
$request = $this->getRequest();
|
2011-06-18 22:07:02 +02:00
|
|
|
$user = $request->getUser();
|
2011-03-11 18:34:22 +01:00
|
|
|
|
2012-05-02 22:43:45 +02:00
|
|
|
if ($request->getStr('diff')) {
|
|
|
|
return $this->buildRawDiffResponse($drequest);
|
|
|
|
}
|
|
|
|
|
2011-03-31 04:22:11 +02:00
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
|
|
|
|
2011-03-14 00:19:39 +01:00
|
|
|
$content = array();
|
2011-03-14 04:12:17 +01:00
|
|
|
$repository = $drequest->getRepository();
|
|
|
|
$commit = $drequest->loadCommit();
|
2011-03-27 08:52:09 +02:00
|
|
|
|
2013-09-23 21:53:55 +02:00
|
|
|
$crumbs = $this->buildCrumbs(array(
|
|
|
|
'commit' => true,
|
|
|
|
));
|
|
|
|
|
2011-03-27 08:52:09 +02:00
|
|
|
if (!$commit) {
|
2013-05-01 23:44:28 +02:00
|
|
|
$exists = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.existsquery',
|
|
|
|
array('commit' => $drequest->getCommit()));
|
2012-08-09 18:27:45 +02:00
|
|
|
if (!$exists) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
2013-09-23 21:53:55 +02:00
|
|
|
|
|
|
|
$error = id(new AphrontErrorView())
|
|
|
|
->setTitle(pht('Commit Still Parsing'))
|
|
|
|
->appendChild(
|
|
|
|
pht(
|
|
|
|
'Failed to load the commit because the commit has not been '.
|
|
|
|
'parsed yet.'));
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
|
|
|
$error,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => pht('Commit Still Parsing'),
|
|
|
|
));
|
2011-03-27 08:52:09 +02:00
|
|
|
}
|
|
|
|
|
2011-03-14 04:12:17 +01:00
|
|
|
$commit_data = $drequest->loadCommitData();
|
2012-03-26 18:44:06 +02:00
|
|
|
$commit->attachCommitData($commit_data);
|
2011-03-14 04:12:17 +01: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-13 02:50:42 +01:00
|
|
|
$top_anchor = id(new PhabricatorAnchorView())
|
|
|
|
->setAnchorName('top')
|
|
|
|
->setNavigationMarker(true);
|
|
|
|
|
2013-07-25 00:29:46 +02:00
|
|
|
$audit_requests = id(new PhabricatorAuditQuery())
|
|
|
|
->withCommitPHIDs(array($commit->getPHID()))
|
|
|
|
->execute();
|
|
|
|
$this->auditAuthorityPHIDs =
|
|
|
|
PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
|
|
|
|
|
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 23:39:52 +02:00
|
|
|
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
2013-01-21 16:45:42 +01:00
|
|
|
$changesets = null;
|
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 23:39:52 +02:00
|
|
|
if ($is_foreign) {
|
|
|
|
$subpath = $commit_data->getCommitDetail('svn-subpath');
|
|
|
|
|
|
|
|
$error_panel = new AphrontErrorView();
|
2013-05-11 17:23:19 +02:00
|
|
|
$error_panel->setTitle(pht('Commit Not Tracked'));
|
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 23:39:52 +02:00
|
|
|
$error_panel->setSeverity(AphrontErrorView::SEVERITY_WARNING);
|
|
|
|
$error_panel->appendChild(
|
2013-05-11 17:23:19 +02:00
|
|
|
pht("This Diffusion repository is configured to track only one ".
|
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 23:39:52 +02:00
|
|
|
"subdirectory of the entire Subversion repository, and this commit ".
|
2013-05-11 17:23:19 +02:00
|
|
|
"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 23:39:52 +02:00
|
|
|
$content[] = $error_panel;
|
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-13 02:50:42 +01:00
|
|
|
$content[] = $top_anchor;
|
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 23:39:52 +02:00
|
|
|
} else {
|
|
|
|
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
2013-03-04 21:33:05 +01:00
|
|
|
$engine->setConfig('viewer', $user);
|
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 23:39:52 +02:00
|
|
|
|
|
|
|
require_celerity_resource('diffusion-commit-view-css');
|
|
|
|
require_celerity_resource('phabricator-remarkup-css');
|
|
|
|
|
Diffusion - move commit parents query to conduit
Summary:
Ref T2784. Relatively complicated one as this bad boy is used in a repository daemon.
While testing, I noticed bugs in the expandshortname query stuff. Those variables are private to the parent class so they need some setX love.
Also, was unable to find links to the "before" stuff, but made them by hand by looking at some of these T2784 diffs, browsing a file at a specific revision, then hacking the "before" variable to be some known commit that also touched the file. This produced sensical results. On the process of doing that I upgraded a query to use the proper policy query.
Test Plan: In git, mercurial, svn, verified on a commit page the "parents" showed up correctly. played around with ?before parameter on specific file browse page, with commits known to have interesting history and stuff looked good
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Maniphest Tasks: T2784
Differential Revision: https://secure.phabricator.com/D5988
2013-05-22 01:22:49 +02:00
|
|
|
$parents = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.commitparentsquery',
|
|
|
|
array('commit' => $drequest->getCommit()));
|
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 23:39:52 +02:00
|
|
|
|
2013-12-20 21:39:21 +01:00
|
|
|
if ($parents) {
|
|
|
|
$parents = id(new DiffusionCommitQuery())
|
|
|
|
->setViewer($user)
|
|
|
|
->withRepository($repository)
|
|
|
|
->withIdentifiers($parents)
|
|
|
|
->execute();
|
|
|
|
}
|
|
|
|
|
2013-09-17 18:12:37 +02:00
|
|
|
$headsup_view = id(new PHUIHeaderView())
|
2013-02-22 00:09:35 +01:00
|
|
|
->setHeader(nonempty($commit->getSummary(), pht('Commit Detail')));
|
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-13 02:50:42 +01:00
|
|
|
|
|
|
|
$headsup_actions = $this->renderHeadsupActionList($commit, $repository);
|
|
|
|
|
|
|
|
$commit_properties = $this->loadCommitProperties(
|
|
|
|
$commit,
|
|
|
|
$commit_data,
|
2013-07-25 00:29:46 +02:00
|
|
|
$parents,
|
|
|
|
$audit_requests);
|
2013-10-11 16:53:56 +02:00
|
|
|
$property_list = id(new PHUIPropertyListView())
|
2013-05-09 23:21:21 +02:00
|
|
|
->setHasKeyboardShortcuts(true)
|
|
|
|
->setUser($user)
|
|
|
|
->setObject($commit);
|
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-13 02:50:42 +01:00
|
|
|
foreach ($commit_properties as $key => $value) {
|
|
|
|
$property_list->addProperty($key, $value);
|
|
|
|
}
|
|
|
|
|
2013-04-20 06:56:13 +02:00
|
|
|
$message = $commit_data->getCommitMessage();
|
|
|
|
|
|
|
|
$revision = $commit->getCommitIdentifier();
|
2013-09-18 19:13:00 +02:00
|
|
|
$message = $this->linkBugtraq($message);
|
2013-04-20 06:56:13 +02:00
|
|
|
|
|
|
|
$message = $engine->markupText($message);
|
|
|
|
|
2013-05-09 23:21:21 +02:00
|
|
|
$property_list->invokeWillRenderEvent();
|
2013-10-16 22:09:12 +02:00
|
|
|
$property_list->setActionList($headsup_actions);
|
|
|
|
|
|
|
|
$detail_list = new PHUIPropertyListView();
|
2013-11-04 20:07:51 +01:00
|
|
|
$detail_list->addSectionHeader(
|
|
|
|
pht('Description'),
|
|
|
|
PHUIPropertyListView::ICON_SUMMARY);
|
2013-10-16 22:09:12 +02:00
|
|
|
$detail_list->addTextContent(
|
2013-01-29 20:01:47 +01:00
|
|
|
phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'diffusion-commit-message phabricator-remarkup',
|
|
|
|
),
|
2013-04-20 06:56:13 +02:00
|
|
|
$message));
|
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-13 02:50:42 +01:00
|
|
|
$content[] = $top_anchor;
|
2013-09-29 00:55:38 +02:00
|
|
|
|
|
|
|
$object_box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($headsup_view)
|
2013-10-16 22:09:12 +02:00
|
|
|
->addPropertyList($property_list)
|
|
|
|
->addPropertyList($detail_list);
|
2013-09-29 00:55:38 +02:00
|
|
|
|
|
|
|
$content[] = $object_box;
|
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 23:39:52 +02:00
|
|
|
}
|
2011-03-14 00:19:39 +01:00
|
|
|
|
2012-02-24 23:14:39 +01:00
|
|
|
$content[] = $this->buildComments($commit);
|
2012-02-24 22:02:14 +01:00
|
|
|
|
2013-01-30 21:01:49 +01:00
|
|
|
$hard_limit = 1000;
|
|
|
|
|
2013-10-27 03:16:10 +01:00
|
|
|
if ($commit->isImported()) {
|
|
|
|
$change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
|
|
|
|
$drequest);
|
|
|
|
$change_query->setLimit($hard_limit + 1);
|
|
|
|
$changes = $change_query->loadChanges();
|
|
|
|
} else {
|
|
|
|
$changes = array();
|
|
|
|
}
|
2011-03-14 00:19:39 +01:00
|
|
|
|
2013-01-30 21:01:49 +01:00
|
|
|
$was_limited = (count($changes) > $hard_limit);
|
|
|
|
if ($was_limited) {
|
|
|
|
$changes = array_slice($changes, 0, $hard_limit);
|
|
|
|
}
|
|
|
|
|
2012-03-23 23:32:26 +01:00
|
|
|
$content[] = $this->buildMergesTable($commit);
|
|
|
|
|
2013-08-29 01:32:40 +02:00
|
|
|
// TODO: This is silly, but the logic to figure out which audits are
|
|
|
|
// highlighted currently lives in PhabricatorAuditListView. Refactor this
|
|
|
|
// to be less goofy.
|
|
|
|
$highlighted_audits = id(new PhabricatorAuditListView())
|
|
|
|
->setAudits($audit_requests)
|
|
|
|
->setAuthorityPHIDs($this->auditAuthorityPHIDs)
|
|
|
|
->setUser($user)
|
|
|
|
->setCommits(array($commit->getPHID() => $commit))
|
|
|
|
->getHighlightedAudits();
|
|
|
|
|
2012-07-17 00:00:32 +02:00
|
|
|
$owners_paths = array();
|
2013-08-29 01:32:40 +02:00
|
|
|
if ($highlighted_audits) {
|
2012-07-17 00:00:32 +02:00
|
|
|
$packages = id(new PhabricatorOwnersPackage())->loadAllWhere(
|
|
|
|
'phid IN (%Ls)',
|
2013-08-29 01:32:40 +02:00
|
|
|
mpull($highlighted_audits, 'getAuditorPHID'));
|
2012-07-17 00:00:32 +02:00
|
|
|
if ($packages) {
|
|
|
|
$owners_paths = id(new PhabricatorOwnersPath())->loadAllWhere(
|
|
|
|
'repositoryPHID = %s AND packageID IN (%Ld)',
|
|
|
|
$repository->getPHID(),
|
|
|
|
mpull($packages, 'getID'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-11 18:34:22 +01:00
|
|
|
$change_table = new DiffusionCommitChangeTableView();
|
|
|
|
$change_table->setDiffusionRequest($drequest);
|
2011-03-14 00:19:39 +01:00
|
|
|
$change_table->setPathChanges($changes);
|
2012-07-17 00:00:32 +02:00
|
|
|
$change_table->setOwnersPaths($owners_paths);
|
2011-03-11 18:34:22 +01:00
|
|
|
|
2011-04-07 23:55:06 +02:00
|
|
|
$count = count($changes);
|
2011-03-19 22:38:50 +01:00
|
|
|
|
2011-03-27 08:52:09 +02:00
|
|
|
$bad_commit = null;
|
|
|
|
if ($count == 0) {
|
|
|
|
$bad_commit = queryfx_one(
|
|
|
|
id(new PhabricatorRepository())->establishConnection('r'),
|
|
|
|
'SELECT * FROM %T WHERE fullCommitName = %s',
|
|
|
|
PhabricatorRepository::TABLE_BADCOMMIT,
|
2011-03-31 04:22:11 +02:00
|
|
|
'r'.$callsign.$commit->getCommitIdentifier());
|
2011-03-27 08:52:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($bad_commit) {
|
2013-10-27 03:16:10 +01:00
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
pht('Bad Commit'),
|
|
|
|
$bad_commit['description']);
|
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 23:39:52 +02:00
|
|
|
} else if ($is_foreign) {
|
|
|
|
// Don't render anything else.
|
2013-10-27 03:16:10 +01:00
|
|
|
} else if (!$commit->isImported()) {
|
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
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 23:39:52 +02:00
|
|
|
} else if (!count($changes)) {
|
2013-10-27 03:16:10 +01:00
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
pht('Empty Commit'),
|
|
|
|
pht(
|
|
|
|
'This commit is empty and does not affect any paths.'));
|
2013-01-30 21:01:49 +01:00
|
|
|
} else if ($was_limited) {
|
2013-10-27 03:16:10 +01:00
|
|
|
$content[] = $this->renderStatusMessage(
|
|
|
|
pht('Enormous Commit'),
|
2013-01-30 21:01:49 +01:00
|
|
|
pht(
|
|
|
|
'This commit is enormous, and affects more than %d files. '.
|
|
|
|
'Changes are not shown.',
|
|
|
|
$hard_limit));
|
2011-03-27 08:52:09 +02:00
|
|
|
} else {
|
2013-09-06 19:05:24 +02: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');
|
|
|
|
|
2014-01-09 17:51:57 +01:00
|
|
|
$change_panel = new PHUIObjectBoxView();
|
|
|
|
$header = new PHUIHeaderView();
|
|
|
|
$header->setHeader("Changes (".number_format($count).")");
|
2012-08-22 00:01:20 +02:00
|
|
|
$change_panel->setID('toc');
|
2013-09-06 19:05:24 +02:00
|
|
|
if ($count > self::CHANGES_LIMIT && !$show_all_details) {
|
2014-01-09 17:51:57 +01:00
|
|
|
|
|
|
|
$icon = id(new PHUIIconView())
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_ICONS)
|
|
|
|
->setSpriteIcon('transcript');
|
|
|
|
|
|
|
|
$button = id(new PHUIButtonView())
|
|
|
|
->setText(pht('Show All Changes'))
|
|
|
|
->setHref('?show_all=true')
|
|
|
|
->setTag('a')
|
|
|
|
->setIcon($icon);
|
2013-10-27 03:16:10 +01:00
|
|
|
|
2011-04-07 23:55:06 +02:00
|
|
|
$warning_view = id(new AphrontErrorView())
|
|
|
|
->setSeverity(AphrontErrorView::SEVERITY_WARNING)
|
2012-08-07 08:01:23 +02:00
|
|
|
->setTitle('Very Large Commit')
|
2013-10-30 17:20:48 +01:00
|
|
|
->appendChild(
|
|
|
|
pht("This commit is very large. Load each file individually."));
|
2011-04-07 23:55:06 +02:00
|
|
|
|
2014-01-09 17:51:57 +01:00
|
|
|
$change_panel->setFormError($warning_view);
|
|
|
|
$header->addActionLink($button);
|
2011-04-07 23:55:06 +02:00
|
|
|
}
|
|
|
|
|
2011-03-27 08:52:09 +02:00
|
|
|
$change_panel->appendChild($change_table);
|
2014-01-09 17:51:57 +01:00
|
|
|
$change_panel->setHeader($header);
|
2011-03-27 08:52:09 +02:00
|
|
|
|
|
|
|
$content[] = $change_panel;
|
|
|
|
|
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 23:39:52 +02:00
|
|
|
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
|
|
|
|
$changes);
|
|
|
|
|
|
|
|
$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 20:07:38 +02: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 23:39:52 +02:00
|
|
|
$vcs_supports_directory_changes = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
throw new Exception("Unknown VCS.");
|
|
|
|
}
|
2011-03-31 07:08:41 +02: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 23:39:52 +02: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-31 07:08:41 +02:00
|
|
|
}
|
2011-03-31 04:22:11 +02: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-20 03:52:14 +01:00
|
|
|
$references[$key] = $drequest->generateURI(
|
|
|
|
array(
|
|
|
|
'action' => 'rendering-ref',
|
|
|
|
'path' => $changeset->getFilename(),
|
|
|
|
));
|
2011-03-31 04:22:11 +02:00
|
|
|
}
|
2011-03-27 08:52:09 +02:00
|
|
|
|
2012-04-07 20:45:31 +02: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 20:56:01 +01: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-07 08:01:23 +02: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 20:56:01 +01:00
|
|
|
foreach ($changesets as $changeset) {
|
|
|
|
$changeset->makeEphemeral();
|
|
|
|
$changeset->setID($path_ids[$changeset->getFilename()]);
|
|
|
|
}
|
|
|
|
|
2013-09-06 19:05:24 +02:00
|
|
|
if ($count <= self::CHANGES_LIMIT || $show_all_details) {
|
2012-08-07 08:01:23 +02:00
|
|
|
$visible_changesets = $changesets;
|
|
|
|
} else {
|
|
|
|
$visible_changesets = array();
|
|
|
|
$inlines = id(new PhabricatorAuditInlineComment())->loadAllWhere(
|
|
|
|
'commitPHID = %s AND (auditCommentID IS NOT NULL OR authorPHID = %s)',
|
|
|
|
$commit->getPHID(),
|
|
|
|
$user->getPHID());
|
|
|
|
$path_ids = mpull($inlines, null, 'getPathID');
|
|
|
|
foreach ($changesets as $key => $changeset) {
|
|
|
|
if (array_key_exists($changeset->getID(), $path_ids)) {
|
|
|
|
$visible_changesets[$key] = $changeset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-13 06:21:56 +01:00
|
|
|
$change_list_title = DiffusionView::nameCommit(
|
|
|
|
$repository,
|
2013-02-19 22:33:10 +01:00
|
|
|
$commit->getCommitIdentifier());
|
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 23:39:52 +02:00
|
|
|
$change_list = new DifferentialChangesetListView();
|
2012-12-13 06:21:56 +01: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 23:39:52 +02:00
|
|
|
$change_list->setChangesets($changesets);
|
2012-08-07 08:01:23 +02: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 23:39:52 +02:00
|
|
|
$change_list->setRenderingReferences($references);
|
|
|
|
$change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
|
2012-04-10 08:42:12 +02:00
|
|
|
$change_list->setRepository($repository);
|
2012-01-16 20:08:54 +01:00
|
|
|
$change_list->setUser($user);
|
2012-10-31 22:07:25 +01:00
|
|
|
// pick the first branch for "Browse in Diffusion" View Option
|
2012-12-03 18:27:47 +01:00
|
|
|
$branches = $commit_data->getCommitDetail('seenOnBranches', array());
|
2012-10-31 22:07:25 +01:00
|
|
|
$first_branch = reset($branches);
|
|
|
|
$change_list->setBranch($first_branch);
|
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 23:39:52 +02:00
|
|
|
|
2012-03-20 03:57:41 +01:00
|
|
|
$change_list->setStandaloneURI(
|
|
|
|
'/diffusion/'.$callsign.'/diff/');
|
|
|
|
$change_list->setRawFileURIs(
|
|
|
|
// TODO: Implement this, somewhat tricky if there's an octopus merge
|
|
|
|
// or whatever?
|
|
|
|
null,
|
|
|
|
'/diffusion/'.$callsign.'/diff/?view=r');
|
|
|
|
|
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 20:56:01 +01:00
|
|
|
$change_list->setInlineCommentControllerURI(
|
2012-07-23 20:01:28 +02: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 20:56:01 +01:00
|
|
|
|
2012-08-07 08:01:23 +02:00
|
|
|
$change_references = array();
|
|
|
|
foreach ($changesets as $key => $changeset) {
|
|
|
|
$change_references[$changeset->getID()] = $references[$key];
|
|
|
|
}
|
|
|
|
$change_table->setRenderingReferences($change_references);
|
|
|
|
|
2013-01-30 21:01:07 +01:00
|
|
|
$content[] = $change_list->render();
|
2011-03-27 08:52:09 +02:00
|
|
|
}
|
2011-03-14 00:19:39 +01:00
|
|
|
|
2013-01-30 21:01:07 +01:00
|
|
|
$content[] = $this->renderAddCommentPanel($commit, $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-13 02:50:42 +01:00
|
|
|
$commit_id = 'r'.$callsign.$commit->getCommitIdentifier();
|
|
|
|
$short_name = DiffusionView::nameCommit(
|
|
|
|
$repository,
|
2013-02-19 22:33:10 +01:00
|
|
|
$commit->getCommitIdentifier());
|
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-13 02:50:42 +01:00
|
|
|
|
2013-02-05 02:00:27 +01:00
|
|
|
$prefs = $user->loadPreferences();
|
|
|
|
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
|
|
|
$pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
|
|
|
|
$show_filetree = $prefs->getPreference($pref_filetree);
|
|
|
|
$collapsed = $prefs->getPreference($pref_collapse);
|
|
|
|
|
|
|
|
if ($changesets && $show_filetree) {
|
2013-01-21 16:45:42 +01:00
|
|
|
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
|
|
|
|
->setAnchorName('top')
|
|
|
|
->setTitle($short_name)
|
|
|
|
->setBaseURI(new PhutilURI('/'.$commit_id))
|
|
|
|
->build($changesets)
|
|
|
|
->setCrumbs($crumbs)
|
2013-02-05 02:00:27 +01:00
|
|
|
->setCollapsed((bool)$collapsed)
|
2013-01-21 16:45:42 +01:00
|
|
|
->appendChild($content);
|
|
|
|
$content = $nav;
|
|
|
|
} else {
|
|
|
|
$content = array($crumbs, $content);
|
|
|
|
}
|
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-13 02:50:42 +01:00
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
2013-01-21 16:45:42 +01:00
|
|
|
$content,
|
2011-03-11 18:34:22 +01:00
|
|
|
array(
|
2013-05-11 17:23:19 +02:00
|
|
|
'title' => $commit_id,
|
2013-05-25 17:46:06 +02:00
|
|
|
'pageObjects' => array($commit->getPHID()),
|
2013-02-19 22:33:10 +01:00
|
|
|
));
|
2011-03-11 18:34:22 +01: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-13 02:50:42 +01:00
|
|
|
private function loadCommitProperties(
|
2011-04-02 02:11:05 +02:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
2012-03-26 21:21:48 +02:00
|
|
|
PhabricatorRepositoryCommitData $data,
|
2013-07-25 00:29:46 +02:00
|
|
|
array $parents,
|
|
|
|
array $audit_requests) {
|
2012-08-08 19:03:41 +02:00
|
|
|
|
2012-04-04 01:22:31 +02:00
|
|
|
assert_instances_of($parents, 'PhabricatorRepositoryCommit');
|
2013-12-05 20:59:41 +01:00
|
|
|
$viewer = $this->getRequest()->getUser();
|
2012-08-08 19:03:41 +02:00
|
|
|
$commit_phid = $commit->getPHID();
|
2013-12-05 20:59:41 +01:00
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$repository = $drequest->getRepository();
|
2012-08-08 19:03:41 +02:00
|
|
|
|
2013-04-15 17:41:41 +02:00
|
|
|
$edge_query = id(new PhabricatorEdgeQuery())
|
2012-08-08 19:03:41 +02:00
|
|
|
->withSourcePHIDs(array($commit_phid))
|
|
|
|
->withEdgeTypes(array(
|
|
|
|
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK,
|
2013-04-13 07:48:16 +02:00
|
|
|
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT,
|
|
|
|
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV,
|
2013-04-15 17:41:41 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
$edges = $edge_query->execute();
|
2012-08-08 19:03:41 +02:00
|
|
|
|
|
|
|
$task_phids = array_keys(
|
2013-02-19 22:33:10 +01:00
|
|
|
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK]);
|
2012-08-08 19:03:41 +02:00
|
|
|
$proj_phids = array_keys(
|
2013-02-19 22:33:10 +01:00
|
|
|
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_PROJECT]);
|
2013-04-13 07:48:16 +02:00
|
|
|
$revision_phid = key(
|
|
|
|
$edges[$commit_phid][PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV]);
|
2012-08-08 19:03:41 +02:00
|
|
|
|
2013-04-15 17:41:41 +02:00
|
|
|
$phids = $edge_query->getDestinationPHIDs(array($commit_phid));
|
|
|
|
|
2011-04-02 02:11:05 +02:00
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
$phids[] = $data->getCommitDetail('authorPHID');
|
|
|
|
}
|
|
|
|
if ($data->getCommitDetail('reviewerPHID')) {
|
|
|
|
$phids[] = $data->getCommitDetail('reviewerPHID');
|
|
|
|
}
|
2012-05-23 17:34:36 +02:00
|
|
|
if ($data->getCommitDetail('committerPHID')) {
|
|
|
|
$phids[] = $data->getCommitDetail('committerPHID');
|
|
|
|
}
|
2012-03-26 21:21:48 +02:00
|
|
|
if ($parents) {
|
|
|
|
foreach ($parents as $parent) {
|
|
|
|
$phids[] = $parent->getPHID();
|
|
|
|
}
|
|
|
|
}
|
2011-04-02 02:11:05 +02:00
|
|
|
|
2013-12-05 20:59:41 +01: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-02 02:11:05 +02:00
|
|
|
$handles = array();
|
|
|
|
if ($phids) {
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2011-04-02 02:11:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$props = array();
|
|
|
|
|
2012-03-30 23:12:10 +02:00
|
|
|
if ($commit->getAuditStatus()) {
|
|
|
|
$status = PhabricatorAuditCommitStatusConstants::getStatusName(
|
|
|
|
$commit->getAuditStatus());
|
2013-07-25 00:29:46 +02:00
|
|
|
$tag = id(new PhabricatorTagView())
|
|
|
|
->setType(PhabricatorTagView::TYPE_STATE)
|
|
|
|
->setName($status);
|
|
|
|
|
|
|
|
switch ($commit->getAuditStatus()) {
|
|
|
|
case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT:
|
|
|
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_ORANGE);
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED:
|
|
|
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_RED);
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditCommitStatusConstants::PARTIALLY_AUDITED:
|
|
|
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_BLUE);
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED:
|
|
|
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$props['Status'] = $tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($audit_requests) {
|
2013-10-05 16:54:42 +02:00
|
|
|
$user_requests = array();
|
|
|
|
$other_requests = array();
|
|
|
|
foreach ($audit_requests as $audit_request) {
|
|
|
|
if ($audit_request->isUser()) {
|
|
|
|
$user_requests[] = $audit_request;
|
|
|
|
} else {
|
|
|
|
$other_requests[] = $audit_request;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($user_requests) {
|
|
|
|
$props['Auditors'] = $this->renderAuditStatusView(
|
|
|
|
$user_requests);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($other_requests) {
|
|
|
|
$props['Project/Package Auditors'] = $this->renderAuditStatusView(
|
|
|
|
$other_requests);
|
|
|
|
}
|
2012-03-30 23:12:10 +02:00
|
|
|
}
|
|
|
|
|
2013-12-07 20:12:38 +01:00
|
|
|
$author_phid = $data->getCommitDetail('authorPHID');
|
|
|
|
$author_name = $data->getAuthorName();
|
|
|
|
|
2013-12-05 20:59:41 +01:00
|
|
|
if (!$repository->isSVN()) {
|
|
|
|
$authored_info = id(new PHUIStatusItemView());
|
|
|
|
// TODO: In Git, a distinct authorship date is available. When present,
|
|
|
|
// we should show it here.
|
|
|
|
|
|
|
|
if ($author_phid) {
|
|
|
|
$authored_info->setTarget($handles[$author_phid]->renderLink());
|
|
|
|
} else if (strlen($author_name)) {
|
|
|
|
$authored_info->setTarget($author_name);
|
|
|
|
}
|
2012-03-30 23:12:10 +02:00
|
|
|
|
2013-12-05 20:59:41 +01:00
|
|
|
$props['Authored'] = id(new PHUIStatusListView())
|
|
|
|
->addItem($authored_info);
|
2011-04-02 02:11:05 +02:00
|
|
|
}
|
|
|
|
|
2013-12-05 20:59:41 +01: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-02 02:11:05 +02:00
|
|
|
}
|
|
|
|
|
2013-12-12 05:15:26 +01:00
|
|
|
$props['Committed'] = id(new PHUIStatusListView())
|
2013-12-05 20:59:41 +01:00
|
|
|
->addItem($committed_info);
|
|
|
|
|
|
|
|
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 17:34:36 +02:00
|
|
|
}
|
2013-12-05 20:59:41 +01:00
|
|
|
|
|
|
|
$props['Pushed'] = $pushed_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
$reviewer_phid = $data->getCommitDetail('reviewerPHID');
|
|
|
|
if ($reviewer_phid) {
|
|
|
|
$props['Reviewer'] = $handles[$reviewer_phid]->renderLink();
|
2012-05-23 17:34:36 +02:00
|
|
|
}
|
|
|
|
|
2011-04-02 02:11:05 +02:00
|
|
|
if ($revision_phid) {
|
|
|
|
$props['Differential Revision'] = $handles[$revision_phid]->renderLink();
|
|
|
|
}
|
|
|
|
|
2012-03-26 21:21:48 +02:00
|
|
|
if ($parents) {
|
|
|
|
$parent_links = array();
|
|
|
|
foreach ($parents as $parent) {
|
|
|
|
$parent_links[] = $handles[$parent->getPHID()]->renderLink();
|
|
|
|
}
|
2013-02-13 23:50:15 +01:00
|
|
|
$props['Parents'] = phutil_implode_html(" \xC2\xB7 ", $parent_links);
|
2012-03-26 21:21:48 +02:00
|
|
|
}
|
|
|
|
|
2013-01-31 18:08:02 +01:00
|
|
|
$props['Branches'] = phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'id' => 'commit-branches',
|
|
|
|
),
|
2013-05-11 17:23:19 +02:00
|
|
|
pht('Unknown'));
|
2013-01-31 18:08:02 +01:00
|
|
|
$props['Tags'] = phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'id' => 'commit-tags',
|
|
|
|
),
|
2013-05-11 17:23:19 +02:00
|
|
|
pht('Unknown'));
|
2012-01-19 20:49:51 +01:00
|
|
|
|
2013-12-05 20:59:41 +01:00
|
|
|
$callsign = $repository->getCallsign();
|
2012-08-01 01:27:48 +02:00
|
|
|
$root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier();
|
|
|
|
Javelin::initBehavior(
|
|
|
|
'diffusion-commit-branches',
|
|
|
|
array(
|
|
|
|
$root.'/branches/' => 'commit-branches',
|
|
|
|
$root.'/tags/' => 'commit-tags',
|
|
|
|
));
|
2012-04-24 03:36:25 +02:00
|
|
|
|
2013-12-05 20:59:41 +01:00
|
|
|
$refs = $this->buildRefs($drequest);
|
2012-04-25 16:21:03 +02:00
|
|
|
if ($refs) {
|
2012-06-29 23:14:02 +02:00
|
|
|
$props['References'] = $refs;
|
2012-04-25 16:21:03 +02:00
|
|
|
}
|
|
|
|
|
2012-04-05 02:34:25 +02:00
|
|
|
if ($task_phids) {
|
|
|
|
$task_list = array();
|
|
|
|
foreach ($task_phids as $phid) {
|
|
|
|
$task_list[] = $handles[$phid]->renderLink();
|
|
|
|
}
|
2013-02-13 23:50:15 +01:00
|
|
|
$task_list = phutil_implode_html(phutil_tag('br'), $task_list);
|
2012-04-05 02:34:25 +02:00
|
|
|
$props['Tasks'] = $task_list;
|
|
|
|
}
|
|
|
|
|
2012-08-08 19:03:41 +02:00
|
|
|
if ($proj_phids) {
|
|
|
|
$proj_list = array();
|
|
|
|
foreach ($proj_phids as $phid) {
|
|
|
|
$proj_list[] = $handles[$phid]->renderLink();
|
|
|
|
}
|
2013-02-13 23:50:15 +01:00
|
|
|
$proj_list = phutil_implode_html(phutil_tag('br'), $proj_list);
|
2012-08-08 19:03:41 +02:00
|
|
|
$props['Projects'] = $proj_list;
|
|
|
|
}
|
|
|
|
|
2012-03-30 23:12:10 +02:00
|
|
|
return $props;
|
2011-04-02 02:11:05 +02:00
|
|
|
}
|
|
|
|
|
2012-04-04 01:22:31 +02:00
|
|
|
private function buildComments(PhabricatorRepositoryCommit $commit) {
|
2012-02-24 23:14:39 +01:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
$comments = id(new PhabricatorAuditComment())->loadAllWhere(
|
|
|
|
'targetPHID = %s ORDER BY dateCreated ASC',
|
|
|
|
$commit->getPHID());
|
|
|
|
|
2012-03-20 03:56:06 +01:00
|
|
|
$inlines = id(new PhabricatorAuditInlineComment())->loadAllWhere(
|
|
|
|
'commitPHID = %s AND auditCommentID IS NOT NULL',
|
|
|
|
$commit->getPHID());
|
|
|
|
|
|
|
|
$path_ids = mpull($inlines, 'getPathID');
|
|
|
|
|
|
|
|
$path_map = array();
|
|
|
|
if ($path_ids) {
|
|
|
|
$path_map = id(new DiffusionPathQuery())
|
|
|
|
->withPathIDs($path_ids)
|
|
|
|
->execute();
|
|
|
|
$path_map = ipull($path_map, 'path', 'id');
|
|
|
|
}
|
|
|
|
|
2012-10-24 02:46:44 +02:00
|
|
|
$engine = new PhabricatorMarkupEngine();
|
|
|
|
$engine->setViewer($user);
|
|
|
|
|
|
|
|
foreach ($comments as $comment) {
|
|
|
|
$engine->addObject(
|
|
|
|
$comment,
|
|
|
|
PhabricatorAuditComment::MARKUP_FIELD_BODY);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($inlines as $inline) {
|
|
|
|
$engine->addObject(
|
|
|
|
$inline,
|
|
|
|
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
|
|
|
|
}
|
|
|
|
|
|
|
|
$engine->process();
|
|
|
|
|
2012-02-24 23:14:39 +01:00
|
|
|
$view = new DiffusionCommentListView();
|
2012-10-24 02:46:44 +02:00
|
|
|
$view->setMarkupEngine($engine);
|
2012-02-24 23:14:39 +01:00
|
|
|
$view->setUser($user);
|
|
|
|
$view->setComments($comments);
|
2012-03-20 03:56:06 +01:00
|
|
|
$view->setInlineComments($inlines);
|
|
|
|
$view->setPathMap($path_map);
|
2012-02-24 23:14:39 +01:00
|
|
|
|
|
|
|
$phids = $view->getRequiredHandlePHIDs();
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2012-02-24 23:14:39 +01:00
|
|
|
$view->setHandles($handles);
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
2012-07-23 18:15:10 +02:00
|
|
|
private function renderAddCommentPanel(
|
2012-04-04 01:22:31 +02:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
2013-01-30 21:01:07 +01:00
|
|
|
array $audit_requests) {
|
2012-04-04 01:22:31 +02:00
|
|
|
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
2013-09-27 19:49:45 +02:00
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
if (!$user->isLoggedIn()) {
|
|
|
|
return id(new PhabricatorApplicationTransactionCommentView())
|
|
|
|
->setUser($user)
|
|
|
|
->setRequestURI($request->getRequestURI());
|
|
|
|
}
|
2012-02-25 00:04:53 +01:00
|
|
|
|
|
|
|
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
|
|
|
|
2013-01-30 21:01:07 +01:00
|
|
|
$pane_id = celerity_generate_unique_node_id();
|
2012-03-19 03:44:28 +01:00
|
|
|
Javelin::initBehavior(
|
|
|
|
'differential-keyboard-navigation',
|
|
|
|
array(
|
2012-07-23 18:15:10 +02:00
|
|
|
'haunt' => $pane_id,
|
2012-03-19 03:44:28 +01:00
|
|
|
));
|
|
|
|
|
2012-02-27 22:00:23 +01:00
|
|
|
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
|
|
|
'authorPHID = %s AND draftKey = %s',
|
|
|
|
$user->getPHID(),
|
|
|
|
'diffusion-audit-'.$commit->getID());
|
|
|
|
if ($draft) {
|
|
|
|
$draft = $draft->getDraft();
|
|
|
|
} else {
|
|
|
|
$draft = null;
|
|
|
|
}
|
|
|
|
|
2012-03-26 18:44:06 +02:00
|
|
|
$actions = $this->getAuditActions($commit, $audit_requests);
|
|
|
|
|
2012-02-25 00:04:53 +01:00
|
|
|
$form = id(new AphrontFormView())
|
|
|
|
->setUser($user)
|
|
|
|
->setAction('/audit/addcomment/')
|
|
|
|
->addHiddenInput('commit', $commit->getPHID())
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSelectControl())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setLabel(pht('Action'))
|
2012-02-25 00:04:53 +01:00
|
|
|
->setName('action')
|
2012-02-27 22:00:23 +01:00
|
|
|
->setID('audit-action')
|
2012-03-26 18:44:06 +02:00
|
|
|
->setOptions($actions))
|
2012-04-23 22:50:04 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTokenizerControl())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setLabel(pht('Add Auditors'))
|
2012-04-23 22:50:04 +02:00
|
|
|
->setName('auditors')
|
|
|
|
->setControlID('add-auditors')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setID('add-auditors-tokenizer')
|
|
|
|
->setDisableBehavior(true))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTokenizerControl())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setLabel(pht('Add CCs'))
|
2012-04-23 22:50:04 +02:00
|
|
|
->setName('ccs')
|
|
|
|
->setControlID('add-ccs')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setID('add-ccs-tokenizer')
|
|
|
|
->setDisableBehavior(true))
|
2012-02-25 00:04:53 +01:00
|
|
|
->appendChild(
|
2012-09-19 21:27:28 +02:00
|
|
|
id(new PhabricatorRemarkupControl())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setLabel(pht('Comments'))
|
2012-02-25 00:04:53 +01:00
|
|
|
->setName('content')
|
2012-02-27 22:00:23 +01:00
|
|
|
->setValue($draft)
|
2012-11-27 23:06:31 +01:00
|
|
|
->setID('audit-content')
|
|
|
|
->setUser($user))
|
2012-02-25 00:04:53 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setValue($is_serious ? pht('Submit') : pht('Cook the Books')));
|
2012-02-25 00:04:53 +01:00
|
|
|
|
2013-09-17 18:12:37 +02:00
|
|
|
$header = new PHUIHeaderView();
|
2013-05-18 19:49:37 +02:00
|
|
|
$header->setHeader(
|
2013-05-11 17:23:19 +02:00
|
|
|
$is_serious ? pht('Audit Commit') : pht('Creative Accounting'));
|
2012-02-25 00:04:53 +01:00
|
|
|
|
2012-02-27 22:00:23 +01:00
|
|
|
require_celerity_resource('phabricator-transaction-view-css');
|
|
|
|
|
2012-04-23 22:50:04 +02:00
|
|
|
Javelin::initBehavior(
|
|
|
|
'differential-add-reviewers-and-ccs',
|
|
|
|
array(
|
|
|
|
'dynamic' => array(
|
|
|
|
'add-auditors-tokenizer' => array(
|
|
|
|
'actions' => array('add_auditors' => 1),
|
|
|
|
'src' => '/typeahead/common/users/',
|
|
|
|
'row' => 'add-auditors',
|
|
|
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
2013-05-11 17:23:19 +02:00
|
|
|
'placeholder' => pht('Type a user name...'),
|
2012-04-23 22:50:04 +02:00
|
|
|
),
|
|
|
|
'add-ccs-tokenizer' => array(
|
|
|
|
'actions' => array('add_ccs' => 1),
|
|
|
|
'src' => '/typeahead/common/mailable/',
|
|
|
|
'row' => 'add-ccs',
|
|
|
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
2013-05-11 17:23:19 +02:00
|
|
|
'placeholder' => pht('Type a user or mailing list...'),
|
2012-04-23 22:50:04 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
'select' => 'audit-action',
|
|
|
|
));
|
|
|
|
|
|
|
|
Javelin::initBehavior('differential-feedback-preview', array(
|
2012-02-27 22:00:23 +01:00
|
|
|
'uri' => '/audit/preview/'.$commit->getID().'/',
|
|
|
|
'preview' => 'audit-preview',
|
|
|
|
'content' => 'audit-content',
|
|
|
|
'action' => 'audit-action',
|
2012-04-23 22:50:04 +02:00
|
|
|
'previewTokenizers' => array(
|
|
|
|
'auditors' => 'add-auditors-tokenizer',
|
|
|
|
'ccs' => 'add-ccs-tokenizer',
|
|
|
|
),
|
2012-07-23 20:01:28 +02:00
|
|
|
'inline' => 'inline-comment-preview',
|
|
|
|
'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/',
|
2012-02-27 22:00:23 +01:00
|
|
|
));
|
|
|
|
|
2013-11-11 18:23:23 +01:00
|
|
|
$loading = phutil_tag_div(
|
|
|
|
'aphront-panel-preview-loading-text',
|
|
|
|
pht('Loading preview...'));
|
|
|
|
|
|
|
|
$preview_panel = phutil_tag_div(
|
|
|
|
'aphront-panel-preview aphront-panel-flush',
|
|
|
|
array(
|
|
|
|
phutil_tag('div', array('id' => 'audit-preview'), $loading),
|
|
|
|
phutil_tag('div', array('id' => 'inline-comment-preview'))
|
|
|
|
));
|
2012-02-27 22:00:23 +01:00
|
|
|
|
2013-01-30 21:01:07 +01:00
|
|
|
// TODO: This is pretty awkward, unify the CSS between Diffusion and
|
|
|
|
// Differential better.
|
|
|
|
require_celerity_resource('differential-core-view-css');
|
|
|
|
|
2013-11-11 18:23:23 +01:00
|
|
|
$anchor = id(new PhabricatorAnchorView())
|
|
|
|
->setAnchorName('comment')
|
|
|
|
->setNavigationMarker(true)
|
|
|
|
->render();
|
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
$comment_box = id(new PHUIObjectBoxView())
|
|
|
|
->setHeader($header)
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
->appendChild($form);
|
2013-09-29 00:55:38 +02:00
|
|
|
|
2013-02-13 23:50:15 +01:00
|
|
|
return phutil_tag(
|
2013-01-30 21:01:07 +01:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'id' => $pane_id,
|
|
|
|
),
|
2013-11-11 18:23:23 +01:00
|
|
|
phutil_tag_div(
|
|
|
|
'differential-add-comment-panel',
|
|
|
|
array($anchor, $comment_box, $preview_panel)));
|
2012-02-25 00:04:53 +01:00
|
|
|
}
|
|
|
|
|
2012-03-26 18:44:06 +02:00
|
|
|
/**
|
|
|
|
* Return a map of available audit actions for rendering into a <select />.
|
|
|
|
* This shows the user valid actions, and does not show nonsense/invalid
|
|
|
|
* actions (like closing an already-closed commit, or resigning from a commit
|
|
|
|
* you have no association with).
|
|
|
|
*/
|
|
|
|
private function getAuditActions(
|
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
array $audit_requests) {
|
2012-04-04 01:22:31 +02:00
|
|
|
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
2012-03-26 18:44:06 +02:00
|
|
|
$user = $this->getRequest()->getUser();
|
|
|
|
|
|
|
|
$user_is_author = ($commit->getAuthorPHID() == $user->getPHID());
|
|
|
|
|
|
|
|
$user_request = null;
|
|
|
|
foreach ($audit_requests as $audit_request) {
|
|
|
|
if ($audit_request->getAuditorPHID() == $user->getPHID()) {
|
|
|
|
$user_request = $audit_request;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$actions = array();
|
|
|
|
$actions[PhabricatorAuditActionConstants::COMMENT] = true;
|
2012-04-23 22:50:04 +02:00
|
|
|
$actions[PhabricatorAuditActionConstants::ADD_CCS] = true;
|
|
|
|
$actions[PhabricatorAuditActionConstants::ADD_AUDITORS] = true;
|
2012-03-26 18:44:06 +02:00
|
|
|
|
|
|
|
// We allow you to accept your own commits. A use case here is that you
|
|
|
|
// notice an issue with your own commit and "Raise Concern" as an indicator
|
|
|
|
// to other auditors that you're on top of the issue, then later resolve it
|
|
|
|
// and "Accept". You can not accept on behalf of projects or packages,
|
|
|
|
// however.
|
|
|
|
$actions[PhabricatorAuditActionConstants::ACCEPT] = true;
|
|
|
|
$actions[PhabricatorAuditActionConstants::CONCERN] = true;
|
|
|
|
|
|
|
|
|
|
|
|
// To resign, a user must have authority on some request and not be the
|
|
|
|
// commit's author.
|
|
|
|
if (!$user_is_author) {
|
|
|
|
$may_resign = false;
|
2012-05-07 22:37:41 +02:00
|
|
|
|
|
|
|
$authority_map = array_fill_keys($this->auditAuthorityPHIDs, true);
|
2012-03-26 18:44:06 +02:00
|
|
|
foreach ($audit_requests as $request) {
|
2012-05-07 22:37:41 +02:00
|
|
|
if (empty($authority_map[$request->getAuditorPHID()])) {
|
2012-03-26 18:44:06 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$may_resign = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the user has already resigned, don't show "Resign...".
|
|
|
|
$status_resigned = PhabricatorAuditStatusConstants::RESIGNED;
|
|
|
|
if ($user_request) {
|
|
|
|
if ($user_request->getAuditStatus() == $status_resigned) {
|
|
|
|
$may_resign = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($may_resign) {
|
|
|
|
$actions[PhabricatorAuditActionConstants::RESIGN] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$status_concern = PhabricatorAuditCommitStatusConstants::CONCERN_RAISED;
|
|
|
|
$concern_raised = ($commit->getAuditStatus() == $status_concern);
|
2013-01-19 02:53:52 +01:00
|
|
|
$can_close_option = PhabricatorEnv::getEnvConfig(
|
|
|
|
'audit.can-author-close-audit');
|
|
|
|
if ($can_close_option && $user_is_author && $concern_raised) {
|
2012-03-26 18:44:06 +02:00
|
|
|
$actions[PhabricatorAuditActionConstants::CLOSE] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($actions as $constant => $ignored) {
|
|
|
|
$actions[$constant] =
|
|
|
|
PhabricatorAuditActionConstants::getActionName($constant);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $actions;
|
|
|
|
}
|
|
|
|
|
2012-03-23 23:32:26 +01:00
|
|
|
private function buildMergesTable(PhabricatorRepositoryCommit $commit) {
|
|
|
|
$drequest = $this->getDiffusionRequest();
|
|
|
|
$limit = 50;
|
|
|
|
|
2013-05-21 02:04:51 +02:00
|
|
|
$merges = array();
|
|
|
|
try {
|
|
|
|
$merges = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.mergedcommitsquery',
|
|
|
|
array(
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
'limit' => $limit + 1));
|
|
|
|
} catch (ConduitException $ex) {
|
|
|
|
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
|
|
|
throw $ex;
|
|
|
|
}
|
|
|
|
}
|
2012-03-23 23:32:26 +01:00
|
|
|
|
|
|
|
if (!$merges) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$caption = null;
|
|
|
|
if (count($merges) > $limit) {
|
|
|
|
$merges = array_slice($merges, 0, $limit);
|
|
|
|
$caption =
|
|
|
|
"This commit merges more than {$limit} changes. Only the first ".
|
|
|
|
"{$limit} are shown.";
|
|
|
|
}
|
|
|
|
|
|
|
|
$history_table = new DiffusionHistoryTableView();
|
2012-12-21 00:04:20 +01:00
|
|
|
$history_table->setUser($this->getRequest()->getUser());
|
2012-03-23 23:32:26 +01:00
|
|
|
$history_table->setDiffusionRequest($drequest);
|
|
|
|
$history_table->setHistory($merges);
|
2012-06-23 01:52:08 +02:00
|
|
|
$history_table->loadRevisions();
|
2012-03-23 23:32:26 +01:00
|
|
|
|
|
|
|
$phids = $history_table->getRequiredHandlePHIDs();
|
2012-09-05 04:02:56 +02:00
|
|
|
$handles = $this->loadViewerHandles($phids);
|
2012-03-23 23:32:26 +01:00
|
|
|
$history_table->setHandles($handles);
|
|
|
|
|
|
|
|
$panel = new AphrontPanelView();
|
2013-05-11 17:23:19 +02:00
|
|
|
$panel->setHeader(pht('Merged Changes'));
|
2012-03-23 23:32:26 +01:00
|
|
|
$panel->setCaption($caption);
|
|
|
|
$panel->appendChild($history_table);
|
2013-01-16 00:05:15 +01:00
|
|
|
$panel->setNoBackground();
|
2012-03-23 23:32:26 +01:00
|
|
|
|
|
|
|
return $panel;
|
|
|
|
}
|
|
|
|
|
2012-03-30 23:12:10 +02:00
|
|
|
private function renderHeadsupActionList(
|
2012-08-08 19:03:41 +02:00
|
|
|
PhabricatorRepositoryCommit $commit,
|
|
|
|
PhabricatorRepository $repository) {
|
2012-03-30 23:12:10 +02:00
|
|
|
|
2012-05-02 22:43:45 +02:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
2012-03-30 23:12:10 +02: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-13 02:50:42 +01:00
|
|
|
$actions = id(new PhabricatorActionListView())
|
|
|
|
->setUser($user)
|
2013-07-12 20:39:47 +02:00
|
|
|
->setObject($commit)
|
|
|
|
->setObjectURI($request->getRequestURI());
|
2012-03-30 23:12:10 +02:00
|
|
|
|
2013-09-27 19:49:45 +02:00
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$user,
|
|
|
|
$commit,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
|
|
|
$uri = '/diffusion/'.$repository->getCallsign().'/commit/'.
|
2012-08-08 19:03:41 +02:00
|
|
|
$commit->getCommitIdentifier().'/edit/';
|
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-13 02:50:42 +01:00
|
|
|
|
|
|
|
$action = id(new PhabricatorActionView())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setName(pht('Edit Commit'))
|
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-13 02:50:42 +01:00
|
|
|
->setHref($uri)
|
2013-09-27 19:49:45 +02:00
|
|
|
->setIcon('edit')
|
|
|
|
->setDisabled(!$can_edit)
|
|
|
|
->setWorkflow(!$can_edit);
|
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-13 02:50:42 +01:00
|
|
|
$actions->addAction($action);
|
2012-03-30 23:12:10 +02:00
|
|
|
|
|
|
|
require_celerity_resource('phabricator-object-selector-css');
|
|
|
|
require_celerity_resource('javelin-behavior-phabricator-object-selector');
|
|
|
|
|
2013-04-06 20:39:59 +02:00
|
|
|
$maniphest = 'PhabricatorApplicationManiphest';
|
|
|
|
if (PhabricatorApplication::isClassInstalled($maniphest)) {
|
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-13 02:50:42 +01:00
|
|
|
$action = id(new PhabricatorActionView())
|
2013-05-11 17:23:19 +02:00
|
|
|
->setName(pht('Edit Maniphest Tasks'))
|
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-13 02:50:42 +01:00
|
|
|
->setIcon('attach')
|
|
|
|
->setHref('/search/attach/'.$commit->getPHID().'/TASK/edge/')
|
2013-09-27 19:49:45 +02:00
|
|
|
->setWorkflow(true)
|
|
|
|
->setDisabled(!$can_edit);
|
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-13 02:50:42 +01:00
|
|
|
$actions->addAction($action);
|
2012-11-02 01:36:04 +01:00
|
|
|
}
|
2012-03-30 23:12:10 +02: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-13 02:50:42 +01:00
|
|
|
$action = id(new PhabricatorActionView())
|
2013-05-11 17:23:19 +02: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-13 02:50:42 +01:00
|
|
|
->setHref($request->getRequestURI()->alter('diff', true))
|
|
|
|
->setIcon('download');
|
|
|
|
$actions->addAction($action);
|
2012-03-30 23:12:10 +02: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-13 02:50:42 +01:00
|
|
|
return $actions;
|
2012-03-30 23:12:10 +02:00
|
|
|
}
|
|
|
|
|
2012-04-25 16:21:03 +02:00
|
|
|
private function buildRefs(DiffusionRequest $request) {
|
2013-05-17 23:13:48 +02:00
|
|
|
// this is git-only, so save a conduit round trip and just get out of
|
|
|
|
// here if the repository isn't git
|
2012-04-25 16:21:03 +02:00
|
|
|
$type_git = PhabricatorRepositoryType::REPOSITORY_TYPE_GIT;
|
|
|
|
$repository = $request->getRepository();
|
|
|
|
if ($repository->getVersionControlSystem() != $type_git) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-05-17 23:13:48 +02:00
|
|
|
$results = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.refsquery',
|
|
|
|
array('commit' => $request->getCommit()));
|
2012-06-29 23:14:02 +02:00
|
|
|
$ref_links = array();
|
2013-05-17 23:13:48 +02:00
|
|
|
foreach ($results as $ref_data) {
|
|
|
|
$ref_links[] = phutil_tag('a',
|
|
|
|
array('href' => $ref_data['href']),
|
|
|
|
$ref_data['ref']);
|
2012-06-29 23:14:02 +02:00
|
|
|
}
|
2013-02-13 23:50:15 +01:00
|
|
|
return phutil_implode_html(', ', $ref_links);
|
2012-04-25 16:21:03 +02:00
|
|
|
}
|
|
|
|
|
2012-05-02 22:43:45 +02:00
|
|
|
private function buildRawDiffResponse(DiffusionRequest $drequest) {
|
2013-05-14 22:53:32 +02:00
|
|
|
$raw_diff = $this->callConduitWithDiffusionRequest(
|
|
|
|
'diffusion.rawdiffquery',
|
|
|
|
array(
|
|
|
|
'commit' => $drequest->getCommit(),
|
|
|
|
'path' => $drequest->getPath()));
|
2012-05-02 22:43:45 +02:00
|
|
|
|
2012-07-09 19:38:25 +02:00
|
|
|
$file = PhabricatorFile::buildFromFileDataOrHash(
|
|
|
|
$raw_diff,
|
|
|
|
array(
|
|
|
|
'name' => $drequest->getCommit().'.diff',
|
2013-12-30 20:27:02 +01:00
|
|
|
'ttl' => (60 * 60 * 24),
|
|
|
|
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
|
2012-07-09 19:38:25 +02:00
|
|
|
));
|
2012-05-02 22:43:45 +02:00
|
|
|
|
2013-12-30 20:27:02 +01:00
|
|
|
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
|
|
|
$file->attachToObject(
|
|
|
|
$this->getRequest()->getUser(),
|
|
|
|
$drequest->getRepository()->getPHID());
|
|
|
|
unset($unguarded);
|
|
|
|
|
2012-05-02 22:43:45 +02:00
|
|
|
return id(new AphrontRedirectResponse())->setURI($file->getBestURI());
|
|
|
|
}
|
|
|
|
|
2013-07-25 00:29:46 +02:00
|
|
|
private function renderAuditStatusView(array $audit_requests) {
|
|
|
|
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
|
|
|
|
|
|
|
$phids = mpull($audit_requests, 'getAuditorPHID');
|
|
|
|
$this->loadHandles($phids);
|
|
|
|
|
|
|
|
$authority_map = array_fill_keys($this->auditAuthorityPHIDs, true);
|
|
|
|
|
|
|
|
$view = new PHUIStatusListView();
|
|
|
|
foreach ($audit_requests as $request) {
|
|
|
|
$item = new PHUIStatusItemView();
|
|
|
|
|
|
|
|
switch ($request->getAuditStatus()) {
|
|
|
|
case PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED:
|
|
|
|
$item->setIcon('open-blue', pht('Commented'));
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::AUDIT_REQUIRED:
|
|
|
|
$item->setIcon('warning-blue', pht('Audit Required'));
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::CONCERNED:
|
|
|
|
$item->setIcon('reject-red', pht('Concern Raised'));
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::ACCEPTED:
|
|
|
|
$item->setIcon('accept-green', pht('Accepted'));
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::AUDIT_REQUESTED:
|
|
|
|
$item->setIcon('warning-dark', pht('Audit Requested'));
|
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::RESIGNED:
|
2013-10-05 03:31:41 +02:00
|
|
|
$item->setIcon('open-dark', pht('Resigned'));
|
2013-07-25 00:29:46 +02:00
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::CLOSED:
|
2013-10-05 03:31:41 +02:00
|
|
|
$item->setIcon('accept-blue', pht('Closed'));
|
2013-07-25 00:29:46 +02:00
|
|
|
break;
|
|
|
|
case PhabricatorAuditStatusConstants::CC:
|
|
|
|
$item->setIcon('info-dark', pht('Subscribed'));
|
|
|
|
break;
|
2013-10-05 16:54:42 +02:00
|
|
|
default:
|
|
|
|
$item->setIcon(
|
|
|
|
'question-dark',
|
|
|
|
pht('%s?', $request->getAuditStatus()));
|
|
|
|
break;
|
2013-07-25 00:29:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$note = array();
|
|
|
|
foreach ($request->getAuditReasons() as $reason) {
|
|
|
|
$note[] = phutil_tag('div', array(), $reason);
|
|
|
|
}
|
|
|
|
$item->setNote($note);
|
|
|
|
|
|
|
|
$auditor_phid = $request->getAuditorPHID();
|
|
|
|
$target = $this->getHandle($auditor_phid)->renderLink();
|
|
|
|
$item->setTarget($target);
|
|
|
|
|
|
|
|
if (isset($authority_map[$auditor_phid])) {
|
|
|
|
$item->setHighlighted(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
$view->addItem($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
2013-09-18 19:13:00 +02: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);
|
|
|
|
}
|
|
|
|
|
2013-10-27 03:16:10 +01:00
|
|
|
|
2011-03-11 18:34:22 +01:00
|
|
|
}
|