2012-08-02 14:07:21 -07:00
|
|
|
<?php
|
|
|
|
|
|
2014-07-23 10:03:09 +10:00
|
|
|
final class PhabricatorDiffusionApplication extends PhabricatorApplication {
|
2012-08-02 14:07:21 -07:00
|
|
|
|
2014-07-23 23:52:50 +10:00
|
|
|
public function getName() {
|
|
|
|
|
return pht('Diffusion');
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-02 14:07:21 -07:00
|
|
|
public function getShortDescription() {
|
2014-05-29 12:17:54 -07:00
|
|
|
return pht('Host and Browse Repositories');
|
2012-08-02 14:07:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getBaseURI() {
|
|
|
|
|
return '/diffusion/';
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-28 08:40:22 -08:00
|
|
|
public function getIcon() {
|
2015-01-26 08:19:22 -08:00
|
|
|
return 'fa-code';
|
2015-01-24 23:41:43 -08:00
|
|
|
}
|
|
|
|
|
|
(Redesign) Clean up older "Tile" code
Summary:
This does some backend cleanup of the tile stuff, and some general cleanup of other application things:
- Users who haven't customized preferences get a small, specific set of pinned applications: Differential, Maniphest, Diffusion, Audit, Phriction, Projects (and, for administrators, Auth, Config and People).
- Old tile size methods are replaced with `isPinnnedByDefault()`.
- Shortened some short descriptions.
- `shouldAppearInLaunchView()` replaced by less ambiguous `isLaunchable()`.
- Added a marker for third-party / extension applications.
Test Plan: Faked away my preferences and viewed the home page, saw a smaller set of default pins.
Reviewers: chad
Reviewed By: chad
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D9358
2014-06-03 15:47:27 -07:00
|
|
|
public function isPinnedByDefault(PhabricatorUser $viewer) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 08:13:12 -07:00
|
|
|
public function getHelpDocumentationArticles(PhabricatorUser $viewer) {
|
|
|
|
|
return array(
|
|
|
|
|
array(
|
|
|
|
|
'name' => pht('Diffusion User Guide'),
|
|
|
|
|
'href' => PhabricatorEnv::getDoclink('Diffusion User Guide'),
|
|
|
|
|
),
|
2017-01-11 15:09:57 -08:00
|
|
|
array(
|
|
|
|
|
'name' => pht('Audit User Guide'),
|
|
|
|
|
'href' => PhabricatorEnv::getDoclink('Audit User Guide'),
|
|
|
|
|
),
|
2015-04-01 08:13:12 -07:00
|
|
|
);
|
2012-08-13 15:28:41 -07:00
|
|
|
}
|
|
|
|
|
|
2013-02-27 08:04:54 -08:00
|
|
|
public function getRemarkupRules() {
|
|
|
|
|
return array(
|
2013-12-31 11:08:08 -08:00
|
|
|
new DiffusionCommitRemarkupRule(),
|
2015-01-01 08:07:26 -08:00
|
|
|
new DiffusionRepositoryRemarkupRule(),
|
|
|
|
|
new DiffusionRepositoryByIDRemarkupRule(),
|
2013-02-27 08:04:54 -08:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-05 14:03:39 -07:00
|
|
|
public function getRoutes() {
|
2016-11-13 11:49:50 -08:00
|
|
|
$repository_routes = array(
|
|
|
|
|
'/' => array(
|
|
|
|
|
'' => 'DiffusionRepositoryController',
|
|
|
|
|
'repository/(?P<dblob>.*)' => 'DiffusionRepositoryController',
|
|
|
|
|
'change/(?P<dblob>.*)' => 'DiffusionChangeController',
|
2017-07-10 20:20:09 -07:00
|
|
|
'clone/' => 'DiffusionCloneController',
|
2016-11-13 11:49:50 -08:00
|
|
|
'history/(?P<dblob>.*)' => 'DiffusionHistoryController',
|
2017-06-18 09:53:43 +02:00
|
|
|
'graph/(?P<dblob>.*)' => 'DiffusionGraphController',
|
2016-11-13 11:49:50 -08:00
|
|
|
'browse/(?P<dblob>.*)' => 'DiffusionBrowseController',
|
2018-04-05 10:21:48 -07:00
|
|
|
'document/(?P<dblob>.*)'
|
|
|
|
|
=> 'DiffusionDocumentController',
|
2018-04-08 11:38:19 -07:00
|
|
|
'blame/(?P<dblob>.*)'
|
|
|
|
|
=> 'DiffusionBlameController',
|
2016-11-13 11:49:50 -08:00
|
|
|
'lastmodified/(?P<dblob>.*)' => 'DiffusionLastModifiedController',
|
|
|
|
|
'diff/' => 'DiffusionDiffController',
|
|
|
|
|
'tags/(?P<dblob>.*)' => 'DiffusionTagListController',
|
|
|
|
|
'branches/(?P<dblob>.*)' => 'DiffusionBranchTableController',
|
|
|
|
|
'refs/(?P<dblob>.*)' => 'DiffusionRefTableController',
|
|
|
|
|
'lint/(?P<dblob>.*)' => 'DiffusionLintController',
|
2017-10-03 12:50:01 -07:00
|
|
|
'commit/(?P<commit>[a-z0-9]+)' => array(
|
|
|
|
|
'/?' => 'DiffusionCommitController',
|
|
|
|
|
'/branches/' => 'DiffusionCommitBranchesController',
|
|
|
|
|
'/tags/' => 'DiffusionCommitTagsController',
|
|
|
|
|
),
|
Compare two branches
Summary:
This shows the commits list only (Actual `git diff` will show up at a later date).
The inputs are left as text-fields, to allow the form to accept anything that can be resolved. The form is GET, to allow sharing URIs.
The conduit method response array is compatible with that of `diffusion.historyquery`, to make it easy to build
the "history" table.
The hardest part here was, of course, Naming. I think "from" and "onto" are unconfusing, and I'm fairly confident that the "to merge"
instructions are in sync with the actual content of the page.
Test Plan: Look at several "compare" views, with various values of "from" and "onto".
Reviewers: #blessed_reviewers!, epriestley
Subscribers: caov297, 20after4, Sam2304, reardencode, baileyb, chad, Korvin
Maniphest Tasks: T929
Differential Revision: https://secure.phabricator.com/D15330
2016-12-05 16:19:26 -08:00
|
|
|
'compare/' => 'DiffusionCompareController',
|
2016-11-13 11:49:50 -08:00
|
|
|
'manage/(?:(?P<panel>[^/]+)/)?'
|
|
|
|
|
=> 'DiffusionRepositoryManagePanelsController',
|
|
|
|
|
'uri/' => array(
|
|
|
|
|
'view/(?P<id>[0-9]\d*)/' => 'DiffusionRepositoryURIViewController',
|
|
|
|
|
'disable/(?P<id>[0-9]\d*)/'
|
|
|
|
|
=> 'DiffusionRepositoryURIDisableController',
|
|
|
|
|
$this->getEditRoutePattern('edit/')
|
|
|
|
|
=> 'DiffusionRepositoryURIEditController',
|
|
|
|
|
'credential/(?P<id>[0-9]\d*)/(?P<action>edit|remove)/'
|
|
|
|
|
=> 'DiffusionRepositoryURICredentialController',
|
|
|
|
|
),
|
|
|
|
|
'edit/' => array(
|
|
|
|
|
'activate/' => 'DiffusionRepositoryEditActivateController',
|
|
|
|
|
'dangerous/' => 'DiffusionRepositoryEditDangerousController',
|
Prevent enormous changes from being pushed to repositoires by default
Summary:
Fixes T13031. "Enormous" changes are basically changes which are too large to hold in memory, although the actual definition we use today is "more than 1GB of change text or `git diff` runs for more than 15 minutes".
If an install configures a Herald content rule like "when content matches /XYZ/, do something" and then a user pushes a 30 GB source file, we can't put it into memory to `preg_match()` it. Currently, the way to handle this case is to write a separate Herald rule that rejects enormous changes. However, this isn't obvious and means the default behavior is unsafe.
Make the default behavior safe by rejecting these changes with a message, similar to how we reject "dangerous" changes (which permanently delete or overwrite history) by default.
Also, change a couple of UI strings from "Enormous" to "Very Large" to reduce ambiguity. See <https://discourse.phabricator-community.org/t/herald-enormous-check/822>.
Test Plan: Changed the definition of "enormous" from 1GB to 1 byte. Pushed a change; got rejected. Allowed enormous changes, pushed, got rejected by a Herald rule. Disabled the Herald rule, pushed, got a clean push. Prevented enormous changes again. Grepped for "enormous" elsewhere in the UI.
Reviewers: amckinley
Reviewed By: amckinley
Subscribers: joshuaspence
Maniphest Tasks: T13031
Differential Revision: https://secure.phabricator.com/D18850
2017-12-26 10:38:45 -08:00
|
|
|
'enormous/' => 'DiffusionRepositoryEditEnormousController',
|
2016-11-13 11:49:50 -08:00
|
|
|
'delete/' => 'DiffusionRepositoryEditDeleteController',
|
|
|
|
|
'update/' => 'DiffusionRepositoryEditUpdateController',
|
|
|
|
|
'testautomation/' => 'DiffusionRepositoryTestAutomationController',
|
|
|
|
|
),
|
|
|
|
|
'pathtree/(?P<dblob>.*)' => 'DiffusionPathTreeController',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// NOTE: This must come after the rules above; it just gives us a
|
|
|
|
|
// catch-all for serving repositories over HTTP. We must accept requests
|
|
|
|
|
// without the trailing "/" because SVN commands don't necessarily
|
|
|
|
|
// include it.
|
|
|
|
|
'(?:/.*)?' => 'DiffusionRepositoryDefaultController',
|
|
|
|
|
);
|
|
|
|
|
|
2012-08-05 14:03:39 -07:00
|
|
|
return array(
|
2016-01-05 04:42:07 -08:00
|
|
|
'/(?:'.
|
|
|
|
|
'r(?P<repositoryCallsign>[A-Z]+)'.
|
|
|
|
|
'|'.
|
|
|
|
|
'R(?P<repositoryID>[1-9]\d*):'.
|
|
|
|
|
')(?P<commit>[a-f0-9]+)'
|
2012-08-05 14:03:39 -07:00
|
|
|
=> 'DiffusionCommitController',
|
2016-01-05 04:42:07 -08:00
|
|
|
|
2016-11-21 15:41:47 -08:00
|
|
|
'/source/(?P<repositoryShortName>[^/]+)'
|
2016-11-13 11:49:50 -08:00
|
|
|
=> $repository_routes,
|
|
|
|
|
|
2012-08-05 14:03:39 -07:00
|
|
|
'/diffusion/' => array(
|
2016-04-16 16:45:19 -07:00
|
|
|
$this->getQueryRoutePattern()
|
2013-09-10 15:26:08 -07:00
|
|
|
=> 'DiffusionRepositoryListController',
|
2016-05-03 14:26:09 -07:00
|
|
|
$this->getEditRoutePattern('edit/') =>
|
2016-05-09 14:24:21 -07:00
|
|
|
'DiffusionRepositoryEditController',
|
2014-03-26 07:42:30 -07:00
|
|
|
'pushlog/' => array(
|
2018-01-30 07:47:34 -08:00
|
|
|
$this->getQueryRoutePattern() => 'DiffusionPushLogListController',
|
2014-03-26 07:42:30 -07:00
|
|
|
'view/(?P<id>\d+)/' => 'DiffusionPushEventViewController',
|
|
|
|
|
),
|
2018-11-08 10:14:46 -08:00
|
|
|
'synclog/' => array(
|
|
|
|
|
$this->getQueryRoutePattern() => 'DiffusionSyncLogListController',
|
|
|
|
|
),
|
2018-01-22 20:09:52 -08:00
|
|
|
'pulllog/' => array(
|
|
|
|
|
$this->getQueryRoutePattern() => 'DiffusionPullLogListController',
|
|
|
|
|
),
|
2016-11-13 11:49:50 -08:00
|
|
|
'(?P<repositoryCallsign>[A-Z]+)' => $repository_routes,
|
|
|
|
|
'(?P<repositoryID>[1-9]\d*)' => $repository_routes,
|
Accept and route VCS HTTP requests
Summary:
Mostly ripped from D7391, with some changes:
- Serve repositories at `/diffusion/X/`, with no special `/git/` or `/serve/` URI component.
- This requires a little bit of magic, but I got the magic working for Git, Mercurial and SVN, and it seems reasonable.
- I think having one URI for everything will make it easier for users to understand.
- One downside is that git will clone into `X` by default, but I think that's not a big deal, and we can work around that in the future easily enough.
- Accept HTTP requests for Git, SVN and Mercurial repositories.
- Auth logic is a little different in order to be more consistent with how other things work.
- Instead of AphrontBasicAuthResponse, added "VCSResponse". Mercurial can print strings we send it on the CLI if we're careful, so support that. I did a fair amount of digging and didn't have any luck with git or svn.
- Commands we don't know about are assumed to require "Push" capability by default.
No actual VCS data going over the wire yet.
Test Plan:
Ran a bunch of stuff like this:
$ hg clone http://local.aphront.com:8080/diffusion/P/
abort: HTTP Error 403: This repository is not available over HTTP.
...and got pretty reasonable-seeming errors in all cases. All this can do is produce errors for now.
Reviewers: hach-que, btrahan
Reviewed By: hach-que
CC: aran
Maniphest Tasks: T2230
Differential Revision: https://secure.phabricator.com/D7417
2013-10-26 07:56:17 -07:00
|
|
|
|
2018-05-04 20:05:41 -07:00
|
|
|
'identity/' => array(
|
|
|
|
|
$this->getQueryRoutePattern() =>
|
|
|
|
|
'DiffusionIdentityListController',
|
|
|
|
|
$this->getEditRoutePattern('edit/') =>
|
|
|
|
|
'DiffusionIdentityEditController',
|
|
|
|
|
'view/(?P<id>[^/]+)/' =>
|
|
|
|
|
'DiffusionIdentityViewController',
|
|
|
|
|
),
|
|
|
|
|
|
2012-08-05 14:03:39 -07:00
|
|
|
'inline/' => array(
|
2014-07-23 10:03:09 +10:00
|
|
|
'edit/(?P<phid>[^/]+)/' => 'DiffusionInlineCommentController',
|
|
|
|
|
'preview/(?P<phid>[^/]+)/'
|
|
|
|
|
=> 'DiffusionInlineCommentPreviewController',
|
2012-08-05 14:03:39 -07:00
|
|
|
),
|
|
|
|
|
'services/' => array(
|
|
|
|
|
'path/' => array(
|
|
|
|
|
'complete/' => 'DiffusionPathCompleteController',
|
|
|
|
|
'validate/' => 'DiffusionPathValidateController',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'symbol/(?P<name>[^/]+)/' => 'DiffusionSymbolController',
|
|
|
|
|
'external/' => 'DiffusionExternalController',
|
2012-12-03 13:12:19 -08:00
|
|
|
'lint/' => 'DiffusionLintController',
|
2017-01-11 08:23:19 -08:00
|
|
|
|
|
|
|
|
'commit/' => array(
|
2017-01-11 15:09:57 -08:00
|
|
|
$this->getQueryRoutePattern() =>
|
|
|
|
|
'DiffusionCommitListController',
|
2017-01-11 08:23:19 -08:00
|
|
|
$this->getEditRoutePattern('edit/') =>
|
2017-01-11 09:43:22 -08:00
|
|
|
'DiffusionCommitEditController',
|
2017-01-11 08:23:19 -08:00
|
|
|
),
|
2017-06-12 07:51:16 -07:00
|
|
|
'picture/(?P<id>[0-9]\d*)/'
|
|
|
|
|
=> 'DiffusionRepositoryProfilePictureController',
|
2012-08-05 14:03:39 -07:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-03 15:46:19 -07:00
|
|
|
public function getApplicationOrder() {
|
Add basic support for new navigation menu
Summary:
Add a new left-side application menu. This menu shows which application you're in and provides a quick way to get to other applications.
On desktops, menus are always shown but the app menu can be collapsed to be very small.
On tablets, navigation buttons allow you to choose between the menus and the content.
On phones, navigation buttons allow you to choose between the app menu, the local menu, and the content.
This needs some code and UI cleanup, but has no effect yet so I think it's okay to land as-is, I'll clean it up a bit as I start integrating it. I want to play around with it a bit and see if it's good/useful or horrible anyway.
Test Plan: Will include screenshots.
Reviewers: vrana, btrahan, chad
Reviewed By: btrahan
CC: aran, alanh
Maniphest Tasks: T1569
Differential Revision: https://secure.phabricator.com/D3223
2012-08-11 07:06:12 -07:00
|
|
|
return 0.120;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-25 17:46:08 -07:00
|
|
|
protected function getCustomCapabilities() {
|
|
|
|
|
return array(
|
2015-06-11 13:25:30 -07:00
|
|
|
DiffusionDefaultViewCapability::CAPABILITY => array(
|
|
|
|
|
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
2015-06-22 11:46:59 -07:00
|
|
|
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
|
2015-06-11 13:25:30 -07:00
|
|
|
),
|
2014-07-25 08:20:39 +10:00
|
|
|
DiffusionDefaultEditCapability::CAPABILITY => array(
|
2013-10-25 17:46:08 -07:00
|
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
2015-06-11 13:25:30 -07:00
|
|
|
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
2015-06-22 11:46:59 -07:00
|
|
|
'capability' => PhabricatorPolicyCapability::CAN_EDIT,
|
2015-06-11 13:25:30 -07:00
|
|
|
),
|
|
|
|
|
DiffusionDefaultPushCapability::CAPABILITY => array(
|
|
|
|
|
'template' => PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
|
2013-10-25 17:46:08 -07:00
|
|
|
),
|
2014-07-25 08:20:39 +10:00
|
|
|
DiffusionCreateRepositoriesCapability::CAPABILITY => array(
|
2013-10-25 17:46:08 -07:00
|
|
|
'default' => PhabricatorPolicies::POLICY_ADMIN,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-01 11:01:21 -07:00
|
|
|
public function getMailCommandObjects() {
|
|
|
|
|
return array(
|
|
|
|
|
'commit' => array(
|
|
|
|
|
'name' => pht('Email Commands: Commits'),
|
|
|
|
|
'header' => pht('Interacting with Commits'),
|
|
|
|
|
'object' => new PhabricatorRepositoryCommit(),
|
|
|
|
|
'summary' => pht(
|
|
|
|
|
'This page documents the commands you can use to interact with '.
|
|
|
|
|
'commits and audits in Diffusion.'),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
Implement a scope selector for the global search
Summary:
See M1433. Fixes T7266. Fixes T4475. Ref T7314.
Future work/notes/etc:
- Write the User Guide (see TODO).
- This might needs some design tweaks -- I think it's functionally almost-equivalent to the mock, but the UI isn't quite the same.
- (Mobile design is a touch off-looking I think?)
- When you use a custom query, the duplicate "magnifying glass" icons are a little weird. Maybe change one or the other.
- Maybe worth adding an "Open Documents in Current Application" option? Planning to wait for feedback on that.
- Need a Quicksand integration to change the current application at some point.
- Searching in "Current Application" from, e.g., the 404 page just searches all documents. Current plan is to just document this behavior, since the icon is a pretty good callout and it seems plausible that this is intuitive enough that users won't have a hard time with it.
Test Plan:
New dropdown:
{F379150}
Device-ish:
{F379151}
Normal search (current application, from maniphest, selects tasks):
{F379153}
Application search from non-application:
{F379154}
Reviewers: btrahan, chad
Reviewed By: chad
Subscribers: johnny-bit, epriestley
Maniphest Tasks: T7266, T7314, T4475
Differential Revision: https://secure.phabricator.com/D12509
2015-04-22 14:31:36 -07:00
|
|
|
public function getApplicationSearchDocumentTypes() {
|
|
|
|
|
return array(
|
|
|
|
|
PhabricatorRepositoryCommitPHIDType::TYPECONST,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-02 14:07:21 -07:00
|
|
|
}
|