1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

(stable) Promote 2016 Week 2

This commit is contained in:
epriestley 2016-01-08 16:38:25 -08:00
commit 2e7f2b7357
258 changed files with 8501 additions and 5955 deletions

1
bin/differential Symbolic link
View file

@ -0,0 +1 @@
../scripts/setup/manage_differential.php

View file

@ -7,13 +7,13 @@
*/
return array(
'names' => array(
'core.pkg.css' => 'a419cf4b',
'core.pkg.js' => '400453e4',
'core.pkg.css' => '3ea6dc33',
'core.pkg.js' => '57dff7df',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
'differential.pkg.js' => '64e69521',
'diffusion.pkg.css' => 'f45955ed',
'diffusion.pkg.js' => 'ca1c8b5a',
'diffusion.pkg.js' => '3a9a8bfa',
'maniphest.pkg.css' => '4845691a',
'maniphest.pkg.js' => '949a7498',
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
@ -37,7 +37,6 @@ return array(
'rsrc/css/application/base/phabricator-application-launch-view.css' => '95351601',
'rsrc/css/application/base/phui-theme.css' => '6b451f24',
'rsrc/css/application/base/standard-page-view.css' => '3c99cdf4',
'rsrc/css/application/calendar/calendar-icon.css' => 'c69aa59f',
'rsrc/css/application/chatlog/chatlog.css' => 'd295b020',
'rsrc/css/application/conduit/conduit-api.css' => '7bc725c4',
'rsrc/css/application/config/config-options.css' => '0ede4c9b',
@ -82,7 +81,7 @@ return array(
'rsrc/css/application/owners/owners-path-editor.css' => '2f00933b',
'rsrc/css/application/paste/paste.css' => 'a5157c48',
'rsrc/css/application/people/people-profile.css' => '25970776',
'rsrc/css/application/phame/phame.css' => '09a39e8d',
'rsrc/css/application/phame/phame.css' => 'dac8fdf2',
'rsrc/css/application/pholio/pholio-edit.css' => '3ad9d1ee',
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => '95174bdd',
@ -94,7 +93,6 @@ return array(
'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43',
'rsrc/css/application/policy/policy.css' => '957ea14c',
'rsrc/css/application/ponder/ponder-view.css' => '7b0df4da',
'rsrc/css/application/projects/project-icon.css' => '4e3eaa5a',
'rsrc/css/application/releeph/releeph-core.css' => '9b3c5733',
'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5',
'rsrc/css/application/releeph/releeph-request-differential-create-dialog.css' => '8d8b92cd',
@ -114,7 +112,7 @@ return array(
'rsrc/css/font/phui-font-icon-base.css' => 'ecbbb4c2',
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
'rsrc/css/layout/phabricator-hovercard-view.css' => '1239cd52',
'rsrc/css/layout/phabricator-side-menu-view.css' => 'bec2458e',
'rsrc/css/layout/phabricator-side-menu-view.css' => '91b7a42c',
'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983',
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'd1cf6f93',
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338',
@ -127,7 +125,7 @@ return array(
'rsrc/css/phui/phui-box.css' => 'a5bb366d',
'rsrc/css/phui/phui-button.css' => '16020a60',
'rsrc/css/phui/phui-crumbs-view.css' => '414406b5',
'rsrc/css/phui/phui-document-pro.css' => 'e0fad431',
'rsrc/css/phui/phui-document-pro.css' => '8799acf7',
'rsrc/css/phui/phui-document-summary.css' => '9ca48bdf',
'rsrc/css/phui/phui-document.css' => 'a4a1c3b9',
'rsrc/css/phui/phui-feed-story.css' => 'b7b26d23',
@ -135,6 +133,7 @@ return array(
'rsrc/css/phui/phui-form-view.css' => '4a1a0f5e',
'rsrc/css/phui/phui-form.css' => '0b98e572',
'rsrc/css/phui/phui-header-view.css' => '55bb32dd',
'rsrc/css/phui/phui-icon-set-selector.css' => '1ab67aad',
'rsrc/css/phui/phui-icon.css' => 'b0a6b1b6',
'rsrc/css/phui/phui-image-mask.css' => '5a8b09c8',
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
@ -391,7 +390,7 @@ return array(
'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'b42eddc7',
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a',
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '9007c197',
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '5a0b1a64',
'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
'rsrc/js/application/diffusion/behavior-load-blame.js' => '42126667',
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
@ -465,7 +464,7 @@ return array(
'rsrc/js/core/behavior-active-nav.js' => 'e379b58e',
'rsrc/js/core/behavior-audio-source.js' => '59b251eb',
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
'rsrc/js/core/behavior-choose-control.js' => 'dfaafb14',
'rsrc/js/core/behavior-choose-control.js' => '327a00d1',
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
'rsrc/js/core/behavior-device.js' => 'a205cf28',
@ -487,9 +486,9 @@ return array(
'rsrc/js/core/behavior-object-selector.js' => '49b73b36',
'rsrc/js/core/behavior-oncopy.js' => '2926fff2',
'rsrc/js/core/behavior-phabricator-nav.js' => '56a1ca03',
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'ecddcbe2',
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => 'b60b6d9b',
'rsrc/js/core/behavior-refresh-csrf.js' => 'ab2f381b',
'rsrc/js/core/behavior-remarkup-preview.js' => 'f7379f45',
'rsrc/js/core/behavior-remarkup-preview.js' => '4b700e9e',
'rsrc/js/core/behavior-reorder-applications.js' => '76b9fc3e',
'rsrc/js/core/behavior-reveal-content.js' => '60821bc7',
'rsrc/js/core/behavior-scrollbar.js' => '834a1173',
@ -524,7 +523,6 @@ return array(
'aphront-typeahead-control-css' => '0e403212',
'auth-css' => '0877ed6e',
'bulk-job-css' => 'df9c1d4a',
'calendar-icon-css' => 'c69aa59f',
'changeset-view-manager' => '58562350',
'conduit-api-css' => '7bc725c4',
'config-options-css' => '0ede4c9b',
@ -571,7 +569,7 @@ return array(
'javelin-behavior-audio-source' => '59b251eb',
'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-bulk-job-reload' => 'edf8a145',
'javelin-behavior-choose-control' => 'dfaafb14',
'javelin-behavior-choose-control' => '327a00d1',
'javelin-behavior-comment-actions' => 'b65559c0',
'javelin-behavior-config-reorder-fields' => 'b6993408',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
@ -598,7 +596,7 @@ return array(
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
'javelin-behavior-differential-user-select' => 'a8d8459d',
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
'javelin-behavior-diffusion-commit-graph' => '9007c197',
'javelin-behavior-diffusion-commit-graph' => '5a0b1a64',
'javelin-behavior-diffusion-jump-to' => '73d09eef',
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc',
@ -640,7 +638,7 @@ return array(
'javelin-behavior-phabricator-notification-example' => '8ce821c5',
'javelin-behavior-phabricator-object-selector' => '49b73b36',
'javelin-behavior-phabricator-oncopy' => '2926fff2',
'javelin-behavior-phabricator-remarkup-assist' => 'ecddcbe2',
'javelin-behavior-phabricator-remarkup-assist' => 'b60b6d9b',
'javelin-behavior-phabricator-reveal-content' => '60821bc7',
'javelin-behavior-phabricator-search-typeahead' => '048330fa',
'javelin-behavior-phabricator-show-older-transactions' => 'dbbf48b6',
@ -662,7 +660,7 @@ return array(
'javelin-behavior-releeph-preview-branch' => 'b2b4fbaf',
'javelin-behavior-releeph-request-state-change' => 'a0b57eb8',
'javelin-behavior-releeph-request-typeahead' => 'de2e896f',
'javelin-behavior-remarkup-preview' => 'f7379f45',
'javelin-behavior-remarkup-preview' => '4b700e9e',
'javelin-behavior-reorder-applications' => '76b9fc3e',
'javelin-behavior-reorder-columns' => 'e1d25dfb',
'javelin-behavior-repository-crossreference' => 'e5339c43',
@ -762,7 +760,7 @@ return array(
'phabricator-remarkup-css' => '7afb543c',
'phabricator-search-results-css' => '7dea472c',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-side-menu-view-css' => 'bec2458e',
'phabricator-side-menu-view-css' => '91b7a42c',
'phabricator-slowvote-css' => 'da0afb1b',
'phabricator-source-code-view-css' => 'cbeef983',
'phabricator-standard-page-view' => '3c99cdf4',
@ -781,7 +779,7 @@ return array(
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
'phabricator-zindex-css' => '57ddcaa2',
'phame-css' => '09a39e8d',
'phame-css' => 'dac8fdf2',
'pholio-css' => '95174bdd',
'pholio-edit-css' => '3ad9d1ee',
'pholio-inline-comments-css' => '8e545e49',
@ -802,13 +800,14 @@ return array(
'phui-crumbs-view-css' => '414406b5',
'phui-document-summary-view-css' => '9ca48bdf',
'phui-document-view-css' => 'a4a1c3b9',
'phui-document-view-pro-css' => 'e0fad431',
'phui-document-view-pro-css' => '8799acf7',
'phui-feed-story-css' => 'b7b26d23',
'phui-font-icon-base-css' => 'ecbbb4c2',
'phui-fontkit-css' => '9cda225e',
'phui-form-css' => '0b98e572',
'phui-form-view-css' => '4a1a0f5e',
'phui-header-view-css' => '55bb32dd',
'phui-icon-set-selector-css' => '1ab67aad',
'phui-icon-view-css' => 'b0a6b1b6',
'phui-image-mask-css' => '5a8b09c8',
'phui-info-panel-css' => '27ea50a1',
@ -839,7 +838,6 @@ return array(
'policy-edit-css' => '815c66f7',
'policy-transaction-detail-css' => '82100a43',
'ponder-view-css' => '7b0df4da',
'project-icon-css' => '4e3eaa5a',
'raphael-core' => '51ee6b43',
'raphael-g' => '40dde778',
'raphael-g-line' => '40da039e',
@ -1044,6 +1042,12 @@ return array(
'2f670a96' => array(
'phui-theme-css',
),
'327a00d1' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-workflow',
),
'331b1611' => array(
'javelin-install',
),
@ -1125,6 +1129,12 @@ return array(
'javelin-request',
'javelin-util',
),
'4b700e9e' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'phabricator-shaped-request',
),
'4e3e79a6' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1212,6 +1222,11 @@ return array(
'javelin-vector',
'javelin-dom',
),
'5a0b1a64' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
),
'5b2e3e2b' => array(
'javelin-stratcom',
'javelin-request',
@ -1511,11 +1526,6 @@ return array(
'javelin-install',
'javelin-dom',
),
'9007c197' => array(
'javelin-behavior',
'javelin-dom',
'javelin-stratcom',
),
'901935ef' => array(
'javelin-behavior',
'javelin-dom',
@ -1721,6 +1731,15 @@ return array(
'javelin-dom',
'javelin-util',
),
'b60b6d9b' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'phabricator-phtize',
'phabricator-textareautils',
'javelin-workflow',
'javelin-vector',
),
'b65559c0' => array(
'javelin-behavior',
'javelin-stratcom',
@ -1894,12 +1913,6 @@ return array(
'df5e11d2' => array(
'javelin-install',
),
'dfaafb14' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'javelin-workflow',
),
'e10f8e18' => array(
'javelin-behavior',
'javelin-dom',
@ -1960,15 +1973,6 @@ return array(
'phabricator-phtize',
'javelin-dom',
),
'ecddcbe2' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-dom',
'phabricator-phtize',
'phabricator-textareautils',
'javelin-workflow',
'javelin-vector',
),
'edd1ba66' => array(
'javelin-behavior',
'javelin-stratcom',
@ -2005,12 +2009,6 @@ return array(
'javelin-util',
'javelin-reactor',
),
'f7379f45' => array(
'javelin-behavior',
'javelin-dom',
'javelin-util',
'phabricator-shaped-request',
),
'f7fc67ec' => array(
'javelin-install',
'javelin-typeahead',

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_drydock.drydock_repositoryoperation
ADD isDismissed BOOL NOT NULL;

View file

@ -0,0 +1,6 @@
/* PhabricatorProjectProjectHasMemberEdgeType::EDGECONST = 13 */
/* PhabricatorProjectMaterializedMemberEdgeType::EDGECONST = 60 */
INSERT IGNORE INTO {$NAMESPACE}_project.edge (src, type, dst, dateCreated)
SELECT src, 60, dst, dateCreated FROM {$NAMESPACE}_project.edge
WHERE type = 13;

View file

@ -0,0 +1,34 @@
<?php
$icon_map = array(
'fa-briefcase' => 'project',
'fa-tags' => 'tag',
'fa-lock' => 'policy',
'fa-users' => 'group',
'fa-folder' => 'folder',
'fa-calendar' => 'timeline',
'fa-flag-checkered' => 'goal',
'fa-truck' => 'release',
'fa-bug' => 'bugs',
'fa-trash-o' => 'cleanup',
'fa-umbrella' => 'umbrella',
'fa-envelope' => 'communication',
'fa-building' => 'organization',
'fa-cloud' => 'infrastructure',
'fa-credit-card' => 'account',
'fa-flask' => 'experimental',
);
$table = new PhabricatorProject();
$conn_w = $table->establishConnection('w');
foreach ($icon_map as $old_icon => $new_key) {
queryfx(
$conn_w,
'UPDATE %T SET icon = %s WHERE icon = %s',
$table->getTableName(),
$new_key,
$old_icon);
}

View file

@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
$args->setTagline(pht('manage hunks'));
$args->setSynopsis(<<<EOSYNOPSIS
**differential** __command__ [__options__]
Manage Differential.
EOSYNOPSIS
);
$args->parseStandardArguments();
$workflows = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorDifferentialManagementWorkflow')
->execute();
$workflows[] = new PhutilHelpArgumentWorkflow();
$args->parseWorkflows($workflows);

View file

@ -386,6 +386,7 @@ phutil_register_library_map(array(
'DifferentialDiffContentRemovedHeraldField' => 'applications/differential/herald/DifferentialDiffContentRemovedHeraldField.php',
'DifferentialDiffCreateController' => 'applications/differential/controller/DifferentialDiffCreateController.php',
'DifferentialDiffEditor' => 'applications/differential/editor/DifferentialDiffEditor.php',
'DifferentialDiffExtractionEngine' => 'applications/differential/engine/DifferentialDiffExtractionEngine.php',
'DifferentialDiffHeraldField' => 'applications/differential/herald/DifferentialDiffHeraldField.php',
'DifferentialDiffHeraldFieldGroup' => 'applications/differential/herald/DifferentialDiffHeraldFieldGroup.php',
'DifferentialDiffInlineCommentQuery' => 'applications/differential/query/DifferentialDiffInlineCommentQuery.php',
@ -528,17 +529,15 @@ phutil_register_library_map(array(
'DiffusionAuditorsAddAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddAuditorsHeraldAction.php',
'DiffusionAuditorsAddSelfHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsAddSelfHeraldAction.php',
'DiffusionAuditorsHeraldAction' => 'applications/diffusion/herald/DiffusionAuditorsHeraldAction.php',
'DiffusionBlameConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBlameConduitAPIMethod.php',
'DiffusionBlameQuery' => 'applications/diffusion/query/blame/DiffusionBlameQuery.php',
'DiffusionBlockHeraldAction' => 'applications/diffusion/herald/DiffusionBlockHeraldAction.php',
'DiffusionBranchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php',
'DiffusionBrowseController' => 'applications/diffusion/controller/DiffusionBrowseController.php',
'DiffusionBrowseDirectoryController' => 'applications/diffusion/controller/DiffusionBrowseDirectoryController.php',
'DiffusionBrowseFileController' => 'applications/diffusion/controller/DiffusionBrowseFileController.php',
'DiffusionBrowseMainController' => 'applications/diffusion/controller/DiffusionBrowseMainController.php',
'DiffusionBrowseQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php',
'DiffusionBrowseResultSet' => 'applications/diffusion/data/DiffusionBrowseResultSet.php',
'DiffusionBrowseSearchController' => 'applications/diffusion/controller/DiffusionBrowseSearchController.php',
'DiffusionBrowseTableView' => 'applications/diffusion/view/DiffusionBrowseTableView.php',
'DiffusionCachedResolveRefsQuery' => 'applications/diffusion/query/DiffusionCachedResolveRefsQuery.php',
'DiffusionChangeController' => 'applications/diffusion/controller/DiffusionChangeController.php',
@ -599,17 +598,15 @@ phutil_register_library_map(array(
'DiffusionExternalController' => 'applications/diffusion/controller/DiffusionExternalController.php',
'DiffusionExternalSymbolQuery' => 'applications/diffusion/symbol/DiffusionExternalSymbolQuery.php',
'DiffusionExternalSymbolsSource' => 'applications/diffusion/symbol/DiffusionExternalSymbolsSource.php',
'DiffusionFileContent' => 'applications/diffusion/data/DiffusionFileContent.php',
'DiffusionFileContentQuery' => 'applications/diffusion/query/filecontent/DiffusionFileContentQuery.php',
'DiffusionFileContentQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php',
'DiffusionFindSymbolsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php',
'DiffusionGetCommitsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php',
'DiffusionGetLintMessagesConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionGetLintMessagesConduitAPIMethod.php',
'DiffusionGetRecentCommitsByPathConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php',
'DiffusionGitBlameQuery' => 'applications/diffusion/query/blame/DiffusionGitBlameQuery.php',
'DiffusionGitBranch' => 'applications/diffusion/data/DiffusionGitBranch.php',
'DiffusionGitBranchTestCase' => 'applications/diffusion/data/__tests__/DiffusionGitBranchTestCase.php',
'DiffusionGitFileContentQuery' => 'applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php',
'DiffusionGitFileContentQueryTestCase' => 'applications/diffusion/query/__tests__/DiffusionGitFileContentQueryTestCase.php',
'DiffusionGitRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php',
'DiffusionGitReceivePackSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitReceivePackSSHWorkflow.php',
'DiffusionGitRequest' => 'applications/diffusion/request/DiffusionGitRequest.php',
@ -626,7 +623,6 @@ phutil_register_library_map(array(
'DiffusionLastModifiedQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionLastModifiedQueryConduitAPIMethod.php',
'DiffusionLintController' => 'applications/diffusion/controller/DiffusionLintController.php',
'DiffusionLintCountQuery' => 'applications/diffusion/query/DiffusionLintCountQuery.php',
'DiffusionLintDetailsController' => 'applications/diffusion/controller/DiffusionLintDetailsController.php',
'DiffusionLintSaveRunner' => 'applications/diffusion/DiffusionLintSaveRunner.php',
'DiffusionLookSoonConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionLookSoonConduitAPIMethod.php',
'DiffusionLowLevelCommitFieldsQuery' => 'applications/diffusion/query/lowlevel/DiffusionLowLevelCommitFieldsQuery.php',
@ -638,6 +634,7 @@ phutil_register_library_map(array(
'DiffusionLowLevelParentsQuery' => 'applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php',
'DiffusionLowLevelQuery' => 'applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php',
'DiffusionLowLevelResolveRefsQuery' => 'applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php',
'DiffusionMercurialBlameQuery' => 'applications/diffusion/query/blame/DiffusionMercurialBlameQuery.php',
'DiffusionMercurialFileContentQuery' => 'applications/diffusion/query/filecontent/DiffusionMercurialFileContentQuery.php',
'DiffusionMercurialRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php',
'DiffusionMercurialRequest' => 'applications/diffusion/request/DiffusionMercurialRequest.php',
@ -749,6 +746,7 @@ phutil_register_library_map(array(
'DiffusionSubversionServeSSHWorkflow' => 'applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php',
'DiffusionSubversionWireProtocol' => 'applications/diffusion/protocol/DiffusionSubversionWireProtocol.php',
'DiffusionSubversionWireProtocolTestCase' => 'applications/diffusion/protocol/__tests__/DiffusionSubversionWireProtocolTestCase.php',
'DiffusionSvnBlameQuery' => 'applications/diffusion/query/blame/DiffusionSvnBlameQuery.php',
'DiffusionSvnFileContentQuery' => 'applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php',
'DiffusionSvnRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionSvnRawDiffQuery.php',
'DiffusionSvnRequest' => 'applications/diffusion/request/DiffusionSvnRequest.php',
@ -911,6 +909,7 @@ phutil_register_library_map(array(
'DrydockObjectAuthorizationView' => 'applications/drydock/view/DrydockObjectAuthorizationView.php',
'DrydockQuery' => 'applications/drydock/query/DrydockQuery.php',
'DrydockRepositoryOperation' => 'applications/drydock/storage/DrydockRepositoryOperation.php',
'DrydockRepositoryOperationDismissController' => 'applications/drydock/controller/DrydockRepositoryOperationDismissController.php',
'DrydockRepositoryOperationListController' => 'applications/drydock/controller/DrydockRepositoryOperationListController.php',
'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php',
'DrydockRepositoryOperationQuery' => 'applications/drydock/query/DrydockRepositoryOperationQuery.php',
@ -1160,6 +1159,8 @@ phutil_register_library_map(array(
'HeraldNewObjectField' => 'applications/herald/field/HeraldNewObjectField.php',
'HeraldNotifyActionGroup' => 'applications/herald/action/HeraldNotifyActionGroup.php',
'HeraldObjectTranscript' => 'applications/herald/storage/transcript/HeraldObjectTranscript.php',
'HeraldPhameBlogAdapter' => 'applications/phame/herald/HeraldPhameBlogAdapter.php',
'HeraldPhamePostAdapter' => 'applications/phame/herald/HeraldPhamePostAdapter.php',
'HeraldPholioMockAdapter' => 'applications/pholio/herald/HeraldPholioMockAdapter.php',
'HeraldPonderQuestionAdapter' => 'applications/ponder/herald/HeraldPonderQuestionAdapter.php',
'HeraldPreCommitAdapter' => 'applications/diffusion/herald/HeraldPreCommitAdapter.php',
@ -1500,6 +1501,7 @@ phutil_register_library_map(array(
'PHUIListItemView' => 'view/phui/PHUIListItemView.php',
'PHUIListView' => 'view/phui/PHUIListView.php',
'PHUIListViewTestCase' => 'view/layout/__tests__/PHUIListViewTestCase.php',
'PHUIMainMenuView' => 'view/phui/PHUIMainMenuView.php',
'PHUIObjectBoxView' => 'view/phui/PHUIObjectBoxView.php',
'PHUIObjectItemListExample' => 'applications/uiexample/examples/PHUIObjectItemListExample.php',
'PHUIObjectItemListView' => 'view/phui/PHUIObjectItemListView.php',
@ -1722,6 +1724,7 @@ phutil_register_library_map(array(
'PhabricatorAuthListController' => 'applications/auth/controller/config/PhabricatorAuthListController.php',
'PhabricatorAuthLoginController' => 'applications/auth/controller/PhabricatorAuthLoginController.php',
'PhabricatorAuthLoginHandler' => 'applications/auth/handler/PhabricatorAuthLoginHandler.php',
'PhabricatorAuthMainMenuBarExtension' => 'applications/auth/extension/PhabricatorAuthMainMenuBarExtension.php',
'PhabricatorAuthManagementCachePKCS8Workflow' => 'applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php',
'PhabricatorAuthManagementLDAPWorkflow' => 'applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php',
'PhabricatorAuthManagementListFactorsWorkflow' => 'applications/auth/management/PhabricatorAuthManagementListFactorsWorkflow.php',
@ -1782,6 +1785,7 @@ phutil_register_library_map(array(
'PhabricatorBadgesDAO' => 'applications/badges/storage/PhabricatorBadgesDAO.php',
'PhabricatorBadgesDefaultEditCapability' => 'applications/badges/capability/PhabricatorBadgesDefaultEditCapability.php',
'PhabricatorBadgesEditController' => 'applications/badges/controller/PhabricatorBadgesEditController.php',
'PhabricatorBadgesEditEngine' => 'applications/badges/editor/PhabricatorBadgesEditEngine.php',
'PhabricatorBadgesEditRecipientsController' => 'applications/badges/controller/PhabricatorBadgesEditRecipientsController.php',
'PhabricatorBadgesEditor' => 'applications/badges/editor/PhabricatorBadgesEditor.php',
'PhabricatorBadgesIconSet' => 'applications/badges/icon/PhabricatorBadgesIconSet.php',
@ -2138,7 +2142,10 @@ phutil_register_library_map(array(
'PhabricatorDiffPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php',
'PhabricatorDifferenceEngine' => 'infrastructure/diff/PhabricatorDifferenceEngine.php',
'PhabricatorDifferentialApplication' => 'applications/differential/application/PhabricatorDifferentialApplication.php',
'PhabricatorDifferentialAttachCommitWorkflow' => 'applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php',
'PhabricatorDifferentialConfigOptions' => 'applications/differential/config/PhabricatorDifferentialConfigOptions.php',
'PhabricatorDifferentialExtractWorkflow' => 'applications/differential/management/PhabricatorDifferentialExtractWorkflow.php',
'PhabricatorDifferentialManagementWorkflow' => 'applications/differential/management/PhabricatorDifferentialManagementWorkflow.php',
'PhabricatorDifferentialRevisionTestDataGenerator' => 'applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php',
'PhabricatorDiffusionApplication' => 'applications/diffusion/application/PhabricatorDiffusionApplication.php',
'PhabricatorDiffusionConfigOptions' => 'applications/diffusion/config/PhabricatorDiffusionConfigOptions.php',
@ -2362,6 +2369,7 @@ phutil_register_library_map(array(
'PhabricatorHelpDocumentationController' => 'applications/help/controller/PhabricatorHelpDocumentationController.php',
'PhabricatorHelpEditorProtocolController' => 'applications/help/controller/PhabricatorHelpEditorProtocolController.php',
'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php',
'PhabricatorHelpMainMenuBarExtension' => 'applications/help/extension/PhabricatorHelpMainMenuBarExtension.php',
'PhabricatorHeraldApplication' => 'applications/herald/application/PhabricatorHeraldApplication.php',
'PhabricatorHighSecurityRequestExceptionHandler' => 'aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php',
'PhabricatorHomeApplication' => 'applications/home/application/PhabricatorHomeApplication.php',
@ -2380,6 +2388,7 @@ phutil_register_library_map(array(
'PhabricatorIRCProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php',
'PhabricatorIconRemarkupRule' => 'applications/macro/markup/PhabricatorIconRemarkupRule.php',
'PhabricatorIconSet' => 'applications/files/iconset/PhabricatorIconSet.php',
'PhabricatorIconSetEditField' => 'applications/transactions/editfield/PhabricatorIconSetEditField.php',
'PhabricatorIconSetIcon' => 'applications/files/iconset/PhabricatorIconSetIcon.php',
'PhabricatorImageMacroRemarkupRule' => 'applications/macro/markup/PhabricatorImageMacroRemarkupRule.php',
'PhabricatorImageTransformer' => 'applications/files/PhabricatorImageTransformer.php',
@ -2478,6 +2487,7 @@ phutil_register_library_map(array(
'PhabricatorMailSetupCheck' => 'applications/config/check/PhabricatorMailSetupCheck.php',
'PhabricatorMailTarget' => 'applications/metamta/replyhandler/PhabricatorMailTarget.php',
'PhabricatorMailgunConfigOptions' => 'applications/config/option/PhabricatorMailgunConfigOptions.php',
'PhabricatorMainMenuBarExtension' => 'view/page/menu/PhabricatorMainMenuBarExtension.php',
'PhabricatorMainMenuSearchView' => 'view/page/menu/PhabricatorMainMenuSearchView.php',
'PhabricatorMainMenuView' => 'view/page/menu/PhabricatorMainMenuView.php',
'PhabricatorManagementWorkflow' => 'infrastructure/management/PhabricatorManagementWorkflow.php',
@ -2722,6 +2732,7 @@ phutil_register_library_map(array(
'PhabricatorPeopleLogQuery' => 'applications/people/query/PhabricatorPeopleLogQuery.php',
'PhabricatorPeopleLogSearchEngine' => 'applications/people/query/PhabricatorPeopleLogSearchEngine.php',
'PhabricatorPeopleLogsController' => 'applications/people/controller/PhabricatorPeopleLogsController.php',
'PhabricatorPeopleMainMenuBarExtension' => 'applications/people/extension/PhabricatorPeopleMainMenuBarExtension.php',
'PhabricatorPeopleNewController' => 'applications/people/controller/PhabricatorPeopleNewController.php',
'PhabricatorPeopleNoOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php',
'PhabricatorPeopleOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php',
@ -2844,7 +2855,8 @@ phutil_register_library_map(array(
'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php',
'PhabricatorProjectDatasource' => 'applications/project/typeahead/PhabricatorProjectDatasource.php',
'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php',
'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php',
'PhabricatorProjectEditController' => 'applications/project/controller/PhabricatorProjectEditController.php',
'PhabricatorProjectEditEngine' => 'applications/project/engine/PhabricatorProjectEditEngine.php',
'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php',
'PhabricatorProjectFeedController' => 'applications/project/controller/PhabricatorProjectFeedController.php',
'PhabricatorProjectFulltextEngine' => 'applications/project/search/PhabricatorProjectFulltextEngine.php',
@ -2852,7 +2864,9 @@ phutil_register_library_map(array(
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
'PhabricatorProjectLogicalAndDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalAndDatasource.php',
'PhabricatorProjectListView' => 'applications/project/view/PhabricatorProjectListView.php',
'PhabricatorProjectLockController' => 'applications/project/controller/PhabricatorProjectLockController.php',
'PhabricatorProjectLogicalAncestorDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalAncestorDatasource.php',
'PhabricatorProjectLogicalDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalDatasource.php',
'PhabricatorProjectLogicalOrNotDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalOrNotDatasource.php',
'PhabricatorProjectLogicalUserDatasource' => 'applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php',
@ -2863,6 +2877,7 @@ phutil_register_library_map(array(
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
'PhabricatorProjectMembersPolicyRule' => 'applications/project/policyrule/PhabricatorProjectMembersPolicyRule.php',
'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php',
'PhabricatorProjectMilestonesController' => 'applications/project/controller/PhabricatorProjectMilestonesController.php',
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
'PhabricatorProjectNameContextFreeGrammar' => 'applications/project/lipsum/PhabricatorProjectNameContextFreeGrammar.php',
'PhabricatorProjectNoProjectsDatasource' => 'applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php',
@ -2882,10 +2897,12 @@ phutil_register_library_map(array(
'PhabricatorProjectSlug' => 'applications/project/storage/PhabricatorProjectSlug.php',
'PhabricatorProjectStandardCustomField' => 'applications/project/customfield/PhabricatorProjectStandardCustomField.php',
'PhabricatorProjectStatus' => 'applications/project/constants/PhabricatorProjectStatus.php',
'PhabricatorProjectSubprojectsController' => 'applications/project/controller/PhabricatorProjectSubprojectsController.php',
'PhabricatorProjectTestDataGenerator' => 'applications/project/lipsum/PhabricatorProjectTestDataGenerator.php',
'PhabricatorProjectTransaction' => 'applications/project/storage/PhabricatorProjectTransaction.php',
'PhabricatorProjectTransactionEditor' => 'applications/project/editor/PhabricatorProjectTransactionEditor.php',
'PhabricatorProjectTransactionQuery' => 'applications/project/query/PhabricatorProjectTransactionQuery.php',
'PhabricatorProjectTypeConfigOptionType' => 'applications/project/config/PhabricatorProjectTypeConfigOptionType.php',
'PhabricatorProjectUIEventListener' => 'applications/project/events/PhabricatorProjectUIEventListener.php',
'PhabricatorProjectUpdateController' => 'applications/project/controller/PhabricatorProjectUpdateController.php',
'PhabricatorProjectUserFunctionDatasource' => 'applications/project/typeahead/PhabricatorProjectUserFunctionDatasource.php',
@ -3084,6 +3101,7 @@ phutil_register_library_map(array(
'PhabricatorSettingsAdjustController' => 'applications/settings/controller/PhabricatorSettingsAdjustController.php',
'PhabricatorSettingsApplication' => 'applications/settings/application/PhabricatorSettingsApplication.php',
'PhabricatorSettingsMainController' => 'applications/settings/controller/PhabricatorSettingsMainController.php',
'PhabricatorSettingsMainMenuBarExtension' => 'applications/settings/extension/PhabricatorSettingsMainMenuBarExtension.php',
'PhabricatorSettingsPanel' => 'applications/settings/panel/PhabricatorSettingsPanel.php',
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
'PhabricatorSetupCheckTestCase' => 'applications/config/check/__tests__/PhabricatorSetupCheckTestCase.php',
@ -3183,6 +3201,7 @@ phutil_register_library_map(array(
'PhabricatorStorageSchemaSpec' => 'infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php',
'PhabricatorStorageSetupCheck' => 'applications/config/check/PhabricatorStorageSetupCheck.php',
'PhabricatorStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php',
'PhabricatorStringListEditField' => 'applications/transactions/editfield/PhabricatorStringListEditField.php',
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php',
'PhabricatorSubscribersEditField' => 'applications/transactions/editfield/PhabricatorSubscribersEditField.php',
@ -3395,6 +3414,7 @@ phutil_register_library_map(array(
'PhameBlogArchiveController' => 'applications/phame/controller/blog/PhameBlogArchiveController.php',
'PhameBlogController' => 'applications/phame/controller/blog/PhameBlogController.php',
'PhameBlogCreateCapability' => 'applications/phame/capability/PhameBlogCreateCapability.php',
'PhameBlogEditConduitAPIMethod' => 'applications/phame/conduit/PhameBlogEditConduitAPIMethod.php',
'PhameBlogEditController' => 'applications/phame/controller/blog/PhameBlogEditController.php',
'PhameBlogEditEngine' => 'applications/phame/editor/PhameBlogEditEngine.php',
'PhameBlogEditor' => 'applications/phame/editor/PhameBlogEditor.php',
@ -3405,24 +3425,26 @@ phutil_register_library_map(array(
'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php',
'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php',
'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php',
'PhameBlogSearchConduitAPIMethod' => 'applications/phame/conduit/PhameBlogSearchConduitAPIMethod.php',
'PhameBlogSearchEngine' => 'applications/phame/query/PhameBlogSearchEngine.php',
'PhameBlogSite' => 'applications/phame/site/PhameBlogSite.php',
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
'PhameBlogTransactionQuery' => 'applications/phame/query/PhameBlogTransactionQuery.php',
'PhameBlogViewController' => 'applications/phame/controller/blog/PhameBlogViewController.php',
'PhameConduitAPIMethod' => 'applications/phame/conduit/PhameConduitAPIMethod.php',
'PhameConstants' => 'applications/phame/constants/PhameConstants.php',
'PhameController' => 'applications/phame/controller/PhameController.php',
'PhameCreatePostConduitAPIMethod' => 'applications/phame/conduit/PhameCreatePostConduitAPIMethod.php',
'PhameDAO' => 'applications/phame/storage/PhameDAO.php',
'PhameDescriptionView' => 'applications/phame/view/PhameDescriptionView.php',
'PhameDraftListView' => 'applications/phame/view/PhameDraftListView.php',
'PhameHomeController' => 'applications/phame/controller/PhameHomeController.php',
'PhameLiveController' => 'applications/phame/controller/PhameLiveController.php',
'PhameNextPostView' => 'applications/phame/view/PhameNextPostView.php',
'PhamePost' => 'applications/phame/storage/PhamePost.php',
'PhamePostCommentController' => 'applications/phame/controller/post/PhamePostCommentController.php',
'PhamePostController' => 'applications/phame/controller/post/PhamePostController.php',
'PhamePostEditConduitAPIMethod' => 'applications/phame/conduit/PhamePostEditConduitAPIMethod.php',
'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php',
'PhamePostEditEngine' => 'applications/phame/editor/PhamePostEditEngine.php',
'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php',
'PhamePostHistoryController' => 'applications/phame/controller/post/PhamePostHistoryController.php',
'PhamePostListController' => 'applications/phame/controller/post/PhamePostListController.php',
@ -3432,13 +3454,12 @@ phutil_register_library_map(array(
'PhamePostPublishController' => 'applications/phame/controller/post/PhamePostPublishController.php',
'PhamePostQuery' => 'applications/phame/query/PhamePostQuery.php',
'PhamePostReplyHandler' => 'applications/phame/mail/PhamePostReplyHandler.php',
'PhamePostSearchConduitAPIMethod' => 'applications/phame/conduit/PhamePostSearchConduitAPIMethod.php',
'PhamePostSearchEngine' => 'applications/phame/query/PhamePostSearchEngine.php',
'PhamePostTransaction' => 'applications/phame/storage/PhamePostTransaction.php',
'PhamePostTransactionComment' => 'applications/phame/storage/PhamePostTransactionComment.php',
'PhamePostTransactionQuery' => 'applications/phame/query/PhamePostTransactionQuery.php',
'PhamePostViewController' => 'applications/phame/controller/post/PhamePostViewController.php',
'PhameQueryConduitAPIMethod' => 'applications/phame/conduit/PhameQueryConduitAPIMethod.php',
'PhameQueryPostsConduitAPIMethod' => 'applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php',
'PhameSchemaSpec' => 'applications/phame/storage/PhameSchemaSpec.php',
'PhameSite' => 'applications/phame/site/PhameSite.php',
'PhluxController' => 'applications/phlux/controller/PhluxController.php',
@ -3742,10 +3763,12 @@ phutil_register_library_map(array(
'ProjectDefaultEditCapability' => 'applications/project/capability/ProjectDefaultEditCapability.php',
'ProjectDefaultJoinCapability' => 'applications/project/capability/ProjectDefaultJoinCapability.php',
'ProjectDefaultViewCapability' => 'applications/project/capability/ProjectDefaultViewCapability.php',
'ProjectEditConduitAPIMethod' => 'applications/project/conduit/ProjectEditConduitAPIMethod.php',
'ProjectQueryConduitAPIMethod' => 'applications/project/conduit/ProjectQueryConduitAPIMethod.php',
'ProjectRemarkupRule' => 'applications/project/remarkup/ProjectRemarkupRule.php',
'ProjectRemarkupRuleTestCase' => 'applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php',
'ProjectReplyHandler' => 'applications/project/mail/ProjectReplyHandler.php',
'ProjectSearchConduitAPIMethod' => 'applications/project/conduit/ProjectSearchConduitAPIMethod.php',
'QueryFormattingTestCase' => 'infrastructure/storage/__tests__/QueryFormattingTestCase.php',
'ReleephAuthorFieldSpecification' => 'applications/releeph/field/specification/ReleephAuthorFieldSpecification.php',
'ReleephBranch' => 'applications/releeph/storage/ReleephBranch.php',
@ -4150,7 +4173,7 @@ phutil_register_library_map(array(
'ConduitMethodDoesNotExistException' => 'ConduitMethodNotFoundException',
'ConduitMethodNotFoundException' => 'ConduitException',
'ConduitPHIDListParameterType' => 'ConduitListParameterType',
'ConduitPHIDParameterType' => 'ConduitListParameterType',
'ConduitPHIDParameterType' => 'ConduitParameterType',
'ConduitParameterType' => 'Phobject',
'ConduitPingConduitAPIMethod' => 'ConduitAPIMethod',
'ConduitProjectListParameterType' => 'ConduitListParameterType',
@ -4158,7 +4181,7 @@ phutil_register_library_map(array(
'ConduitResultSearchEngineExtension' => 'PhabricatorSearchEngineExtension',
'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow',
'ConduitStringListParameterType' => 'ConduitListParameterType',
'ConduitStringParameterType' => 'ConduitListParameterType',
'ConduitStringParameterType' => 'ConduitParameterType',
'ConduitTokenGarbageCollector' => 'PhabricatorGarbageCollector',
'ConduitUserListParameterType' => 'ConduitListParameterType',
'ConduitWildParameterType' => 'ConduitListParameterType',
@ -4315,6 +4338,7 @@ phutil_register_library_map(array(
'DifferentialDiffContentRemovedHeraldField' => 'DifferentialDiffHeraldField',
'DifferentialDiffCreateController' => 'DifferentialController',
'DifferentialDiffEditor' => 'PhabricatorApplicationTransactionEditor',
'DifferentialDiffExtractionEngine' => 'Phobject',
'DifferentialDiffHeraldField' => 'HeraldField',
'DifferentialDiffHeraldFieldGroup' => 'HeraldFieldGroup',
'DifferentialDiffInlineCommentQuery' => 'PhabricatorDiffInlineCommentQuery',
@ -4478,17 +4502,15 @@ phutil_register_library_map(array(
'DiffusionAuditorsAddAuditorsHeraldAction' => 'DiffusionAuditorsHeraldAction',
'DiffusionAuditorsAddSelfHeraldAction' => 'DiffusionAuditorsHeraldAction',
'DiffusionAuditorsHeraldAction' => 'HeraldAction',
'DiffusionBlameConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBlameQuery' => 'DiffusionQuery',
'DiffusionBlockHeraldAction' => 'HeraldAction',
'DiffusionBranchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBranchTableController' => 'DiffusionController',
'DiffusionBranchTableView' => 'DiffusionView',
'DiffusionBrowseController' => 'DiffusionController',
'DiffusionBrowseDirectoryController' => 'DiffusionBrowseController',
'DiffusionBrowseFileController' => 'DiffusionBrowseController',
'DiffusionBrowseMainController' => 'DiffusionBrowseController',
'DiffusionBrowseQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBrowseResultSet' => 'Phobject',
'DiffusionBrowseSearchController' => 'DiffusionBrowseController',
'DiffusionBrowseTableView' => 'DiffusionView',
'DiffusionCachedResolveRefsQuery' => 'DiffusionLowLevelQuery',
'DiffusionChangeController' => 'DiffusionController',
@ -4549,17 +4571,15 @@ phutil_register_library_map(array(
'DiffusionExternalController' => 'DiffusionController',
'DiffusionExternalSymbolQuery' => 'Phobject',
'DiffusionExternalSymbolsSource' => 'Phobject',
'DiffusionFileContent' => 'Phobject',
'DiffusionFileContentQuery' => 'DiffusionQuery',
'DiffusionFileContentQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionFindSymbolsConduitAPIMethod' => 'DiffusionConduitAPIMethod',
'DiffusionGetCommitsConduitAPIMethod' => 'DiffusionConduitAPIMethod',
'DiffusionGetLintMessagesConduitAPIMethod' => 'DiffusionConduitAPIMethod',
'DiffusionGetRecentCommitsByPathConduitAPIMethod' => 'DiffusionConduitAPIMethod',
'DiffusionGitBlameQuery' => 'DiffusionBlameQuery',
'DiffusionGitBranch' => 'Phobject',
'DiffusionGitBranchTestCase' => 'PhabricatorTestCase',
'DiffusionGitFileContentQuery' => 'DiffusionFileContentQuery',
'DiffusionGitFileContentQueryTestCase' => 'PhabricatorTestCase',
'DiffusionGitRawDiffQuery' => 'DiffusionRawDiffQuery',
'DiffusionGitReceivePackSSHWorkflow' => 'DiffusionGitSSHWorkflow',
'DiffusionGitRequest' => 'DiffusionRequest',
@ -4576,7 +4596,6 @@ phutil_register_library_map(array(
'DiffusionLastModifiedQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionLintController' => 'DiffusionController',
'DiffusionLintCountQuery' => 'PhabricatorQuery',
'DiffusionLintDetailsController' => 'DiffusionController',
'DiffusionLintSaveRunner' => 'Phobject',
'DiffusionLookSoonConduitAPIMethod' => 'DiffusionConduitAPIMethod',
'DiffusionLowLevelCommitFieldsQuery' => 'DiffusionLowLevelQuery',
@ -4588,6 +4607,7 @@ phutil_register_library_map(array(
'DiffusionLowLevelParentsQuery' => 'DiffusionLowLevelQuery',
'DiffusionLowLevelQuery' => 'Phobject',
'DiffusionLowLevelResolveRefsQuery' => 'DiffusionLowLevelQuery',
'DiffusionMercurialBlameQuery' => 'DiffusionBlameQuery',
'DiffusionMercurialFileContentQuery' => 'DiffusionFileContentQuery',
'DiffusionMercurialRawDiffQuery' => 'DiffusionRawDiffQuery',
'DiffusionMercurialRequest' => 'DiffusionRequest',
@ -4699,6 +4719,7 @@ phutil_register_library_map(array(
'DiffusionSubversionServeSSHWorkflow' => 'DiffusionSubversionSSHWorkflow',
'DiffusionSubversionWireProtocol' => 'Phobject',
'DiffusionSubversionWireProtocolTestCase' => 'PhabricatorTestCase',
'DiffusionSvnBlameQuery' => 'DiffusionBlameQuery',
'DiffusionSvnFileContentQuery' => 'DiffusionFileContentQuery',
'DiffusionSvnRawDiffQuery' => 'DiffusionRawDiffQuery',
'DiffusionSvnRequest' => 'DiffusionRequest',
@ -4900,6 +4921,7 @@ phutil_register_library_map(array(
'DrydockDAO',
'PhabricatorPolicyInterface',
),
'DrydockRepositoryOperationDismissController' => 'DrydockController',
'DrydockRepositoryOperationListController' => 'DrydockController',
'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType',
'DrydockRepositoryOperationQuery' => 'DrydockQuery',
@ -5205,6 +5227,8 @@ phutil_register_library_map(array(
'HeraldNewObjectField' => 'HeraldField',
'HeraldNotifyActionGroup' => 'HeraldActionGroup',
'HeraldObjectTranscript' => 'Phobject',
'HeraldPhameBlogAdapter' => 'HeraldAdapter',
'HeraldPhamePostAdapter' => 'HeraldAdapter',
'HeraldPholioMockAdapter' => 'HeraldAdapter',
'HeraldPonderQuestionAdapter' => 'HeraldAdapter',
'HeraldPreCommitAdapter' => 'HeraldAdapter',
@ -5603,6 +5627,7 @@ phutil_register_library_map(array(
'PHUIListItemView' => 'AphrontTagView',
'PHUIListView' => 'AphrontTagView',
'PHUIListViewTestCase' => 'PhabricatorTestCase',
'PHUIMainMenuView' => 'AphrontView',
'PHUIObjectBoxView' => 'AphrontView',
'PHUIObjectItemListExample' => 'PhabricatorUIExample',
'PHUIObjectItemListView' => 'AphrontTagView',
@ -5851,6 +5876,7 @@ phutil_register_library_map(array(
'PhabricatorAuthListController' => 'PhabricatorAuthProviderConfigController',
'PhabricatorAuthLoginController' => 'PhabricatorAuthController',
'PhabricatorAuthLoginHandler' => 'Phobject',
'PhabricatorAuthMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorAuthManagementCachePKCS8Workflow' => 'PhabricatorAuthManagementWorkflow',
'PhabricatorAuthManagementLDAPWorkflow' => 'PhabricatorAuthManagementWorkflow',
'PhabricatorAuthManagementListFactorsWorkflow' => 'PhabricatorAuthManagementWorkflow',
@ -5933,6 +5959,7 @@ phutil_register_library_map(array(
'PhabricatorBadgesDAO' => 'PhabricatorLiskDAO',
'PhabricatorBadgesDefaultEditCapability' => 'PhabricatorPolicyCapability',
'PhabricatorBadgesEditController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditEngine' => 'PhabricatorEditEngine',
'PhabricatorBadgesEditRecipientsController' => 'PhabricatorBadgesController',
'PhabricatorBadgesEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorBadgesIconSet' => 'PhabricatorIconSet',
@ -6352,7 +6379,10 @@ phutil_register_library_map(array(
'PhabricatorDiffPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorDifferenceEngine' => 'Phobject',
'PhabricatorDifferentialApplication' => 'PhabricatorApplication',
'PhabricatorDifferentialAttachCommitWorkflow' => 'PhabricatorDifferentialManagementWorkflow',
'PhabricatorDifferentialConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorDifferentialExtractWorkflow' => 'PhabricatorDifferentialManagementWorkflow',
'PhabricatorDifferentialManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorDifferentialRevisionTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorDiffusionApplication' => 'PhabricatorApplication',
'PhabricatorDiffusionConfigOptions' => 'PhabricatorApplicationConfigOptions',
@ -6618,6 +6648,7 @@ phutil_register_library_map(array(
'PhabricatorHelpDocumentationController' => 'PhabricatorHelpController',
'PhabricatorHelpEditorProtocolController' => 'PhabricatorHelpController',
'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController',
'PhabricatorHelpMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorHeraldApplication' => 'PhabricatorApplication',
'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorHomeApplication' => 'PhabricatorApplication',
@ -6636,6 +6667,7 @@ phutil_register_library_map(array(
'PhabricatorIRCProtocolAdapter' => 'PhabricatorProtocolAdapter',
'PhabricatorIconRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorIconSet' => 'Phobject',
'PhabricatorIconSetEditField' => 'PhabricatorEditField',
'PhabricatorIconSetIcon' => 'Phobject',
'PhabricatorImageMacroRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorImageTransformer' => 'Phobject',
@ -6734,6 +6766,7 @@ phutil_register_library_map(array(
'PhabricatorMailSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorMailTarget' => 'Phobject',
'PhabricatorMailgunConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorMainMenuBarExtension' => 'Phobject',
'PhabricatorMainMenuSearchView' => 'AphrontView',
'PhabricatorMainMenuView' => 'AphrontView',
'PhabricatorManagementWorkflow' => 'PhutilArgumentWorkflow',
@ -7023,6 +7056,7 @@ phutil_register_library_map(array(
'PhabricatorPeopleLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorPeopleLogSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorPeopleLogsController' => 'PhabricatorPeopleController',
'PhabricatorPeopleMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorPeopleNewController' => 'PhabricatorPeopleController',
'PhabricatorPeopleNoOwnerDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorPeopleOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
@ -7144,6 +7178,7 @@ phutil_register_library_map(array(
'PhabricatorCustomFieldInterface',
'PhabricatorDestructibleInterface',
'PhabricatorFulltextInterface',
'PhabricatorConduitResultInterface',
),
'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction',
'PhabricatorProjectApplication' => 'PhabricatorApplication',
@ -7185,14 +7220,17 @@ phutil_register_library_map(array(
'PhabricatorProjectDAO' => 'PhabricatorLiskDAO',
'PhabricatorProjectDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField',
'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController',
'PhabricatorProjectEditController' => 'PhabricatorProjectController',
'PhabricatorProjectEditEngine' => 'PhabricatorEditEngine',
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
'PhabricatorProjectFeedController' => 'PhabricatorProjectController',
'PhabricatorProjectFulltextEngine' => 'PhabricatorFulltextEngine',
'PhabricatorProjectHeraldAction' => 'HeraldAction',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
'PhabricatorProjectLogicalAndDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectListView' => 'AphrontView',
'PhabricatorProjectLockController' => 'PhabricatorProjectController',
'PhabricatorProjectLogicalAncestorDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectLogicalDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectLogicalOrNotDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'PhabricatorProjectLogicalUserDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
@ -7203,6 +7241,7 @@ phutil_register_library_map(array(
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
'PhabricatorProjectMembersPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
'PhabricatorProjectMilestonesController' => 'PhabricatorProjectController',
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
'PhabricatorProjectNameContextFreeGrammar' => 'PhutilContextFreeGrammar',
'PhabricatorProjectNoProjectsDatasource' => 'PhabricatorTypeaheadDatasource',
@ -7225,10 +7264,12 @@ phutil_register_library_map(array(
'PhabricatorStandardCustomFieldInterface',
),
'PhabricatorProjectStatus' => 'Phobject',
'PhabricatorProjectSubprojectsController' => 'PhabricatorProjectController',
'PhabricatorProjectTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorProjectTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProjectTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProjectTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorProjectTypeConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'PhabricatorProjectUIEventListener' => 'PhabricatorEventListener',
'PhabricatorProjectUpdateController' => 'PhabricatorProjectController',
'PhabricatorProjectUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
@ -7468,6 +7509,7 @@ phutil_register_library_map(array(
'PhabricatorSettingsAdjustController' => 'PhabricatorController',
'PhabricatorSettingsApplication' => 'PhabricatorApplication',
'PhabricatorSettingsMainController' => 'PhabricatorController',
'PhabricatorSettingsMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorSettingsPanel' => 'Phobject',
'PhabricatorSetupCheck' => 'Phobject',
'PhabricatorSetupCheckTestCase' => 'PhabricatorTestCase',
@ -7584,6 +7626,7 @@ phutil_register_library_map(array(
'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorStorageSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorStreamingProtocolAdapter' => 'PhabricatorProtocolAdapter',
'PhabricatorStringListEditField' => 'PhabricatorEditField',
'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorSubscribersEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
@ -7831,10 +7874,12 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorConduitResultInterface',
),
'PhameBlogArchiveController' => 'PhameBlogController',
'PhameBlogController' => 'PhameController',
'PhameBlogCreateCapability' => 'PhabricatorPolicyCapability',
'PhameBlogEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhameBlogEditController' => 'PhameBlogController',
'PhameBlogEditEngine' => 'PhabricatorEditEngine',
'PhameBlogEditor' => 'PhabricatorApplicationTransactionEditor',
@ -7845,20 +7890,20 @@ phutil_register_library_map(array(
'PhameBlogProfilePictureController' => 'PhameBlogController',
'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhameBlogSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhameBlogSite' => 'PhameSite',
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',
'PhameBlogTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhameBlogViewController' => 'PhameLiveController',
'PhameConduitAPIMethod' => 'ConduitAPIMethod',
'PhameConstants' => 'Phobject',
'PhameController' => 'PhabricatorController',
'PhameCreatePostConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameDAO' => 'PhabricatorLiskDAO',
'PhameDescriptionView' => 'AphrontTagView',
'PhameDraftListView' => 'AphrontTagView',
'PhameHomeController' => 'PhamePostController',
'PhameLiveController' => 'PhameController',
'PhameNextPostView' => 'AphrontTagView',
'PhamePost' => array(
'PhameDAO',
'PhabricatorPolicyInterface',
@ -7869,10 +7914,13 @@ phutil_register_library_map(array(
'PhabricatorSubscribableInterface',
'PhabricatorDestructibleInterface',
'PhabricatorTokenReceiverInterface',
'PhabricatorConduitResultInterface',
),
'PhamePostCommentController' => 'PhamePostController',
'PhamePostController' => 'PhameController',
'PhamePostEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'PhamePostEditController' => 'PhamePostController',
'PhamePostEditEngine' => 'PhabricatorEditEngine',
'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor',
'PhamePostHistoryController' => 'PhamePostController',
'PhamePostListController' => 'PhamePostController',
@ -7882,13 +7930,12 @@ phutil_register_library_map(array(
'PhamePostPublishController' => 'PhamePostController',
'PhamePostQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhamePostReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhamePostSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'PhamePostSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhamePostTransaction' => 'PhabricatorApplicationTransaction',
'PhamePostTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PhamePostTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhamePostViewController' => 'PhameLiveController',
'PhameQueryConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameQueryPostsConduitAPIMethod' => 'PhameConduitAPIMethod',
'PhameSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhameSite' => 'PhabricatorSite',
'PhluxController' => 'PhabricatorController',
@ -8290,10 +8337,12 @@ phutil_register_library_map(array(
'ProjectDefaultEditCapability' => 'PhabricatorPolicyCapability',
'ProjectDefaultJoinCapability' => 'PhabricatorPolicyCapability',
'ProjectDefaultViewCapability' => 'PhabricatorPolicyCapability',
'ProjectEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',
'ProjectQueryConduitAPIMethod' => 'ProjectConduitAPIMethod',
'ProjectRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'ProjectRemarkupRuleTestCase' => 'PhabricatorTestCase',
'ProjectReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'ProjectSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'QueryFormattingTestCase' => 'PhabricatorTestCase',
'ReleephAuthorFieldSpecification' => 'ReleephFieldSpecification',
'ReleephBranch' => array(

View file

@ -123,6 +123,11 @@ final class AphrontRequest extends Phobject {
*/
public function getInt($name, $default = null) {
if (isset($this->requestData[$name])) {
// Converting from array to int is "undefined". Don't rely on whatever
// PHP decides to do.
if (is_array($this->requestData[$name])) {
return $default;
}
return (int)$this->requestData[$name];
} else {
return $default;

View file

@ -46,7 +46,7 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
'diffusion-audit-'.$commit->getPHID(),
pht(
'Commit %s',
'r'.$repository->getCallsign().$commit->getCommitIdentifier()),
$commit->getMonogram()),
);
}

View file

@ -222,22 +222,23 @@ final class PhabricatorAuditManagementDeleteWorkflow
return $list;
}
private function loadRepos($callsigns) {
$callsigns = $this->parseList($callsigns);
if (!$callsigns) {
private function loadRepos($identifiers) {
$identifiers = $this->parseList($identifiers);
if (!$identifiers) {
return null;
}
$repos = id(new PhabricatorRepositoryQuery())
$query = id(new PhabricatorRepositoryQuery())
->setViewer($this->getViewer())
->withCallsigns($callsigns)
->execute();
$repos = mpull($repos, null, 'getCallsign');
->withIdentifiers($identifiers);
foreach ($callsigns as $sign) {
if (empty($repos[$sign])) {
$repos = $query->execute();
$map = $query->getIdentifierMap();
foreach ($identifiers as $identifier) {
if (empty($map[$identifier])) {
throw new PhutilArgumentUsageException(
pht('No such repository with callsign "%s"!', $sign));
pht('No repository "%s" exists!', $identifier));
}
}

View file

@ -38,48 +38,6 @@ final class PhabricatorAuthApplication extends PhabricatorApplication {
return array();
}
public function buildMainMenuItems(
PhabricatorUser $user,
PhabricatorController $controller = null) {
$items = array();
if ($user->isLoggedIn()) {
$item = id(new PHUIListItemView())
->addClass('core-menu-item')
->setName(pht('Log Out'))
->setIcon('fa-sign-out')
->setWorkflow(true)
->setHref('/logout/')
->setSelected(($controller instanceof PhabricatorLogoutController))
->setAural(pht('Log Out'))
->setOrder(900);
$items[] = $item;
} else {
if ($controller instanceof PhabricatorAuthController) {
// Don't show the "Login" item on auth controllers, since they're
// generally all related to logging in anyway.
} else {
$uri = new PhutilURI('/auth/start/');
if ($controller) {
$path = $controller->getRequest()->getPath();
$uri->setQueryParam('next', $path);
}
$item = id(new PHUIListItemView())
->addClass('core-menu-item')
->setName(pht('Log In'))
// TODO: Login icon?
->setIcon('fa-sign-in')
->setHref($uri)
->setAural(pht('Log In'))
->setOrder(900);
$items[] = $item;
}
}
return $items;
}
public function getApplicationGroup() {
return self::GROUP_ADMIN;
}

View file

@ -0,0 +1,73 @@
<?php
final class PhabricatorAuthMainMenuBarExtension
extends PhabricatorMainMenuBarExtension {
const MAINMENUBARKEY = 'auth';
public function isExtensionEnabledForViewer(PhabricatorUser $viewer) {
return true;
}
public function buildMainMenus() {
$viewer = $this->getViewer();
if ($viewer->isLoggedIn()) {
return array(
$this->buildLogoutMenu(),
);
}
$controller = $this->getController();
if ($controller instanceof PhabricatorAuthController) {
// Don't show the "Login" item on auth controllers, since they're
// generally all related to logging in anyway.
return array();
}
return array(
$this->buildLoginMenu(),
);
}
private function buildLogoutMenu() {
$controller = $this->getController();
$is_selected = ($controller instanceof PhabricatorLogoutController);
$bar_item = id(new PHUIListItemView())
->addClass('core-menu-item')
->setName(pht('Log Out'))
->setIcon('fa-sign-out')
->setWorkflow(true)
->setHref('/logout/')
->setSelected($is_selected)
->setAural(pht('Log Out'));
return id(new PHUIMainMenuView())
->setOrder(900)
->setMenuBarItem($bar_item);
}
private function buildLoginMenu() {
$controller = $this->getController();
$uri = new PhutilURI('/auth/start/');
if ($controller) {
$path = $controller->getRequest()->getPath();
$uri->setQueryParam('next', $path);
}
$bar_item = id(new PHUIListItemView())
->addClass('core-menu-item')
->setName(pht('Log In'))
->setIcon('fa-sign-in')
->setHref($uri)
->setAural(pht('Log In'));
return id(new PHUIMainMenuView())
->setOrder(900)
->setMenuBarItem($bar_item);
}
}

View file

@ -1,186 +1,12 @@
<?php
final class PhabricatorBadgesEditController
extends PhabricatorBadgesController {
final class PhabricatorBadgesEditController extends
PhabricatorBadgesController {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
if ($id) {
$badge = id(new PhabricatorBadgesQuery())
->setViewer($viewer)
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$badge) {
return new Aphront404Response();
}
$is_new = false;
} else {
$this->requireApplicationCapability(
PhabricatorBadgesCreateCapability::CAPABILITY);
$badge = PhabricatorBadgesBadge::initializeNewBadge($viewer);
$is_new = true;
}
if ($is_new) {
$title = pht('Create Badge');
$button_text = pht('Create Badge');
$cancel_uri = $this->getApplicationURI();
} else {
$title = pht(
'Edit %s',
$badge->getName());
$button_text = pht('Save Changes');
$cancel_uri = $this->getApplicationURI('view/'.$id.'/');
}
$e_name = true;
$v_name = $badge->getName();
$v_icon = $badge->getIcon();
$v_flav = $badge->getFlavor();
$v_desc = $badge->getDescription();
$v_qual = $badge->getQuality();
$v_edit = $badge->getEditPolicy();
$validation_exception = null;
if ($request->isFormPost()) {
$v_name = $request->getStr('name');
$v_flav = $request->getStr('flavor');
$v_desc = $request->getStr('description');
$v_icon = $request->getStr('icon');
$v_qual = $request->getStr('quality');
$v_view = $request->getStr('viewPolicy');
$v_edit = $request->getStr('editPolicy');
$type_name = PhabricatorBadgesTransaction::TYPE_NAME;
$type_flav = PhabricatorBadgesTransaction::TYPE_FLAVOR;
$type_desc = PhabricatorBadgesTransaction::TYPE_DESCRIPTION;
$type_icon = PhabricatorBadgesTransaction::TYPE_ICON;
$type_qual = PhabricatorBadgesTransaction::TYPE_QUALITY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
$xactions = array();
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_name)
->setNewValue($v_name);
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_flav)
->setNewValue($v_flav);
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_desc)
->setNewValue($v_desc);
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_icon)
->setNewValue($v_icon);
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_qual)
->setNewValue($v_qual);
$xactions[] = id(new PhabricatorBadgesTransaction())
->setTransactionType($type_edit)
->setNewValue($v_edit);
$editor = id(new PhabricatorBadgesEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true);
try {
$editor->applyTransactions($badge, $xactions);
$return_uri = $this->getApplicationURI('view/'.$badge->getID().'/');
return id(new AphrontRedirectResponse())->setURI($return_uri);
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
$e_name = $ex->getShortMessage($type_name);
}
}
$policies = id(new PhabricatorPolicyQuery())
->setViewer($viewer)
->setObject($badge)
->execute();
$form = id(new AphrontFormView())
->setUser($viewer)
->appendChild(
id(new AphrontFormTextControl())
->setName('name')
->setLabel(pht('Name'))
->setValue($v_name)
->setError($e_name))
->appendChild(
id(new AphrontFormTextControl())
->setName('flavor')
->setLabel(pht('Flavor Text'))
->setValue($v_flav))
->appendChild(
id(new PHUIFormIconSetControl())
->setLabel(pht('Icon'))
->setName('icon')
->setIconSet(new PhabricatorBadgesIconSet())
->setValue($v_icon))
->appendChild(
id(new AphrontFormSelectControl())
->setName('quality')
->setLabel(pht('Quality'))
->setValue($v_qual)
->setOptions($badge->getQualityNameMap()))
->appendChild(
id(new PhabricatorRemarkupControl())
->setUser($viewer)
->setName('description')
->setLabel(pht('Description'))
->setValue($v_desc))
->appendChild(
id(new AphrontFormPolicyControl())
->setName('editPolicy')
->setPolicyObject($badge)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setValue($v_edit)
->setPolicies($policies))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue($button_text)
->addCancelButton($cancel_uri));
$crumbs = $this->buildApplicationCrumbs();
if ($is_new) {
$crumbs->addTextCrumb(pht('Create Badge'));
} else {
$crumbs->addTextCrumb(
$badge->getName(),
'/badges/view/'.$badge->getID().'/');
$crumbs->addTextCrumb(pht('Edit'));
}
$box = id(new PHUIObjectBoxView())
->setValidationException($validation_exception)
->setHeaderText($title)
->appendChild($form);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$box,
));
return id(new PhabricatorBadgesEditEngine())
->setController($this)
->buildResponse();
}
}

View file

@ -0,0 +1,98 @@
<?php
final class PhabricatorBadgesEditEngine
extends PhabricatorEditEngine {
const ENGINECONST = 'badges.badge';
public function getEngineName() {
return pht('Badges');
}
public function getEngineApplicationClass() {
return 'PhabricatorBadgesApplication';
}
public function getSummaryHeader() {
return pht('Configure Badges Forms');
}
public function getSummaryText() {
return pht('Configure creation and editing forms in Badges.');
}
protected function newEditableObject() {
return PhabricatorBadgesBadge::initializeNewBadge($this->getViewer());
}
protected function newObjectQuery() {
return new PhabricatorBadgesQuery();
}
protected function getObjectCreateTitleText($object) {
return pht('Create New Badge');
}
protected function getObjectEditTitleText($object) {
return pht('Edit %s', $object->getName());
}
protected function getObjectEditShortText($object) {
return $object->getName();
}
protected function getObjectCreateShortText() {
return pht('Create Badge');
}
protected function getCommentViewHeaderText($object) {
return pht('Add Comment');
}
protected function getCommentViewButtonText($object) {
return pht('Submit');
}
protected function getObjectViewURI($object) {
return $object->getViewURI();
}
protected function buildCustomEditFields($object) {
return array(
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setDescription(pht('Badge name.'))
->setTransactionType(PhabricatorBadgesTransaction::TYPE_NAME)
->setValue($object->getName()),
id(new PhabricatorTextEditField())
->setKey('flavor')
->setLabel(pht('Flavor text'))
->setDescription(pht('Short description of the badge.'))
->setValue($object->getFlavor())
->setTransactionType(PhabricatorBadgesTransaction::TYPE_FLAVOR),
id(new PhabricatorIconSetEditField())
->setKey('icon')
->setLabel(pht('Icon'))
->setIconSet(new PhabricatorBadgesIconSet())
->setTransactionType(PhabricatorBadgesTransaction::TYPE_ICON)
->setConduitDescription(pht('Change the badge icon.'))
->setConduitTypeDescription(pht('New badge icon.'))
->setValue($object->getIcon()),
id(new PhabricatorSelectEditField())
->setKey('quality')
->setLabel(pht('Quality'))
->setValue($object->getQuality())
->setTransactionType(PhabricatorBadgesTransaction::TYPE_QUALITY)
->setOptions($object->getQualityNameMap()),
id(new PhabricatorRemarkupEditField())
->setKey('description')
->setLabel(pht('Description'))
->setDescription(pht('Badge long description.'))
->setTransactionType(PhabricatorBadgesTransaction::TYPE_DESCRIPTION)
->setValue($object->getDescription()),
);
}
}

View file

@ -111,6 +111,10 @@ final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO
return $this->assertAttached($this->recipientPHIDs);
}
public function getViewURI() {
return '/badges/view/'.$this->getID().'/';
}
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));

View file

@ -1,7 +1,7 @@
<?php
final class ConduitPHIDParameterType
extends ConduitListParameterType {
extends ConduitParameterType {
protected function getParameterValue(array $request, $key) {
$value = parent::getParameterValue($request, $key);

View file

@ -1,7 +1,7 @@
<?php
final class ConduitStringParameterType
extends ConduitListParameterType {
extends ConduitParameterType {
protected function getParameterValue(array $request, $key) {
$value = parent::getParameterValue($request, $key);

View file

@ -24,8 +24,7 @@ abstract class PhabricatorConfigOptionType extends Phobject {
$value) {
if (is_array($value)) {
$json = new PhutilJSON();
return $json->encodeFormatted($value);
return PhabricatorConfigJSON::prettyPrintJSON($value);
} else {
return $value;
}

View file

@ -64,7 +64,7 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$line .= ' called at ['.$entry['file'].':'.$entry['line'].']';
try {
$user = $this->getRequest()->getUser();
$href = $user->loadEditorLink($entry['file'], $entry['line'], '');
$href = $user->loadEditorLink($entry['file'], $entry['line'], null);
} catch (Exception $ex) {
// The database can be inaccessible.
}

View file

@ -146,7 +146,7 @@ final class DifferentialRevisionLandController extends DifferentialController {
$looksoon = new ConduitCall(
'diffusion.looksoon',
array(
'callsigns' => array($repository->getCallsign()),
'repositories' => array($repository->getPHID()),
));
$looksoon->setUser($request->getUser());
$looksoon->execute();
@ -155,7 +155,7 @@ final class DifferentialRevisionLandController extends DifferentialController {
}
private function lockRepository($repository) {
$lock_name = __CLASS__.':'.($repository->getCallsign());
$lock_name = __CLASS__.':'.($repository->getPHID());
$lock = PhabricatorGlobalLock::newLock($lock_name);
$lock->lock();
return $lock;

View file

@ -94,8 +94,7 @@ final class DifferentialRevisionOperationController
->setUser($viewer)
->appendRemarkupInstructions(
pht(
'In theory, this will do approximately what `arc land` would do. '.
'In practice, you will have a riveting adventure instead.'))
'(NOTE) This feature is new and experimental.'))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Onto Branch'))
@ -103,11 +102,7 @@ final class DifferentialRevisionOperationController
->setLimit(1)
->setError($e_ref)
->setValue($v_ref)
->setDatasource($ref_datasource))
->appendRemarkupInstructions(
pht(
'(WARNING) THIS FEATURE IS EXPERIMENTAL AND DANGEROUS! USE IT AT '.
'YOUR OWN RISK!'));
->setDatasource($ref_datasource));
return $this->newDialog()
->setWidth(AphrontDialogView::WIDTH_FORM)
@ -115,7 +110,7 @@ final class DifferentialRevisionOperationController
->setErrors($errors)
->appendForm($form)
->addCancelButton($detail_uri)
->addSubmitButton(pht('Mutate Repository Unpredictably'));
->addSubmitButton(pht('Land Revision'));
}
private function newRefQuery(PhabricatorRepository $repository) {

View file

@ -1047,6 +1047,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$operations = id(new DrydockRepositoryOperationQuery())
->setViewer($viewer)
->withObjectPHIDs(array($revision->getPHID()))
->withIsDismissed(false)
->withOperationTypes(
array(
DrydockLandRepositoryOperation::OPCONST,

View file

@ -0,0 +1,276 @@
<?php
final class DifferentialDiffExtractionEngine extends Phobject {
private $viewer;
private $authorPHID;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
}
public function getViewer() {
return $this->viewer;
}
public function setAuthorPHID($author_phid) {
$this->authorPHID = $author_phid;
return $this;
}
public function getAuthorPHID() {
return $this->authorPHID;
}
public function newDiffFromCommit(PhabricatorRepositoryCommit $commit) {
$viewer = $this->getViewer();
$repository = $commit->getRepository();
$identifier = $commit->getCommitIdentifier();
$monogram = $commit->getMonogram();
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $viewer,
'repository' => $repository,
));
$raw_diff = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
$drequest,
'diffusion.rawdiffquery',
array(
'commit' => $identifier,
));
// TODO: Support adds, deletes and moves under SVN.
if (strlen($raw_diff)) {
$changes = id(new ArcanistDiffParser())->parseDiff($raw_diff);
} else {
// This is an empty diff, maybe made with `git commit --allow-empty`.
// NOTE: These diffs have the same tree hash as their ancestors, so
// they may attach to revisions in an unexpected way. Just let this
// happen for now, although it might make sense to special case it
// eventually.
$changes = array();
}
$diff = DifferentialDiff::newFromRawChanges($viewer, $changes)
->setRepositoryPHID($repository->getPHID())
->setCreationMethod('commit')
->setSourceControlSystem($repository->getVersionControlSystem())
->setLintStatus(DifferentialLintStatus::LINT_AUTO_SKIP)
->setUnitStatus(DifferentialUnitStatus::UNIT_AUTO_SKIP)
->setDateCreated($commit->getEpoch())
->setDescription($monogram);
$author_phid = $this->getAuthorPHID();
if ($author_phid !== null) {
$diff->setAuthorPHID($author_phid);
}
$parents = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
$drequest,
'diffusion.commitparentsquery',
array(
'commit' => $identifier,
));
if ($parents) {
$diff->setSourceControlBaseRevision(head($parents));
}
// TODO: Attach binary files.
return $diff->save();
}
public function isDiffChangedBeforeCommit(
PhabricatorRepositoryCommit $commit,
DifferentialDiff $old,
DifferentialDiff $new) {
$viewer = $this->getViewer();
$repository = $commit->getRepository();
$identifier = $commit->getCommitIdentifier();
$vs_changesets = array();
foreach ($old->getChangesets() as $changeset) {
$path = $changeset->getAbsoluteRepositoryPath($repository, $old);
$path = ltrim($path, '/');
$vs_changesets[$path] = $changeset;
}
$changesets = array();
foreach ($new->getChangesets() as $changeset) {
$path = $changeset->getAbsoluteRepositoryPath($repository, $new);
$path = ltrim($path, '/');
$changesets[$path] = $changeset;
}
if (array_fill_keys(array_keys($changesets), true) !=
array_fill_keys(array_keys($vs_changesets), true)) {
return true;
}
$file_phids = array();
foreach ($vs_changesets as $changeset) {
$metadata = $changeset->getMetadata();
$file_phid = idx($metadata, 'new:binary-phid');
if ($file_phid) {
$file_phids[$file_phid] = $file_phid;
}
}
$files = array();
if ($file_phids) {
$files = id(new PhabricatorFileQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs($file_phids)
->execute();
$files = mpull($files, null, 'getPHID');
}
foreach ($changesets as $path => $changeset) {
$vs_changeset = $vs_changesets[$path];
$file_phid = idx($vs_changeset->getMetadata(), 'new:binary-phid');
if ($file_phid) {
if (!isset($files[$file_phid])) {
return true;
}
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $viewer,
'repository' => $repository,
));
$response = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
$drequest,
'diffusion.filecontentquery',
array(
'commit' => $identifier,
'path' => $path,
));
$new_file_phid = $response['filePHID'];
if (!$new_file_phid) {
return true;
}
$new_file = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withPHIDs(array($new_file_phid))
->executeOne();
if (!$new_file) {
return true;
}
if ($files[$file_phid]->loadFileData() != $new_file->loadFileData()) {
return true;
}
} else {
$context = implode("\n", $changeset->makeChangesWithContext());
$vs_context = implode("\n", $vs_changeset->makeChangesWithContext());
// We couldn't just compare $context and $vs_context because following
// diffs will be considered different:
//
// -(empty line)
// -echo 'test';
// (empty line)
//
// (empty line)
// -echo "test";
// -(empty line)
$hunk = id(new DifferentialModernHunk())->setChanges($context);
$vs_hunk = id(new DifferentialModernHunk())->setChanges($vs_context);
if ($hunk->makeOldFile() != $vs_hunk->makeOldFile() ||
$hunk->makeNewFile() != $vs_hunk->makeNewFile()) {
return true;
}
}
}
return false;
}
public function updateRevisionWithCommit(
DifferentialRevision $revision,
PhabricatorRepositoryCommit $commit,
array $more_xactions,
PhabricatorContentSource $content_source) {
$viewer = $this->getViewer();
$result_data = array();
$new_diff = $this->newDiffFromCommit($commit);
$old_diff = $revision->getActiveDiff();
$changed_uri = null;
if ($old_diff) {
$old_diff = id(new DifferentialDiffQuery())
->setViewer($viewer)
->withIDs(array($old_diff->getID()))
->needChangesets(true)
->executeOne();
if ($old_diff) {
$has_changed = $this->isDiffChangedBeforeCommit(
$commit,
$old_diff,
$new_diff);
if ($has_changed) {
$result_data['vsDiff'] = $old_diff->getID();
$revision_monogram = $revision->getMonogram();
$old_id = $old_diff->getID();
$new_id = $new_diff->getID();
$changed_uri = "/{$revision_monogram}?vs={$old_id}&id={$new_id}#toc";
$changed_uri = PhabricatorEnv::getProductionURI($changed_uri);
}
}
}
$xactions = array();
$xactions[] = id(new DifferentialTransaction())
->setTransactionType(DifferentialTransaction::TYPE_UPDATE)
->setIgnoreOnNoEffect(true)
->setNewValue($new_diff->getPHID())
->setMetadataValue('isCommitUpdate', true);
foreach ($more_xactions as $more_xaction) {
$xactions[] = $more_xaction;
}
$editor = id(new DifferentialTransactionEditor())
->setActor($viewer)
->setContinueOnMissingFields(true)
->setContentSource($content_source)
->setChangedPriorToCommitURI($changed_uri)
->setIsCloseByCommit(true);
$author_phid = $this->getAuthorPHID();
if ($author_phid !== null) {
$editor->setActingAsPHID($author_phid);
}
try {
$editor->applyTransactions($revision, $xactions);
} catch (PhabricatorApplicationTransactionNoEffectException $ex) {
// NOTE: We've marked transactions other than the CLOSE transaction
// as ignored when they don't have an effect, so this means that we
// lost a race to close the revision. That's perfectly fine, we can
// just continue normally.
}
return $result_data;
}
}

View file

@ -0,0 +1,90 @@
<?php
final class PhabricatorDifferentialAttachCommitWorkflow
extends PhabricatorDifferentialManagementWorkflow {
protected function didConstruct() {
$this
->setName('attach-commit')
->setExamples('**attach-commit** __commit__ __revision__')
->setSynopsis(pht('Forcefully attach a commit to a revision.'))
->setArguments(
array(
array(
'name' => 'argv',
'wildcard' => true,
'help' => pht('Commit, and a revision to attach it to.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$argv = $args->getArg('argv');
if (count($argv) !== 2) {
throw new PhutilArgumentUsageException(
pht('Specify a commit and a revision to attach it to.'));
}
$commit_name = head($argv);
$revision_name = last($argv);
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(array($commit_name))
->executeOne();
if (!$commit) {
throw new PhutilArgumentUsageException(
pht('Commit "%s" does not exist.', $commit_name));
}
$revision = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withNames(array($revision_name))
->executeOne();
if (!$revision) {
throw new PhutilArgumentUsageException(
pht('Revision "%s" does not exist.', $revision_name));
}
if (!($revision instanceof DifferentialRevision)) {
throw new PhutilArgumentUsageException(
pht('Object "%s" must be a Differential revision.', $revision_name));
}
// Reload the revision to get the active diff.
$revision = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withIDs(array($revision->getID()))
->needActiveDiffs(true)
->executeOne();
$differential_phid = id(new PhabricatorDifferentialApplication())
->getPHID();
$extraction_engine = id(new DifferentialDiffExtractionEngine())
->setViewer($viewer)
->setAuthorPHID($differential_phid);
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_CONSOLE,
array());
$extraction_engine->updateRevisionWithCommit(
$revision,
$commit,
array(),
$content_source);
echo tsprintf(
"%s\n",
pht(
'Attached "%s" to "%s".',
$commit->getMonogram(),
$revision->getMonogram()));
}
}

View file

@ -0,0 +1,63 @@
<?php
final class PhabricatorDifferentialExtractWorkflow
extends PhabricatorDifferentialManagementWorkflow {
protected function didConstruct() {
$this
->setName('extract')
->setExamples('**extract** __commit__')
->setSynopsis(pht('Extract a diff from a commit.'))
->setArguments(
array(
array(
'name' => 'extract',
'wildcard' => true,
'help' => pht('Commit to extract.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$extract = $args->getArg('extract');
if (!$extract) {
throw new PhutilArgumentUsageException(
pht('Specify a commit to extract the diff from.'));
}
if (count($extract) > 1) {
throw new PhutilArgumentUsageException(
pht('Specify exactly one commit to extract.'));
}
$extract = head($extract);
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(array($extract))
->executeOne();
if (!$commit) {
throw new PhutilArgumentUsageException(
pht(
'Commit "%s" is not valid.',
$extract));
}
$diff = id(new DifferentialDiffExtractionEngine())
->setViewer($viewer)
->newDiffFromCommit($commit);
$uri = PhabricatorEnv::getProductionURI($diff->getURI());
echo tsprintf(
"%s\n\n %s\n",
pht('Extracted diff from "%s":', $extract),
$uri);
}
}

View file

@ -0,0 +1,4 @@
<?php
abstract class PhabricatorDifferentialManagementWorkflow
extends PhabricatorManagementWorkflow {}

View file

@ -385,6 +385,12 @@ final class DifferentialDiff
return $map;
}
public function getURI() {
$id = $this->getID();
return "/differential/diff/{$id}/";
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -314,8 +314,7 @@ final class DifferentialChangesetListView extends AphrontView {
$changeset->getAbsoluteRepositoryPath($repository, $this->diff),
'/');
$line = idx($changeset->getMetadata(), 'line:first', 1);
$callsign = $repository->getCallsign();
$editor_link = $user->loadEditorLink($path, $line, $callsign);
$editor_link = $user->loadEditorLink($path, $line, $repository);
if ($editor_link) {
$meta['editor'] = $editor_link;
} else {

View file

@ -257,8 +257,10 @@ final class DiffusionLintSaveRunner extends Phobject {
'path' => $path,
'commit' => $this->lintCommit,
));
$query = DiffusionFileContentQuery::newFromDiffusionRequest($drequest)
->setNeedsBlame(true);
// TODO: Restore blame information / generally fix this workflow.
$query = DiffusionFileContentQuery::newFromDiffusionRequest($drequest);
$queries[$path] = $query;
$futures[$path] = $query->getFileContentFuture();
}

View file

@ -47,8 +47,13 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
public function getRoutes() {
return array(
'/r(?P<callsign>[A-Z]+)(?P<commit>[a-z0-9]+)'
'/(?:'.
'r(?P<repositoryCallsign>[A-Z]+)'.
'|'.
'R(?P<repositoryID>[1-9]\d*):'.
')(?P<commit>[a-f0-9]+)'
=> 'DiffusionCommitController',
'/diffusion/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?'
=> 'DiffusionRepositoryListController',
@ -59,13 +64,13 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DiffusionPushLogListController',
'view/(?P<id>\d+)/' => 'DiffusionPushEventViewController',
),
'(?P<callsign>[A-Z]+)/' => array(
'(?P<repositoryCallsign>[A-Z]+)/' => array(
'' => 'DiffusionRepositoryController',
'repository/(?P<dblob>.*)' => 'DiffusionRepositoryController',
'change/(?P<dblob>.*)' => 'DiffusionChangeController',
'history/(?P<dblob>.*)' => 'DiffusionHistoryController',
'browse/(?P<dblob>.*)' => 'DiffusionBrowseMainController',
'browse/(?P<dblob>.*)' => 'DiffusionBrowseController',
'lastmodified/(?P<dblob>.*)' => 'DiffusionLastModifiedController',
'diff/' => 'DiffusionDiffController',
'tags/(?P<dblob>.*)' => 'DiffusionTagListController',
@ -110,7 +115,8 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
// catch-all for serving repositories over HTTP. We must accept
// requests without the trailing "/" because SVN commands don't
// necessarily include it.
'(?P<callsign>[A-Z]+)(/|$).*' => 'DiffusionRepositoryDefaultController',
'(?P<repositoryCallsign>[A-Z]+)(?:/.*)?' =>
'DiffusionRepositoryDefaultController',
'inline/' => array(
'edit/(?P<phid>[^/]+)/' => 'DiffusionInlineCommentController',

View file

@ -0,0 +1,44 @@
<?php
final class DiffusionBlameConduitAPIMethod
extends DiffusionQueryConduitAPIMethod {
public function getAPIMethodName() {
return 'diffusion.blame';
}
public function getMethodDescription() {
return pht('Get blame information for a list of paths.');
}
protected function defineReturnType() {
return 'map<string, wild>';
}
protected function defineCustomParamTypes() {
return array(
'paths' => 'required list<string>',
'commit' => 'required string',
'timeout' => 'optional int',
);
}
protected function getResult(ConduitAPIRequest $request) {
$drequest = $this->getDiffusionRequest();
$paths = $request->getValue('paths');
$blame_query = DiffusionBlameQuery::newFromDiffusionRequest($drequest)
->setPaths($paths);
$timeout = $request->getValue('timeout');
if ($timeout) {
$blame_query->setTimeout($timeout);
}
$blame = $blame_query->execute();
return $blame;
}
}

View file

@ -22,6 +22,8 @@ final class DiffusionBrowseQueryConduitAPIMethod
'path' => 'optional string',
'commit' => 'optional string',
'needValidityOnly' => 'optional bool',
'limit' => 'optional int',
'offset' => 'optional int',
);
}
@ -35,6 +37,8 @@ final class DiffusionBrowseQueryConduitAPIMethod
$repository = $drequest->getRepository();
$path = $request->getValue('path');
$commit = $request->getValue('commit');
$offset = (int)$request->getValue('offset');
$limit = (int)$request->getValue('limit');
$result = $this->getEmptyResultSet();
if ($path == '') {
@ -99,6 +103,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
$prefix = '';
}
$count = 0;
$results = array();
foreach (explode("\0", rtrim($stdout)) as $line) {
// NOTE: Limit to 5 components so we parse filenames with spaces in them
@ -140,7 +145,15 @@ final class DiffusionBrowseQueryConduitAPIMethod
$path_result->setFileType($file_type);
$path_result->setFileSize($size);
$results[] = $path_result;
if ($count >= $offset) {
$results[] = $path_result;
}
$count++;
if ($limit && $count >= ($offset + $limit)) {
break;
}
}
// If we identified submodules, lookup the module info at this commit to
@ -196,6 +209,8 @@ final class DiffusionBrowseQueryConduitAPIMethod
$repository = $drequest->getRepository();
$path = $request->getValue('path');
$commit = $request->getValue('commit');
$offset = (int)$request->getValue('offset');
$limit = (int)$request->getValue('limit');
$result = $this->getEmptyResultSet();
@ -215,6 +230,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
// but ours do.
$trim_len = $match_len ? $match_len + 1 : 0;
$count = 0;
foreach ($entire_manifest as $path) {
if (strncmp($path, $match_against, $match_len)) {
continue;
@ -236,7 +252,16 @@ final class DiffusionBrowseQueryConduitAPIMethod
} else {
$type = DifferentialChangeType::FILE_DIRECTORY;
}
$results[reset($parts)] = $type;
if ($count >= $offset) {
$results[reset($parts)] = $type;
}
$count++;
if ($limit && ($count >= ($offset + $limit))) {
break;
}
}
foreach ($results as $key => $type) {
@ -266,6 +291,8 @@ final class DiffusionBrowseQueryConduitAPIMethod
$repository = $drequest->getRepository();
$path = $request->getValue('path');
$commit = $request->getValue('commit');
$offset = (int)$request->getValue('offset');
$limit = (int)$request->getValue('limit');
$result = $this->getEmptyResultSet();
$subpath = $repository->getDetail('svn-subpath');
@ -422,6 +449,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
$path_normal = DiffusionPathIDQuery::normalizePath($path);
$results = array();
$count = 0;
foreach ($browse as $file) {
$full_path = $file['pathName'];
@ -431,9 +459,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
$result_path = new DiffusionRepositoryPath();
$result_path->setPath($file_path);
$result_path->setFullPath($full_path);
// $result_path->setHash($hash);
$result_path->setFileType($file['fileType']);
// $result_path->setFileSize($size);
if (!empty($file['hasCommit'])) {
$commit = idx($commits, $file['svnCommit']);
@ -444,7 +470,15 @@ final class DiffusionBrowseQueryConduitAPIMethod
}
}
$results[] = $result_path;
if ($count >= $offset) {
$results[] = $result_path;
}
$count++;
if ($limit && ($count >= ($offset + $limit))) {
break;
}
}
if (empty($results)) {

View file

@ -19,7 +19,6 @@ final class DiffusionFileContentQueryConduitAPIMethod
return array(
'path' => 'required string',
'commit' => 'required string',
'needsBlame' => 'optional bool',
'timeout' => 'optional int',
'byteLimit' => 'optional int',
);
@ -27,12 +26,8 @@ final class DiffusionFileContentQueryConduitAPIMethod
protected function getResult(ConduitAPIRequest $request) {
$drequest = $this->getDiffusionRequest();
$needs_blame = $request->getValue('needsBlame');
$file_query = DiffusionFileContentQuery::newFromDiffusionRequest(
$drequest);
$file_query
->setViewer($request->getUser())
->setNeedsBlame($needs_blame);
$file_query = DiffusionFileContentQuery::newFromDiffusionRequest($drequest);
$timeout = $request->getValue('timeout');
if ($timeout) {
@ -44,20 +39,44 @@ final class DiffusionFileContentQueryConduitAPIMethod
$file_query->setByteLimit($byte_limit);
}
$file_content = $file_query->loadFileContent();
$content = $file_query->execute();
if ($needs_blame) {
list($text_list, $rev_list, $blame_dict) = $file_query->getBlameData();
} else {
$text_list = $rev_list = $blame_dict = array();
$too_slow = (bool)$file_query->getExceededTimeLimit();
$too_huge = (bool)$file_query->getExceededByteLimit();
$file_phid = null;
if (!$too_slow && !$too_huge) {
$file = $this->newFile($drequest, $content);
$file_phid = $file->getPHID();
}
$file_content
->setBlameDict($blame_dict)
->setRevList($rev_list)
->setTextList($text_list);
return array(
'tooSlow' => $too_slow,
'tooHuge' => $too_huge,
'filePHID' => $file_phid,
);
}
return $file_content->toDictionary();
private function newFile(DiffusionRequest $drequest, $content) {
$path = $drequest->getPath();
$name = basename($path);
$repository = $drequest->getRepository();
$repository_phid = $repository->getPHID();
$file = PhabricatorFile::buildFromFileDataOrHash(
$content,
array(
'name' => $name,
'ttl' => time() + phutil_units('48 hours in seconds'),
'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
));
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
$file->attachToObject($repository_phid);
unset($unguarded);
return $file;
}
}

View file

@ -1,293 +0,0 @@
<?php
final class DiffusionGetCommitsConduitAPIMethod
extends DiffusionConduitAPIMethod {
public function getAPIMethodName() {
return 'diffusion.getcommits';
}
public function getMethodDescription() {
return pht('Retrieve Diffusion commit information.');
}
public function getMethodStatus() {
return self::METHOD_STATUS_DEPRECATED;
}
public function getMethodStatusDescription() {
return pht('Obsoleted by %s.', 'diffusion.querycommits');
}
protected function defineParamTypes() {
return array(
'commits' => 'required list<string>',
);
}
protected function defineReturnType() {
return 'nonempty list<dict<string, wild>>';
}
protected function execute(ConduitAPIRequest $request) {
$results = array();
$commits = $request->getValue('commits');
$commits = array_fill_keys($commits, array());
foreach ($commits as $name => $info) {
$matches = null;
if (!preg_match('/^r([A-Z]+)([0-9a-f]+)\z/', $name, $matches)) {
$results[$name] = array(
'error' => 'ERR-UNPARSEABLE',
);
unset($commits[$name]);
continue;
}
$commits[$name] = array(
'callsign' => $matches[1],
'commitIdentifier' => $matches[2],
);
}
if (!$commits) {
return $results;
}
$callsigns = ipull($commits, 'callsign');
$callsigns = array_unique($callsigns);
$repos = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
->withCallsigns($callsigns)
->execute();
$repos = mpull($repos, null, 'getCallsign');
foreach ($commits as $name => $info) {
$repo = idx($repos, $info['callsign']);
if (!$repo) {
$results[$name] = $info + array(
'error' => 'ERR-UNKNOWN-REPOSITORY',
);
unset($commits[$name]);
continue;
}
$commits[$name] += array(
'repositoryPHID' => $repo->getPHID(),
'repositoryID' => $repo->getID(),
);
}
if (!$commits) {
return $results;
}
// Execute a complicated query to figure out the primary commit information
// for each referenced commit.
$cdata = $this->queryCommitInformation($commits, $repos);
// We've built the queries so that each row also has the identifier we used
// to select it, which might be a git prefix rather than a full identifier.
$ref_map = ipull($cdata, 'commitIdentifier', 'commitRef');
$cobjs = id(new PhabricatorRepositoryCommit())->loadAllFromArray($cdata);
$cobjs = mgroup($cobjs, 'getRepositoryID', 'getCommitIdentifier');
foreach ($commits as $name => $commit) {
// Expand short git names into full identifiers. For SVN this map is just
// the identity.
$full_identifier = idx($ref_map, $commit['commitIdentifier']);
$repo_id = $commit['repositoryID'];
unset($commits[$name]['repositoryID']);
if (empty($full_identifier) ||
empty($cobjs[$commit['repositoryID']][$full_identifier])) {
$results[$name] = $commit + array(
'error' => 'ERR-UNKNOWN-COMMIT',
);
unset($commits[$name]);
continue;
}
$cobj_arr = $cobjs[$commit['repositoryID']][$full_identifier];
$cobj = head($cobj_arr);
$commits[$name] += array(
'epoch' => $cobj->getEpoch(),
'commitPHID' => $cobj->getPHID(),
'commitID' => $cobj->getID(),
);
// Upgrade git short references into full commit identifiers.
$identifier = $cobj->getCommitIdentifier();
$commits[$name]['commitIdentifier'] = $identifier;
$callsign = $commits[$name]['callsign'];
$uri = "/r{$callsign}{$identifier}";
$commits[$name]['uri'] = PhabricatorEnv::getProductionURI($uri);
}
if (!$commits) {
return $results;
}
$commits = $this->addRepositoryCommitDataInformation($commits);
$commits = $this->addDifferentialInformation($commits, $request);
$commits = $this->addManiphestInformation($commits);
foreach ($commits as $name => $commit) {
$results[$name] = $commit;
}
return $results;
}
/**
* Retrieve primary commit information for all referenced commits.
*/
private function queryCommitInformation(array $commits, array $repos) {
assert_instances_of($repos, 'PhabricatorRepository');
$conn_r = id(new PhabricatorRepositoryCommit())->establishConnection('r');
$repos = mpull($repos, null, 'getID');
$groups = array();
foreach ($commits as $name => $commit) {
$groups[$commit['repositoryID']][] = $commit['commitIdentifier'];
}
// NOTE: MySQL goes crazy and does a massive table scan if we build a more
// sensible version of this query. Make sure the query plan is OK if you
// attempt to reduce the craziness here. METANOTE: The addition of prefix
// selection for Git further complicates matters.
$query = array();
$commit_table = id(new PhabricatorRepositoryCommit())->getTableName();
foreach ($groups as $repository_id => $identifiers) {
$vcs = $repos[$repository_id]->getVersionControlSystem();
$is_git = ($vcs == PhabricatorRepositoryType::REPOSITORY_TYPE_GIT);
if ($is_git) {
foreach ($identifiers as $identifier) {
if (strlen($identifier) < 7) {
// Don't bother with silly stuff like 'rX2', which will select
// 1/16th of all commits. Note that with length 7 we'll still get
// collisions in repositories at the tens-of-thousands-of-commits
// scale.
continue;
}
$query[] = qsprintf(
$conn_r,
'SELECT %T.*, %s commitRef
FROM %T WHERE repositoryID = %d
AND commitIdentifier LIKE %>',
$commit_table,
$identifier,
$commit_table,
$repository_id,
$identifier);
}
} else {
$query[] = qsprintf(
$conn_r,
'SELECT %T.*, commitIdentifier commitRef
FROM %T WHERE repositoryID = %d
AND commitIdentifier IN (%Ls)',
$commit_table,
$commit_table,
$repository_id,
$identifiers);
}
}
return queryfx_all(
$conn_r,
'%Q',
implode(' UNION ALL ', $query));
}
/**
* Enhance the commit list with RepositoryCommitData information.
*/
private function addRepositoryCommitDataInformation(array $commits) {
$commit_ids = ipull($commits, 'commitID');
$data = id(new PhabricatorRepositoryCommitData())->loadAllWhere(
'commitID in (%Ld)',
$commit_ids);
$data = mpull($data, null, 'getCommitID');
foreach ($commits as $name => $commit) {
if (isset($data[$commit['commitID']])) {
$dobj = $data[$commit['commitID']];
$commits[$name] += array(
'commitMessage' => $dobj->getCommitMessage(),
'commitDetails' => $dobj->getCommitDetails(),
);
}
// Remove this information so we don't expose it via the API since
// external services shouldn't be storing internal Commit IDs.
unset($commits[$name]['commitID']);
}
return $commits;
}
/**
* Enhance the commit list with Differential information.
*/
private function addDifferentialInformation(
array $commits,
ConduitAPIRequest $request) {
$commit_phids = ipull($commits, 'commitPHID');
$revisions = id(new DifferentialRevisionQuery())
->setViewer($request->getUser())
->withCommitPHIDs($commit_phids)
->needCommitPHIDs(true)
->execute();
$rev_phid_commit_phids_map = mpull($revisions, 'getCommitPHIDs', 'getPHID');
$revisions = mpull($revisions, null, 'getPHID');
foreach ($rev_phid_commit_phids_map as $rev_phid => $commit_phids) {
foreach ($commits as $name => $commit) {
$commit_phid = $commit['commitPHID'];
if (in_array($commit_phid, $commit_phids)) {
$revision = $revisions[$rev_phid];
$commits[$name] += array(
'differentialRevisionID' => 'D'.$revision->getID(),
'differentialRevisionPHID' => $revision->getPHID(),
);
}
}
}
return $commits;
}
/**
* Enhances the commits list with Maniphest information.
*/
private function addManiphestInformation(array $commits) {
$task_type = DiffusionCommitHasTaskEdgeType::EDGECONST;
$commit_phids = ipull($commits, 'commitPHID');
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($commit_phids)
->withEdgeTypes(array($task_type));
$edges = $edge_query->execute();
foreach ($commits as $name => $commit) {
$task_phids = $edge_query->getDestinationPHIDs(
array($commit['commitPHID']),
array($task_type));
$commits[$name] += array(
'taskPHIDs' => $task_phids,
);
}
return $commits;
}
}

View file

@ -24,7 +24,8 @@ final class DiffusionLookSoonConduitAPIMethod
protected function defineParamTypes() {
return array(
'callsigns' => 'required list<string>',
'callsigns' => 'optional list<string> (deprecated)',
'repositories' => 'optional list<string>',
'urgency' => 'optional string',
);
}
@ -33,14 +34,19 @@ final class DiffusionLookSoonConduitAPIMethod
// NOTE: The "urgency" parameter does nothing, it is just a hilarious joke
// which exemplifies the boundless clever wit of this project.
$callsigns = $request->getValue('callsigns');
if (!$callsigns) {
$identifiers = $request->getValue('repositories');
if (!$identifiers) {
$identifiers = $request->getValue('callsigns');
}
if (!$identifiers) {
return null;
}
$repositories = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
->withCallsigns($callsigns)
->withIdentifiers($identifiers)
->execute();
foreach ($repositories as $repository) {

View file

@ -70,16 +70,14 @@ final class DiffusionQueryCommitsConduitAPIMethod
foreach ($commits as $commit) {
$commit_data = $commit->getCommitData();
$callsign = $commit->getRepository()->getCallsign();
$identifier = $commit->getCommitIdentifier();
$uri = '/r'.$callsign.$identifier;
$uri = $commit->getURI();
$uri = PhabricatorEnv::getProductionURI($uri);
$dict = array(
'id' => $commit->getID(),
'phid' => $commit->getPHID(),
'repositoryPHID' => $commit->getRepository()->getPHID(),
'identifier' => $identifier,
'identifier' => $commit->getCommitIdentifier(),
'epoch' => $commit->getEpoch(),
'uri' => $uri,
'isImporting' => !$commit->isImported(),

View file

@ -38,7 +38,7 @@ abstract class DiffusionQueryConduitAPIMethod
return $this->defineCustomErrorTypes() +
array(
'ERR-UNKNOWN-REPOSITORY' =>
pht('There is no repository with that callsign.'),
pht('There is no matching repository.'),
'ERR-UNKNOWN-VCS-TYPE' =>
pht('Unknown repository VCS type.'),
'ERR-UNSUPPORTED-VCS' =>
@ -56,7 +56,8 @@ abstract class DiffusionQueryConduitAPIMethod
final protected function defineParamTypes() {
return $this->defineCustomParamTypes() +
array(
'callsign' => 'required string',
'callsign' => 'optional string (deprecated)',
'repository' => 'optional string',
'branch' => 'optional string',
);
}
@ -95,15 +96,27 @@ abstract class DiffusionQueryConduitAPIMethod
* should occur after @{method:getResult}, like formatting a timestamp.
*/
final protected function execute(ConduitAPIRequest $request) {
$identifier = $request->getValue('repository');
if ($identifier === null) {
$identifier = $request->getValue('callsign');
}
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $request->getUser(),
'callsign' => $request->getValue('callsign'),
'repository' => $identifier,
'branch' => $request->getValue('branch'),
'path' => $request->getValue('path'),
'commit' => $request->getValue('commit'),
));
if (!$drequest) {
throw new Exception(
pht(
'Repository "%s" is not a valid repository.',
$identifier));
}
// Figure out whether we're going to handle this request on this device,
// or proxy it to another node in the cluster.

View file

@ -44,7 +44,6 @@ final class DiffusionQueryPathsConduitAPIMethod
$commit,
$path);
$lines = id(new LinesOfALargeExecFuture($future))->setDelimiter("\0");
return $this->filterResults($lines, $request);
}
@ -86,16 +85,15 @@ final class DiffusionQueryPathsConduitAPIMethod
$results = array();
$count = 0;
foreach ($lines as $line) {
if (!$pattern || preg_match($pattern, $line)) {
if ($count >= $offset) {
$results[] = $line;
}
if (strlen($pattern) && !preg_match($pattern, $line)) {
continue;
}
$count++;
$results[] = $line;
$count++;
if ($limit && ($count >= ($offset + $limit))) {
break;
}
if ($limit && ($count >= ($offset + $limit))) {
break;
}
}

View file

@ -25,18 +25,19 @@ final class DiffusionSearchQueryConduitAPIMethod
);
}
protected function defineCustomErrorTypes() {
return array(
'ERR-GREP-COMMAND' => pht('Grep command failed.'),
);
}
protected function getResult(ConduitAPIRequest $request) {
try {
$results = parent::getResult($request);
} catch (CommandException $ex) {
throw id(new ConduitException('ERR-GREP-COMMAND'))
->setErrorDescription($ex->getStderr());
$err = $ex->getError();
if ($err === 1) {
// `git grep` and `hg grep` exit with 1 if there are no matches;
// assume we just didn't get any hits.
return array();
}
throw $ex;
}
$offset = $request->getValue('offset');
@ -63,6 +64,7 @@ final class DiffusionSearchQueryConduitAPIMethod
$binary_pattern = '/Binary file [^:]*:(.+) matches/';
$lines = new LinesOfALargeExecFuture($future);
foreach ($lines as $line) {
$result = null;
if (preg_match('/[^:]*:(.+)\0(.+)\0(.*)/', $line, $result)) {

View file

@ -6,15 +6,18 @@ final class DiffusionBranchTableController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->getDiffusionRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$pager = new PHUIPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getInt('offset'));
$pager = id(new PHUIPagerView())
->readFromRequest($request);
// TODO: Add support for branches that contain commit
$branches = $this->callConduitWithDiffusionRequest(
@ -57,18 +60,20 @@ final class DiffusionBranchTableController extends DiffusionController {
'branches' => true,
));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
$pager,
),
array(
'title' => array(
$pager_box = $this->renderTablePagerBox($pager);
return $this->newPage()
->setTitle(
array(
pht('Branches'),
'r'.$repository->getCallsign(),
),
));
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild(
array(
$content,
$pager_box,
));
}
}

View file

@ -1,108 +0,0 @@
<?php
final class DiffusionBrowseDirectoryController
extends DiffusionBrowseController {
private $browseQueryResults;
public function setBrowseQueryResults(DiffusionBrowseResultSet $results) {
$this->browseQueryResults = $results;
return $this;
}
public function getBrowseQueryResults() {
return $this->browseQueryResults;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->diffusionRequest;
$results = $this->getBrowseQueryResults();
$reason = $results->getReasonForEmptyResultSet();
$content = array();
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView($drequest, $actions);
$object_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderView($drequest))
->addPropertyList($properties);
$content[] = $object_box;
$content[] = $this->renderSearchForm($collapsed = true);
if (!$results->isValidResults()) {
$empty_result = new DiffusionEmptyResultView();
$empty_result->setDiffusionRequest($drequest);
$empty_result->setDiffusionBrowseResultSet($results);
$empty_result->setView($request->getStr('view'));
$content[] = $empty_result;
} else {
$phids = array();
foreach ($results->getPaths() as $result) {
$data = $result->getLastCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
}
}
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$browse_table = new DiffusionBrowseTableView();
$browse_table->setDiffusionRequest($drequest);
$browse_table->setHandles($handles);
$browse_table->setPaths($results->getPaths());
$browse_table->setUser($request->getUser());
$browse_panel = new PHUIObjectBoxView();
$browse_panel->setHeaderText($drequest->getPath(), '/');
$browse_panel->setTable($browse_table);
$content[] = $browse_panel;
}
$content[] = $this->buildOpenRevisions();
$readme_path = $results->getReadmePath();
if ($readme_path) {
$readme_content = $this->callConduitWithDiffusionRequest(
'diffusion.filecontentquery',
array(
'path' => $readme_path,
'commit' => $drequest->getStableCommit(),
));
if ($readme_content) {
$content[] = id(new DiffusionReadmeView())
->setUser($this->getViewer())
->setPath($readme_path)
->setContent($readme_content['corpus']);
}
}
$crumbs = $this->buildCrumbs(
array(
'branch' => true,
'path' => true,
'view' => 'browse',
));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => array(
nonempty(basename($drequest->getPath()), '/'),
pht(
'%s Repository',
$drequest->getRepository()->getCallsign()),
),
));
}
}

View file

@ -1,39 +0,0 @@
<?php
final class DiffusionBrowseMainController extends DiffusionBrowseController {
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->diffusionRequest;
// Figure out if we're browsing a directory, a file, or a search result
// list. Then delegate to the appropriate controller.
$grep = $request->getStr('grep');
$find = $request->getStr('find');
if (strlen($grep) || strlen($find)) {
$controller = new DiffusionBrowseSearchController();
} else {
$results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest(
'diffusion.browsequery',
array(
'path' => $drequest->getPath(),
'commit' => $drequest->getStableCommit(),
)));
$reason = $results->getReasonForEmptyResultSet();
$is_file = ($reason == DiffusionBrowseResultSet::REASON_IS_FILE);
if ($is_file) {
$controller = new DiffusionBrowseFileController($request);
} else {
$controller = new DiffusionBrowseDirectoryController($request);
$controller->setBrowseQueryResults($results);
}
}
$controller->setDiffusionRequest($drequest);
$controller->setCurrentApplication($this->getCurrentApplication());
return $this->delegateToController($controller);
}
}

View file

@ -1,233 +0,0 @@
<?php
final class DiffusionBrowseSearchController extends DiffusionBrowseController {
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->diffusionRequest;
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView($drequest, $actions);
$object_box = id(new PHUIObjectBoxView())
->setHeader($this->buildHeaderView($drequest))
->addPropertyList($properties);
$content = array();
$content[] = $object_box;
$content[] = $this->renderSearchForm($collapsed = false);
$content[] = $this->renderSearchResults();
$crumbs = $this->buildCrumbs(
array(
'branch' => true,
'path' => true,
'view' => 'browse',
));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => array(
nonempty(basename($drequest->getPath()), '/'),
pht(
'%s Repository',
$drequest->getRepository()->getCallsign()),
),
));
}
private function renderSearchResults() {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$results = array();
$limit = 100;
$page = $this->getRequest()->getInt('page', 0);
$pager = new PHUIPagerView();
$pager->setPageSize($limit);
$pager->setOffset($page);
$pager->setURI($this->getRequest()->getRequestURI(), 'page');
$search_mode = null;
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$results = array();
break;
default:
if (strlen($this->getRequest()->getStr('grep'))) {
$search_mode = 'grep';
$query_string = $this->getRequest()->getStr('grep');
$results = $this->callConduitWithDiffusionRequest(
'diffusion.searchquery',
array(
'grep' => $query_string,
'commit' => $drequest->getStableCommit(),
'path' => $drequest->getPath(),
'limit' => $limit + 1,
'offset' => $page,
));
} else { // Filename search.
$search_mode = 'find';
$query_string = $this->getRequest()->getStr('find');
$results = $this->callConduitWithDiffusionRequest(
'diffusion.querypaths',
array(
'pattern' => $query_string,
'commit' => $drequest->getStableCommit(),
'path' => $drequest->getPath(),
'limit' => $limit + 1,
'offset' => $page,
));
}
break;
}
$results = $pager->sliceResults($results);
if ($search_mode == 'grep') {
$table = $this->renderGrepResults($results, $query_string);
$header = pht(
'File content matching "%s" under "%s"',
$query_string,
nonempty($drequest->getPath(), '/'));
} else {
$table = $this->renderFindResults($results);
$header = pht(
'Paths matching "%s" under "%s"',
$query_string,
nonempty($drequest->getPath(), '/'));
}
$box = id(new PHUIObjectBoxView())
->setHeaderText($header)
->setTable($table);
$pager_box = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
->appendChild($pager);
return array($box, $pager_box);
}
private function renderGrepResults(array $results, $pattern) {
$drequest = $this->getDiffusionRequest();
require_celerity_resource('phabricator-search-results-css');
$rows = array();
foreach ($results as $result) {
list($path, $line, $string) = $result;
$href = $drequest->generateURI(array(
'action' => 'browse',
'path' => $path,
'line' => $line,
));
$matches = null;
$count = @preg_match_all(
'('.$pattern.')u',
$string,
$matches,
PREG_OFFSET_CAPTURE);
if (!$count) {
$output = ltrim($string);
} else {
$output = array();
$cursor = 0;
$length = strlen($string);
foreach ($matches[0] as $match) {
$offset = $match[1];
if ($cursor != $offset) {
$output[] = array(
'text' => substr($string, $cursor, $offset),
'highlight' => false,
);
}
$output[] = array(
'text' => $match[0],
'highlight' => true,
);
$cursor = $offset + strlen($match[0]);
}
if ($cursor != $length) {
$output[] = array(
'text' => substr($string, $cursor),
'highlight' => false,
);
}
if ($output) {
$output[0]['text'] = ltrim($output[0]['text']);
}
foreach ($output as $key => $segment) {
if ($segment['highlight']) {
$output[$key] = phutil_tag('strong', array(), $segment['text']);
} else {
$output[$key] = $segment['text'];
}
}
}
$string = phutil_tag(
'pre',
array('class' => 'PhabricatorMonospaced phui-source-fragment'),
$output);
$path = Filesystem::readablePath($path, $drequest->getPath());
$rows[] = array(
phutil_tag('a', array('href' => $href), $path),
$line,
$string,
);
}
$table = id(new AphrontTableView($rows))
->setClassName('remarkup-code')
->setHeaders(array(pht('Path'), pht('Line'), pht('String')))
->setColumnClasses(array('', 'n', 'wide'))
->setNoDataString(
pht(
'The pattern you searched for was not found in the content of any '.
'files.'));
return $table;
}
private function renderFindResults(array $results) {
$drequest = $this->getDiffusionRequest();
$rows = array();
foreach ($results as $result) {
$href = $drequest->generateURI(array(
'action' => 'browse',
'path' => $result,
));
$readable = Filesystem::readablePath($result, $drequest->getPath());
$rows[] = array(
phutil_tag('a', array('href' => $href), $readable),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(array(pht('Path')))
->setColumnClasses(array('wide'))
->setNoDataString(
pht(
'The pattern you searched for did not match the names of any '.
'files.'));
return $table;
}
}

View file

@ -6,9 +6,14 @@ final class DiffusionChangeController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->diffusionRequest;
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$content = array();
@ -33,7 +38,6 @@ final class DiffusionChangeController extends DiffusionController {
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$changesets = array(
0 => $changeset,
);
@ -59,7 +63,8 @@ final class DiffusionChangeController extends DiffusionController {
$left_uri = $drequest->generateURI($raw_params);
$changeset_view->setRawFileURIs($left_uri, $right_uri);
$changeset_view->setRenderURI('/diffusion/'.$callsign.'/diff/');
$changeset_view->setRenderURI($repository->getPathURI('diff/'));
$changeset_view->setWhitespace(
DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
$changeset_view->setUser($viewer);
@ -89,15 +94,18 @@ final class DiffusionChangeController extends DiffusionController {
->setHeader($header)
->addPropertyList($properties);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$content,
),
array(
'title' => pht('Change'),
));
return $this->newPage()
->setTitle(
array(
basename($drequest->getPath()),
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild(
array(
$object_box,
$content,
));
}
private function buildActionView(DiffusionRequest $drequest) {
@ -142,7 +150,6 @@ final class DiffusionChangeController extends DiffusionController {
->setActionList($actions);
$stable_commit = $drequest->getStableCommit();
$callsign = $drequest->getRepository()->getCallsign();
$view->addProperty(
pht('Commit'),

View file

@ -6,7 +6,12 @@ final class DiffusionCommitBranchesController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();

View file

@ -17,26 +17,21 @@ final class DiffusionCommitController extends DiffusionController {
return true;
}
protected function shouldLoadDiffusionRequest() {
return false;
}
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
// This controller doesn't use blob/path stuff, just pass the dictionary
// in directly instead of using the AphrontRequest parsing mechanism.
$data = $request->getURIMap();
$data['user'] = $user;
$drequest = DiffusionRequest::newFromDictionary($data);
$this->diffusionRequest = $drequest;
if ($request->getStr('diff')) {
return $this->buildRawDiffResponse($drequest);
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$content = array();
$commit = id(new DiffusionCommitQuery())
@ -181,7 +176,7 @@ final class DiffusionCommitController extends DiffusionController {
id(new PhabricatorRepository())->establishConnection('r'),
'SELECT * FROM %T WHERE fullCommitName = %s',
PhabricatorRepository::TABLE_BADCOMMIT,
'r'.$callsign.$commit->getCommitIdentifier());
$commit->getMonogram());
}
$show_changesets = false;
@ -314,27 +309,28 @@ final class DiffusionCommitController extends DiffusionController {
}
}
$change_list_title = DiffusionView::nameCommit(
$repository,
$commit->getCommitIdentifier());
$change_list_title = $commit->getDisplayName();
$change_list = new DifferentialChangesetListView();
$change_list->setTitle($change_list_title);
$change_list->setChangesets($changesets);
$change_list->setVisibleChangesets($visible_changesets);
$change_list->setRenderingReferences($references);
$change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
$change_list->setRenderURI(
$repository->getPathURI('diff/'));
$change_list->setRepository($repository);
$change_list->setUser($user);
// TODO: Try to setBranch() to something reasonable here?
$change_list->setStandaloneURI(
'/diffusion/'.$callsign.'/diff/');
$repository->getPathURI('diff/'));
$change_list->setRawFileURIs(
// TODO: Implement this, somewhat tricky if there's an octopus merge
// or whatever?
null,
'/diffusion/'.$callsign.'/diff/?view=r');
$repository->getPathURI('diff/?view=r'));
$change_list->setInlineCommentControllerURI(
'/diffusion/inline/edit/'.phutil_escape_uri($commit->getPHID()).'/');
@ -344,11 +340,6 @@ final class DiffusionCommitController extends DiffusionController {
$content[] = $this->renderAddCommentPanel($commit, $audit_requests);
$commit_id = 'r'.$callsign.$commit->getCommitIdentifier();
$short_name = DiffusionView::nameCommit(
$repository,
$commit->getCommitIdentifier());
$prefs = $user->loadPreferences();
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
$pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
@ -357,8 +348,8 @@ final class DiffusionCommitController extends DiffusionController {
if ($show_changesets && $show_filetree) {
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setTitle($short_name)
->setBaseURI(new PhutilURI('/'.$commit_id))
->setTitle($commit->getDisplayName())
->setBaseURI(new PhutilURI($commit->getURI()))
->build($changesets)
->setCrumbs($crumbs)
->setCollapsed((bool)$collapsed)
@ -371,7 +362,7 @@ final class DiffusionCommitController extends DiffusionController {
return $this->buildApplicationPage(
$content,
array(
'title' => $commit_id,
'title' => $commit->getDisplayName(),
'pageObjects' => array($commit->getPHID()),
));
}
@ -573,8 +564,8 @@ final class DiffusionCommitController extends DiffusionController {
),
pht('Unknown'));
$callsign = $repository->getCallsign();
$root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier();
$identifier = $commit->getCommitIdentifier();
$root = $repository->getPathURI("commit/{$identifier}");
Javelin::initBehavior(
'diffusion-commit-branches',
array(
@ -910,8 +901,8 @@ final class DiffusionCommitController extends DiffusionController {
$commit,
PhabricatorPolicyCapability::CAN_EDIT);
$uri = '/diffusion/'.$repository->getCallsign().'/commit/'.
$commit->getCommitIdentifier().'/edit/';
$identifier = $commit->getCommitIdentifier();
$uri = $repository->getPathURI("commit/{$identifier}/edit/");
$action = id(new PhabricatorActionView())
->setName(pht('Edit Commit'))

View file

@ -2,19 +2,24 @@
final class DiffusionCommitEditController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->getDiffusionRequest();
$callsign = $drequest->getRepository()->getCallsign();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
$data = $commit->loadCommitData();
$page_title = pht('Edit Diffusion Commit');
$commit = $drequest->loadCommit();
if (!$commit) {
return new Aphront404Response();
}
$data = $commit->loadCommitData();
$page_title = pht('Edit Diffusion Commit');
$commit_phid = $commit->getPHID();
$edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;
$current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
@ -28,18 +33,21 @@ final class DiffusionCommitEditController extends DiffusionController {
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
->setMetadataValue('edge:type', $edge_type)
->setNewValue(array('=' => array_fuse($proj_phids)));
$editor = id(new PhabricatorAuditEditor())
->setActor($user)
->setActor($viewer)
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request);
$xactions = $editor->applyTransactions($commit, $xactions);
$editor->applyTransactions($commit, $xactions);
return id(new AphrontRedirectResponse())
->setURI('/r'.$callsign.$commit->getCommitIdentifier());
->setURI($commit->getURI());
}
$tokenizer_id = celerity_generate_unique_node_id();
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->setAction($request->getRequestURI()->getPath())
->appendControl(
id(new AphrontFormTokenizerControl())
@ -47,15 +55,6 @@ final class DiffusionCommitEditController extends DiffusionController {
->setName('projects')
->setValue($current_proj_phids)
->setID($tokenizer_id)
->setCaption(
javelin_tag(
'a',
array(
'href' => '/project/create/',
'mustcapture' => true,
'sigil' => 'project-create',
),
pht('Create New Project')))
->setDatasource(new PhabricatorProjectDatasource()));
$reason = $data->getCommitDetail('autocloseReason', false);
@ -97,33 +96,25 @@ final class DiffusionCommitEditController extends DiffusionController {
->setValue(array($desc, " \xC2\xB7 ", $doc_link)));
}
$form->appendControl(
id(new AphrontFormSubmitControl())
->setValue(pht('Save'))
->addCancelButton($commit->getURI()));
Javelin::initBehavior('project-create', array(
'tokenizerID' => $tokenizer_id,
));
$submit = id(new AphrontFormSubmitControl())
->setValue(pht('Save'))
->addCancelButton('/r'.$callsign.$commit->getCommitIdentifier());
$form->appendChild($submit);
$crumbs = $this->buildCrumbs(array(
'commit' => true,
));
$crumbs = $this->buildCrumbs(
array(
'commit' => true,
));
$crumbs->addTextCrumb(pht('Edit'));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($page_title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $page_title,
));
return $this->newPage()
->setTitle($page_title)
->setCrumbs($crumbs)
->appendChild($form_box);
}
}

View file

@ -6,7 +6,12 @@ final class DiffusionCommitTagsController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();

View file

@ -2,56 +2,92 @@
abstract class DiffusionController extends PhabricatorController {
protected $diffusionRequest;
public function setDiffusionRequest(DiffusionRequest $request) {
$this->diffusionRequest = $request;
return $this;
}
private $diffusionRequest;
protected function getDiffusionRequest() {
if (!$this->diffusionRequest) {
throw new Exception(pht('No Diffusion request object!'));
throw new PhutilInvalidStateException('loadDiffusionContext');
}
return $this->diffusionRequest;
}
protected function hasDiffusionRequest() {
return (bool)$this->diffusionRequest;
}
public function willBeginExecution() {
$request = $this->getRequest();
// Check if this is a VCS request, e.g. from "git clone", "hg clone", or
// "svn checkout". If it is, we jump off into repository serving code to
// process the request.
if (DiffusionServeController::isVCSRequest($request)) {
$serve_controller = id(new DiffusionServeController())
->setCurrentApplication($this->getCurrentApplication());
$serve_controller = new DiffusionServeController();
if ($serve_controller->isVCSRequest($request)) {
return $this->delegateToController($serve_controller);
}
return parent::willBeginExecution();
}
protected function shouldLoadDiffusionRequest() {
return true;
protected function loadDiffusionContextForEdit() {
return $this->loadContext(
array(
'edit' => true,
));
}
final public function handleRequest(AphrontRequest $request) {
if ($request->getURIData('callsign') &&
$this->shouldLoadDiffusionRequest()) {
try {
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
$request->getURIMap(),
$request);
} catch (Exception $ex) {
return id(new Aphront404Response())
->setRequest($request);
}
$this->setDiffusionRequest($drequest);
protected function loadDiffusionContext() {
return $this->loadContext(array());
}
private function loadContext(array $options) {
$request = $this->getRequest();
$viewer = $this->getViewer();
$identifier = $this->getRepositoryIdentifierFromRequest($request);
$params = $options + array(
'repository' => $identifier,
'user' => $viewer,
'blob' => $this->getDiffusionBlobFromRequest($request),
'commit' => $request->getURIData('commit'),
'path' => $request->getURIData('path'),
'line' => $request->getURIData('line'),
'branch' => $request->getURIData('branch'),
'lint' => $request->getStr('lint'),
);
$drequest = DiffusionRequest::newFromDictionary($params);
if (!$drequest) {
return new Aphront404Response();
}
return $this->processDiffusionRequest($request);
$this->diffusionRequest = $drequest;
return null;
}
abstract protected function processDiffusionRequest(AphrontRequest $request);
protected function getDiffusionBlobFromRequest(AphrontRequest $request) {
return $request->getURIData('dblob');
}
protected function getRepositoryIdentifierFromRequest(
AphrontRequest $request) {
$identifier = $request->getURIData('repositoryCallsign');
if (strlen($identifier)) {
return $identifier;
}
$id = $request->getURIData('repositoryID');
if (strlen($id)) {
return (int)$id;
}
return null;
}
public function buildCrumbs(array $spec = array()) {
$crumbs = $this->buildApplicationCrumbs();
@ -74,7 +110,7 @@ abstract class DiffusionController extends PhabricatorController {
$crumb_list = array();
// On the home page, we don't have a DiffusionRequest.
if ($this->diffusionRequest) {
if ($this->hasDiffusionRequest()) {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
} else {
@ -86,7 +122,6 @@ abstract class DiffusionController extends PhabricatorController {
return $crumb_list;
}
$callsign = $repository->getCallsign();
$repository_name = $repository->getName();
if (!$spec['commit'] && !$spec['tags'] && !$spec['branches']) {
@ -112,17 +147,14 @@ abstract class DiffusionController extends PhabricatorController {
$crumb_list[] = $crumb;
$stable_commit = $drequest->getStableCommit();
$commit_name = $repository->formatCommitName($stable_commit);
$commit_uri = $repository->getCommitURI($stable_commit);
if ($spec['tags']) {
$crumb = new PHUICrumbView();
if ($spec['commit']) {
$crumb->setName(
pht('Tags for %s', 'r'.$callsign.$stable_commit));
$crumb->setHref($drequest->generateURI(
array(
'action' => 'commit',
'commit' => $drequest->getStableCommit(),
)));
$crumb->setName(pht('Tags for %s', $commit_name));
$crumb->setHref($commit_uri);
} else {
$crumb->setName(pht('Tags'));
}
@ -139,8 +171,8 @@ abstract class DiffusionController extends PhabricatorController {
if ($spec['commit']) {
$crumb = id(new PHUICrumbView())
->setName("r{$callsign}{$stable_commit}")
->setHref("r{$callsign}{$stable_commit}");
->setName($commit_name)
->setHref($commit_uri);
$crumb_list[] = $crumb;
return $crumb_list;
}
@ -187,7 +219,7 @@ abstract class DiffusionController extends PhabricatorController {
protected function getRepositoryControllerURI(
PhabricatorRepository $repository,
$path) {
return $this->getApplicationURI($repository->getCallsign().'/'.$path);
return $repository->getPathURI($path);
}
protected function renderPathLinks(DiffusionRequest $drequest, $action) {
@ -212,7 +244,7 @@ abstract class DiffusionController extends PhabricatorController {
'path' => '',
)),
),
'r'.$drequest->getRepository()->getCallsign());
$drequest->getRepository()->getDisplayName());
$links[] = $divider;
$accum = '';
$last_key = last_key($path_parts);
@ -235,7 +267,7 @@ abstract class DiffusionController extends PhabricatorController {
}
}
} else {
$links[] = 'r'.$drequest->getRepository()->getCallsign();
$links[] = $drequest->getRepository()->getDisplayName();
$links[] = $divider;
}
@ -249,4 +281,55 @@ abstract class DiffusionController extends PhabricatorController {
->appendChild($body);
}
protected function renderTablePagerBox(PHUIPagerView $pager) {
return id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)
->appendChild($pager);
}
protected function renderDirectoryReadme(DiffusionBrowseResultSet $browse) {
$readme_path = $browse->getReadmePath();
if ($readme_path === null) {
return null;
}
$drequest = $this->getDiffusionRequest();
$viewer = $this->getViewer();
try {
$result = $this->callConduitWithDiffusionRequest(
'diffusion.filecontentquery',
array(
'path' => $readme_path,
'commit' => $drequest->getStableCommit(),
));
} catch (Exception $ex) {
return null;
}
$file_phid = $result['filePHID'];
if (!$file_phid) {
return null;
}
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withPHIDs(array($file_phid))
->executeOne();
if (!$file) {
return null;
}
$corpus = $file->loadFileData();
if (!strlen($corpus)) {
return null;
}
return id(new DiffusionReadmeView())
->setUser($this->getViewer())
->setPath($readme_path)
->setContent($corpus);
}
}

View file

@ -6,27 +6,18 @@ final class DiffusionDiffController extends DiffusionController {
return true;
}
protected function shouldLoadDiffusionRequest() {
return false;
protected function getDiffusionBlobFromRequest(AphrontRequest $request) {
return $request->getStr('ref');
}
protected function processDiffusionRequest(AphrontRequest $request) {
$data = $request->getURIMap();
$data = $data + array(
'dblob' => $this->getRequest()->getStr('ref'),
);
try {
$drequest = DiffusionRequest::newFromAphrontRequestDictionary(
$data,
$request);
} catch (Exception $ex) {
return id(new Aphront404Response())
->setRequest($request);
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$this->setDiffusionRequest($drequest);
$drequest = $this->getDiffusionRequest();
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
if (!$request->isAjax()) {

View file

@ -6,12 +6,7 @@ final class DiffusionExternalController extends DiffusionController {
return true;
}
protected function shouldLoadDiffusionRequest() {
return false;
}
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$uri = $request->getStr('uri');
$id = $request->getStr('id');
@ -45,13 +40,13 @@ final class DiffusionExternalController extends DiffusionController {
if ($best_match) {
$repository = $repositories[$best_match];
$redirect = DiffusionRequest::generateDiffusionURI(
$redirect = $repository->generateURI(
array(
'action' => 'browse',
'callsign' => $repository->getCallsign(),
'branch' => $repository->getDefaultBranch(),
'commit' => $id,
'action' => 'browse',
'branch' => $repository->getDefaultBranch(),
'commit' => $id,
));
return id(new AphrontRedirectResponse())->setURI($redirect);
}
}
@ -64,10 +59,11 @@ final class DiffusionExternalController extends DiffusionController {
if (empty($commits)) {
$desc = null;
if ($uri) {
$desc = $uri.', at ';
if (strlen($uri)) {
$desc = pht('"%s", at "%s"', $uri, $id);
} else {
$desc = pht('"%s"', $id);
}
$desc .= $id;
$content = id(new PHUIInfoView())
->setTitle(pht('Unknown External'))
@ -83,10 +79,9 @@ final class DiffusionExternalController extends DiffusionController {
} else if (count($commits) == 1) {
$commit = head($commits);
$repo = $repositories[$commit->getRepositoryID()];
$redirect = DiffusionRequest::generateDiffusionURI(
$redirect = $repo->generateURI(
array(
'action' => 'browse',
'callsign' => $repo->getCallsign(),
'branch' => $repo->getDefaultBranch(),
'commit' => $commit->getCommitIdentifier(),
));
@ -96,10 +91,9 @@ final class DiffusionExternalController extends DiffusionController {
$rows = array();
foreach ($commits as $commit) {
$repo = $repositories[$commit->getRepositoryID()];
$href = DiffusionRequest::generateDiffusionURI(
$href = $repo->generateURI(
array(
'action' => 'browse',
'callsign' => $repo->getCallsign(),
'branch' => $repo->getDefaultBranch(),
'commit' => $commit->getCommitIdentifier(),
));
@ -109,7 +103,7 @@ final class DiffusionExternalController extends DiffusionController {
array(
'href' => $href,
),
'r'.$repo->getCallsign().$commit->getCommitIdentifier()),
$commit->getMonogram()),
$commit->loadCommitData()->getSummary(),
);
}
@ -137,11 +131,13 @@ final class DiffusionExternalController extends DiffusionController {
$content->setTable($table);
}
return $this->buildApplicationPage(
$content,
array(
'title' => pht('Unresolvable External'),
));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('External'));
return $this->newPage()
->setTitle(pht('Unresolvable External'))
->setCrumbs($crumbs)
->appendChild($content);
}
}

View file

@ -6,19 +6,24 @@ final class DiffusionHistoryController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->diffusionRequest;
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('offset', 0);
$pager = id(new PHUIPagerView())
->readFromRequest($request);
$params = array(
'commit' => $drequest->getCommit(),
'path' => $drequest->getPath(),
'offset' => $offset,
'limit' => $page_size + 1,
'offset' => $pager->getOffset(),
'limit' => $pager->getPageSize() + 1,
);
if (!$request->getBool('copies')) {
@ -32,13 +37,8 @@ final class DiffusionHistoryController extends DiffusionController {
$history = DiffusionPathChange::newFromConduit(
$history_results['pathChanges']);
$pager = new PHUIPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$history = $pager->sliceResults($history);
$pager->setURI($request->getRequestURI(), 'offset');
$show_graph = !strlen($drequest->getPath());
$content = array();
@ -51,7 +51,8 @@ final class DiffusionHistoryController extends DiffusionController {
if ($show_graph) {
$history_table->setParents($history_results['parents']);
$history_table->setIsHead($offset == 0);
$history_table->setIsHead(!$pager->getOffset());
$history_table->setIsTail(!$pager->getHasMorePages());
}
$history_panel = new PHUIObjectBoxView();
@ -79,23 +80,21 @@ final class DiffusionHistoryController extends DiffusionController {
'view' => 'history',
));
$pager = id(new PHUIBoxView())
->addClass('ml')
->appendChild($pager);
$pager_box = $this->renderTablePagerBox($pager);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$content,
$pager,
),
array(
'title' => array(
return $this->newPage()
->setTitle(
array(
pht('History'),
pht('%s Repository', $drequest->getRepository()->getCallsign()),
),
));
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild(
array(
$object_box,
$content,
$pager_box,
));
}
private function buildActionView(DiffusionRequest $drequest) {
@ -151,7 +150,6 @@ final class DiffusionHistoryController extends DiffusionController {
->setActionList($actions);
$stable_commit = $drequest->getStableCommit();
$callsign = $drequest->getRepository()->getCallsign();
$view->addProperty(
pht('Commit'),

View file

@ -6,9 +6,14 @@ final class DiffusionLastModifiedController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$viewer = $request->getUser();
$paths = $request->getStr('paths');
try {

View file

@ -6,81 +6,116 @@ final class DiffusionLintController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
if ($request->getStr('lint') !== null) {
$controller = new DiffusionLintDetailsController();
$controller->setDiffusionRequest($drequest);
$controller->setCurrentApplication($this->getCurrentApplication());
return $this->delegateToController($controller);
if ($this->getRepositoryIdentifierFromRequest($request)) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
} else {
$drequest = null;
}
$code = $request->getStr('lint');
if (strlen($code)) {
return $this->buildDetailsResponse();
}
$owners = array();
if (!$drequest) {
if (!$request->getArr('owner')) {
$owners = array($user->getPHID());
$owners = array($viewer->getPHID());
} else {
$owners = array(head($request->getArr('owner')));
}
}
$codes = $this->loadLintCodes($owners);
if ($codes && !$drequest) {
// TODO: Build some real Query classes for this stuff.
$codes = $this->loadLintCodes($drequest, $owners);
if ($codes) {
$branches = id(new PhabricatorRepositoryBranch())->loadAllWhere(
'id IN (%Ld)',
array_unique(ipull($codes, 'branchID')));
$branches = mpull($branches, null, 'getID');
} else {
$branches = array();
}
if ($branches) {
$repositories = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->setViewer($viewer)
->withIDs(mpull($branches, 'getRepositoryID'))
->execute();
$drequests = array();
foreach ($branches as $id => $branch) {
if (empty($repositories[$branch->getRepositoryID()])) {
continue;
}
$drequests[$id] = DiffusionRequest::newFromDictionary(array(
'user' => $user,
'repository' => $repositories[$branch->getRepositoryID()],
'branch' => $branch->getName(),
));
}
$repositories = mpull($repositories, null, 'getID');
} else {
$repositories = array();
}
$rows = array();
$total = 0;
foreach ($codes as $code) {
if (!$this->diffusionRequest) {
$drequest = idx($drequests, $code['branchID']);
$branch = idx($branches, $code['branchID']);
if (!$branch) {
continue;
}
if (!$drequest) {
$repository = idx($repositories, $branch->getRepositoryID());
if (!$repository) {
continue;
}
$total += $code['n'];
$href_lint = $drequest->generateURI(array(
'action' => 'lint',
'lint' => $code['code'],
));
$href_browse = $drequest->generateURI(array(
'action' => 'browse',
'lint' => $code['code'],
));
$href_repo = $drequest->generateURI(array('action' => 'lint'));
if ($drequest) {
$href_lint = $drequest->generateURI(
array(
'action' => 'lint',
'lint' => $code['code'],
));
$href_browse = $drequest->generateURI(
array(
'action' => 'browse',
'lint' => $code['code'],
));
$href_repo = $drequest->generateURI(
array(
'action' => 'lint',
));
} else {
$href_lint = $repository->generateURI(
array(
'action' => 'lint',
'lint' => $code['code'],
));
$href_browse = $repository->generateURI(
array(
'action' => 'browse',
'lint' => $code['code'],
));
$href_repo = $repository->generateURI(
array(
'action' => 'lint',
));
}
$rows[] = array(
phutil_tag('a', array('href' => $href_lint), $code['n']),
phutil_tag('a', array('href' => $href_browse), $code['files']),
phutil_tag('a', array('href' => $href_repo), $drequest->getCallsign()),
phutil_tag(
'a',
array(
'href' => $href_repo,
),
$repository->getDisplayName()),
ArcanistLintSeverity::getStringForSeverity($code['maxSeverity']),
$code['code'],
$code['maxName'],
@ -98,14 +133,14 @@ final class DiffusionLintController extends DiffusionController {
pht('Name'),
pht('Example'),
))
->setColumnVisibility(array(true, true, !$this->diffusionRequest))
->setColumnVisibility(array(true, true, !$drequest))
->setColumnClasses(array('n', 'n', '', '', 'pri', '', ''));
$content = array();
if (!$this->diffusionRequest) {
if (!$drequest) {
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->setMethod('GET')
->appendControl(
id(new AphrontFormTokenizerControl())
@ -132,18 +167,18 @@ final class DiffusionLintController extends DiffusionController {
'view' => 'lint',
));
if ($this->diffusionRequest) {
$title[] = $drequest->getCallsign();
if ($drequest) {
$title[] = $drequest->getRepository()->getDisplayName();
} else {
$crumbs->addTextCrumb(pht('All Lint'));
}
if ($this->diffusionRequest) {
if ($drequest) {
$branch = $drequest->loadBranch();
$header = id(new PHUIHeaderView())
->setHeader($this->renderPathLinks($drequest, 'lint'))
->setUser($user)
->setUser($viewer)
->setPolicyObject($drequest->getRepository());
$actions = $this->buildActionView($drequest);
$properties = $this->buildPropertyView(
@ -159,20 +194,17 @@ final class DiffusionLintController extends DiffusionController {
$object_box = null;
}
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
$content,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$object_box,
$content,
));
}
private function loadLintCodes(array $owner_phids) {
$drequest = $this->diffusionRequest;
private function loadLintCodes($drequest, array $owner_phids) {
$conn = id(new PhabricatorRepository())->establishConnection('r');
$where = array('1 = 1');
@ -314,7 +346,6 @@ final class DiffusionLintController extends DiffusionController {
->setUser($viewer)
->setActionList($actions);
$callsign = $drequest->getRepository()->getCallsign();
$lint_commit = $branch->getLintCommit();
$view->addProperty(
@ -338,4 +369,146 @@ final class DiffusionLintController extends DiffusionController {
}
private function buildDetailsResponse() {
$request = $this->getRequest();
$limit = 500;
$pager = id(new PHUIPagerView())
->readFromRequest($request)
->setPageSize($limit);
$offset = $pager->getOffset();
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = (substr('/'.$drequest->getPath(), -1) == '/');
$pager->setHasMorePages(count($messages) >= $limit);
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag(
'a',
array(
'href' => $drequest->generateURI(array(
'action' => 'lint',
'path' => $message['path'],
)),
),
substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag(
'a',
array(
'href' => $drequest->generateURI(array(
'action' => 'browse',
'path' => $message['path'],
'line' => $message['line'],
'commit' => $branch->getLintCommit(),
)),
),
$message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array(
$path,
$line,
$author,
ArcanistLintSeverity::getStringForSeverity($message['severity']),
$message['name'],
$message['description'],
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(array(
pht('Path'),
pht('Line'),
pht('Author'),
pht('Severity'),
pht('Name'),
pht('Description'),
))
->setColumnClasses(array('', 'n'))
->setColumnVisibility(array($is_dir));
$content = array();
$content[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Lint Details'))
->setTable($table);
$crumbs = $this->buildCrumbs(
array(
'branch' => true,
'path' => true,
'view' => 'lint',
));
$pager_box = $this->renderTablePagerBox($pager);
return $this->newPage()
->setTitle(
array(
pht('Lint'),
$drequest->getRepository()->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild(
array(
$content,
$pager_box,
));
}
private function loadLintMessages(
PhabricatorRepositoryBranch $branch,
$limit,
$offset) {
$drequest = $this->getDiffusionRequest();
if (!$branch) {
return array();
}
$conn = $branch->establishConnection('r');
$where = array(
qsprintf($conn, 'branchID = %d', $branch->getID()),
);
if ($drequest->getPath() != '') {
$path = '/'.$drequest->getPath();
$is_dir = (substr($path, -1) == '/');
$where[] = ($is_dir
? qsprintf($conn, 'path LIKE %>', $path)
: qsprintf($conn, 'path = %s', $path));
}
if ($drequest->getLint() != '') {
$where[] = qsprintf(
$conn,
'code = %s',
$drequest->getLint());
}
return queryfx_all(
$conn,
'SELECT *
FROM %T
WHERE %Q
ORDER BY path, code, line LIMIT %d OFFSET %d',
PhabricatorRepository::TABLE_LINTMESSAGE,
implode(' AND ', $where),
$limit,
$offset);
}
}

View file

@ -1,144 +0,0 @@
<?php
final class DiffusionLintDetailsController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$limit = 500;
$offset = $request->getInt('offset', 0);
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = (substr('/'.$drequest->getPath(), -1) == '/');
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag(
'a',
array(
'href' => $drequest->generateURI(array(
'action' => 'lint',
'path' => $message['path'],
)),
),
substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag(
'a',
array(
'href' => $drequest->generateURI(array(
'action' => 'browse',
'path' => $message['path'],
'line' => $message['line'],
'commit' => $branch->getLintCommit(),
)),
),
$message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array(
$path,
$line,
$author,
ArcanistLintSeverity::getStringForSeverity($message['severity']),
$message['name'],
$message['description'],
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(array(
pht('Path'),
pht('Line'),
pht('Author'),
pht('Severity'),
pht('Name'),
pht('Description'),
))
->setColumnClasses(array('', 'n'))
->setColumnVisibility(array($is_dir));
$content = array();
$pager = id(new PHUIPagerView())
->setPageSize($limit)
->setOffset($offset)
->setHasMorePages(count($messages) >= $limit)
->setURI($request->getRequestURI(), 'offset');
$content[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Lint Details'))
->setTable($table);
$crumbs = $this->buildCrumbs(
array(
'branch' => true,
'path' => true,
'view' => 'lint',
));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
$pager,
),
array(
'title' =>
array(
pht('Lint'),
$drequest->getRepository()->getCallsign(),
),
));
}
private function loadLintMessages(
PhabricatorRepositoryBranch $branch,
$limit,
$offset) {
$drequest = $this->getDiffusionRequest();
if (!$branch) {
return array();
}
$conn = $branch->establishConnection('r');
$where = array(
qsprintf($conn, 'branchID = %d', $branch->getID()),
);
if ($drequest->getPath() != '') {
$path = '/'.$drequest->getPath();
$is_dir = (substr($path, -1) == '/');
$where[] = ($is_dir
? qsprintf($conn, 'path LIKE %>', $path)
: qsprintf($conn, 'path = %s', $path));
}
if ($drequest->getLint() != '') {
$where[] = qsprintf(
$conn,
'code = %s',
$drequest->getLint());
}
return queryfx_all(
$conn,
'SELECT *
FROM %T
WHERE %Q
ORDER BY path, code, line LIMIT %d OFFSET %d',
PhabricatorRepository::TABLE_LINTMESSAGE,
implode(' AND ', $where),
$limit,
$offset);
}
}

View file

@ -3,9 +3,14 @@
final class DiffusionMirrorDeleteController
extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$mirror = id(new PhabricatorRepositoryMirrorQuery())
@ -28,16 +33,12 @@ final class DiffusionMirrorDeleteController
return id(new AphrontReloadResponse())->setURI($edit_uri);
}
$dialog = id(new AphrontDialogView())
->setUser($viewer)
return $this->newDialog()
->setTitle(pht('Really delete mirror?'))
->appendChild(
pht('Phabricator will stop pushing updates to this mirror.'))
->addSubmitButton(pht('Delete Mirror'))
->addCancelButton($edit_uri);
return id(new AphrontDialogResponse())
->setDialog($dialog);
}

View file

@ -3,9 +3,14 @@
final class DiffusionMirrorEditController
extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
PhabricatorPolicyFilter::requireCapability(
@ -112,17 +117,13 @@ final class DiffusionMirrorEditController
->setError($e_credentials)
->setOptions($credentials));
$dialog = id(new AphrontDialogView())
->setUser($viewer)
return $this->newDialog()
->setTitle($title)
->setWidth(AphrontDialogView::WIDTH_FORM)
->appendChild($form_errors)
->appendChild($form)
->addSubmitButton($submit)
->addCancelButton($edit_uri);
return id(new AphrontDialogResponse())
->setDialog($dialog);
}

View file

@ -2,21 +2,20 @@
final class DiffusionPathCompleteController extends DiffusionController {
protected function shouldLoadDiffusionRequest() {
return false;
protected function getRepositoryIdentifierFromRequest(
AphrontRequest $request) {
return $request->getStr('repositoryPHID');
}
protected function processDiffusionRequest(AphrontRequest $request) {
$repository_phid = $request->getStr('repositoryPHID');
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
->withPHIDs(array($repository_phid))
->executeOne();
if (!$repository) {
return new Aphront400Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$query_path = $request->getStr('q');
if (preg_match('@/$@', $query_path)) {
$query_dir = $query_path;
@ -25,19 +24,11 @@ final class DiffusionPathCompleteController extends DiffusionController {
}
$query_dir = ltrim($query_dir, '/');
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $request->getUser(),
'repository' => $repository,
'path' => $query_dir,
));
$this->setDiffusionRequest($drequest);
$browse_results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest(
'diffusion.browsequery',
array(
'path' => $drequest->getPath(),
'path' => $query_dir,
'commit' => $drequest->getCommit(),
)));
$paths = $browse_results->getPaths();

View file

@ -2,10 +2,16 @@
final class DiffusionPathTreeController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->getDiffusionRequest();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
if (!$drequest->getRepository()->canUsePathTree()) {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
if (!$repository->canUsePathTree()) {
return new Aphront404Response();
}

View file

@ -2,37 +2,29 @@
final class DiffusionPathValidateController extends DiffusionController {
protected function shouldLoadDiffusionRequest() {
return false;
protected function getRepositoryIdentifierFromRequest(
AphrontRequest $request) {
return $request->getStr('repositoryPHID');
}
protected function processDiffusionRequest(AphrontRequest $request) {
$repository_phid = $request->getStr('repositoryPHID');
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($request->getUser())
->withPHIDs(array($repository_phid))
->executeOne();
if (!$repository) {
return new Aphront400Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$path = $request->getStr('path');
$path = ltrim($path, '/');
$drequest = DiffusionRequest::newFromDictionary(
array(
'user' => $request->getUser(),
'repository' => $repository,
'path' => $path,
));
$this->setDiffusionRequest($drequest);
$browse_results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest(
'diffusion.browsequery',
array(
'path' => $drequest->getPath(),
'path' => $path,
'commit' => $drequest->getCommit(),
'needValidityOnly' => true,
)));

View file

@ -7,8 +7,8 @@ final class DiffusionPushEventViewController
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$event = id(new PhabricatorRepositoryPushEventQuery())
->setViewer($viewer)
@ -25,7 +25,8 @@ final class DiffusionPushEventViewController
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
$repository->getName(),
$this->getApplicationURI($repository->getCallsign().'/'));
$repository->getURI());
$crumbs->addTextCrumb(
pht('Push Logs'),
$this->getApplicationURI(
@ -56,16 +57,15 @@ final class DiffusionPushEventViewController
->setHeaderText(pht('All Pushed Updates'))
->setTable($updates_table);
return $this->buildApplicationPage(
array(
$crumbs,
$detail_box,
$commits_box,
$update_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild(
array(
$detail_box,
$commits_box,
$update_box,
));
}
private function buildPropertyList(PhabricatorRepositoryPushEvent $event) {

View file

@ -6,29 +6,10 @@ final class DiffusionPushLogListController extends DiffusionPushLogController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new PhabricatorRepositoryPushLogSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function buildSideNavView($for_app = false) {
$viewer = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new PhabricatorRepositoryPushLogSearchEngine())
->setViewer($viewer)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
public function handleRequest(AphrontRequest $request) {
return id(new PhabricatorRepositoryPushLogSearchEngine())
->setController($this)
->buildResponse();
}
}

View file

@ -6,9 +6,13 @@ final class DiffusionRefTableController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
@ -132,18 +136,15 @@ final class DiffusionRefTableController extends DiffusionController {
$crumbs = $this->buildCrumbs(array());
$crumbs->addTextCrumb(pht('Refs'));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
),
array(
'title' => array(
pht('Refs'),
$repository->getMonogram(),
return $this->newPage()
->setTitle(
array(
$ref_name,
),
));
pht('Ref'),
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild($content);
}
}

View file

@ -6,16 +6,19 @@ final class DiffusionRepositoryController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$content = array();
$crumbs = $this->buildCrumbs();
$content[] = $crumbs;
$content[] = $this->buildPropertiesTable($drequest->getRepository());
@ -73,15 +76,19 @@ final class DiffusionRepositoryController extends DiffusionController {
->setErrors(array($empty_message));
}
return $this->buildApplicationPage(
$content,
array(
'title' => $drequest->getRepository()->getName(),
));
return $this->newPage()
->setTitle(
array(
$repository->getName(),
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild($content);
}
private function buildNormalContent(DiffusionRequest $drequest) {
$request = $this->getRequest();
$repository = $drequest->getRepository();
$phids = array();
@ -117,6 +124,9 @@ final class DiffusionRepositoryController extends DiffusionController {
$history_exception = $ex;
}
$browse_pager = id(new PHUIPagerView())
->readFromRequest($request);
try {
$browse_results = DiffusionBrowseResultSet::newFromConduit(
$this->callConduitWithDiffusionRequest(
@ -124,8 +134,10 @@ final class DiffusionRepositoryController extends DiffusionController {
array(
'path' => $drequest->getPath(),
'commit' => $drequest->getCommit(),
'limit' => $browse_pager->getPageSize() + 1,
)));
$browse_paths = $browse_results->getPaths();
$browse_paths = $browse_pager->sliceResults($browse_paths);
foreach ($browse_paths as $item) {
$data = $item->getLastCommitData();
@ -149,30 +161,18 @@ final class DiffusionRepositoryController extends DiffusionController {
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$readme = null;
if ($browse_results) {
$readme_path = $browse_results->getReadmePath();
if ($readme_path) {
$readme_content = $this->callConduitWithDiffusionRequest(
'diffusion.filecontentquery',
array(
'path' => $readme_path,
'commit' => $drequest->getStableCommit(),
));
if ($readme_content) {
$readme = id(new DiffusionReadmeView())
->setUser($this->getViewer())
->setPath($readme_path)
->setContent($readme_content['corpus']);
}
}
$readme = $this->renderDirectoryReadme($browse_results);
} else {
$readme = null;
}
$content[] = $this->buildBrowseTable(
$browse_results,
$browse_paths,
$browse_exception,
$handles);
$handles,
$browse_pager);
$content[] = $this->buildHistoryTable(
$history_results,
@ -217,7 +217,12 @@ final class DiffusionRepositoryController extends DiffusionController {
if (!$repository->isTracked()) {
$header->setStatus('fa-ban', 'dark', pht('Inactive'));
} else if ($repository->isImporting()) {
$header->setStatus('fa-clock-o', 'indigo', pht('Importing...'));
$ratio = $repository->loadImportProgress();
$percentage = sprintf('%.2f%%', 100 * $ratio);
$header->setStatus(
'fa-clock-o',
'indigo',
pht('Importing (%s)...', $percentage));
} else {
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
}
@ -480,7 +485,7 @@ final class DiffusionRepositoryController extends DiffusionController {
private function buildActionList(PhabricatorRepository $repository) {
$viewer = $this->getRequest()->getUser();
$edit_uri = $this->getApplicationURI($repository->getCallsign().'/edit/');
$edit_uri = $repository->getPathURI('edit/');
$view = id(new PhabricatorActionListView())
->setUser($viewer)
@ -500,9 +505,8 @@ final class DiffusionRepositoryController extends DiffusionController {
->setDisabled(!$can_edit));
if ($repository->isHosted()) {
$callsign = $repository->getCallsign();
$push_uri = $this->getApplicationURI(
'pushlog/?repositories=r'.$callsign);
'pushlog/?repositories='.$repository->getMonogram());
$view->addAction(
id(new PhabricatorActionView())
@ -551,7 +555,6 @@ final class DiffusionRepositoryController extends DiffusionController {
}
$history_table->setIsHead(true);
$callsign = $drequest->getRepository()->getCallsign();
$icon = id(new PHUIIconView())
->setIconFont('fa-list-alt');
@ -579,7 +582,8 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_results,
$browse_paths,
$browse_exception,
array $handles) {
array $handles,
PHUIPagerView $pager) {
require_celerity_resource('diffusion-icons-css');
@ -660,7 +664,19 @@ final class DiffusionRepositoryController extends DiffusionController {
$browse_panel->setTable($browse_table);
return array($locate_panel, $browse_panel);
$pager->setURI($browse_uri, 'offset');
if ($pager->willShowPagingControls()) {
$pager_box = $this->renderTablePagerBox($pager);
} else {
$pager_box = null;
}
return array(
$locate_panel,
$browse_panel,
$pager_box,
);
}
private function renderCloneCommand(

View file

@ -6,7 +6,7 @@ final class DiffusionRepositoryCreateController
private $edit;
private $repository;
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$this->edit = $request->getURIData('edit');
@ -19,6 +19,11 @@ final class DiffusionRepositoryCreateController
switch ($this->edit) {
case 'remote':
case 'policy':
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$repository = $this->getDiffusionRequest()->getRepository();
// Make sure we have CAN_EDIT.
@ -275,14 +280,10 @@ final class DiffusionRepositoryCreateController
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title);
return $this->buildApplicationPage(
array(
$crumbs,
$form,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($form);
}

View file

@ -2,7 +2,12 @@
final class DiffusionRepositoryDefaultController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
// NOTE: This controller is just here to make sure we call
// willBeginExecution() on any /diffusion/X/ URI, so we can intercept
// `git`, `hg` and `svn` HTTP protocol requests.
@ -11,7 +16,10 @@ final class DiffusionRepositoryDefaultController extends DiffusionController {
// clone URI with "/anything.git" at the end into their web browser.
// Send them to the canonical repository URI.
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
return id(new AphrontRedirectResponse())
->setURI($this->getDiffusionRequest()->getRepository()->getURI());
->setURI($repository->getURI());
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditActionsController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
// NOTE: We're inverting these here, because the storage is silly.
@ -109,14 +100,10 @@ final class DiffusionRepositoryEditActionsController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($form_box);
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditActivateController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
if ($request->isFormPost()) {
@ -38,28 +29,21 @@ final class DiffusionRepositoryEditActivateController
return id(new AphrontReloadResponse())->setURI($edit_uri);
}
$dialog = id(new AphrontDialogView())
->setUser($viewer);
if ($repository->isTracked()) {
$dialog
return $this->newDialog()
->setTitle(pht('Deactivate Repository?'))
->appendChild(
pht('Deactivate this repository?'))
->addSubmitButton(pht('Deactivate Repository'))
->addCancelButton($edit_uri);
} else {
$dialog
return $this->newDialog()
->setTitle(pht('Activate Repository?'))
->appendChild(
pht('Activate this repository?'))
->addSubmitButton(pht('Activate Repository'))
->addCancelButton($edit_uri);
}
return id(new AphrontDialogResponse())
->setDialog($dialog);
}
}

View file

@ -3,24 +3,16 @@
final class DiffusionRepositoryEditAutomationController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
if (!$repository->supportsAutomation()) {
return new Aphront404Response();
}
@ -81,14 +73,10 @@ final class DiffusionRepositoryEditAutomationController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
}

View file

@ -3,31 +3,24 @@
final class DiffusionRepositoryEditBasicController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->needProjectPHIDs(true)
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $request->getUser();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$v_name = $repository->getName();
$v_desc = $repository->getDetail('description');
$v_clone_name = $repository->getDetail('clone-name');
$v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
$repository->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
$e_name = true;
$errors = array();
@ -81,7 +74,7 @@ final class DiffusionRepositoryEditBasicController
id(new PhabricatorRepositoryEditor())
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request)
->setActor($user)
->setActor($viewer)
->applyTransactions($repository, $xactions);
return id(new AphrontRedirectResponse())->setURI($edit_uri);
@ -94,7 +87,7 @@ final class DiffusionRepositoryEditBasicController
$title = pht('Edit %s', $repository->getName());
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->appendChild(
id(new AphrontFormTextControl())
->setName('name')
@ -118,7 +111,7 @@ final class DiffusionRepositoryEditBasicController
$form
->appendChild(
id(new PhabricatorRemarkupControl())
->setUser($user)
->setUser($viewer)
->setName('description')
->setLabel(pht('Description'))
->setValue($v_desc))
@ -127,7 +120,7 @@ final class DiffusionRepositoryEditBasicController
->setDatasource(new PhabricatorProjectDatasource())
->setName('projectPHIDs')
->setLabel(pht('Projects'))
->setValue($repository->getProjectPHIDs()))
->setValue($v_projects))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save'))
@ -140,14 +133,10 @@ final class DiffusionRepositoryEditBasicController
->setForm($form)
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
private function getReadmeInstructions() {

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditBranchesController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$request = $this->getRequest();
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$is_git = false;
$is_hg = false;
@ -226,14 +217,10 @@ final class DiffusionRepositoryEditBranchesController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($form_box);
}
private function processBranches($string) {

View file

@ -6,12 +6,13 @@ abstract class DiffusionRepositoryEditController
protected function buildApplicationCrumbs($is_main = false) {
$crumbs = parent::buildApplicationCrumbs();
if ($this->diffusionRequest) {
$repository = $this->getDiffusionRequest()->getRepository();
$repo_uri = $this->getRepositoryControllerURI($repository, '');
if ($this->hasDiffusionRequest()) {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$repo_uri = $repository->getURI();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$crumbs->addTextCrumb('r'.$repository->getCallsign(), $repo_uri);
$crumbs->addTextCrumb($repository->getDisplayname(), $repo_uri);
if ($is_main) {
$crumbs->addTextCrumb(pht('Edit Repository'));

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditDangerousController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
if (!$repository->canAllowDangerousChanges()) {
return new Aphront400Response();
}
@ -42,13 +33,10 @@ final class DiffusionRepositoryEditDangerousController
return id(new AphrontReloadResponse())->setURI($edit_uri);
}
$dialog = id(new AphrontDialogView())
->setUser($viewer);
$force = phutil_tag('tt', array(), '--force');
if ($repository->shouldAllowDangerousChanges()) {
$dialog
return $this->newDialog()
->setTitle(pht('Prevent Dangerous changes?'))
->appendChild(
pht(
@ -58,7 +46,7 @@ final class DiffusionRepositoryEditDangerousController
->addSubmitButton(pht('Prevent Dangerous Changes'))
->addCancelButton($edit_uri);
} else {
$dialog
return $this->newDialog()
->setTitle(pht('Allow Dangerous Changes?'))
->appendChild(
pht(
@ -69,9 +57,6 @@ final class DiffusionRepositoryEditDangerousController
->addSubmitButton(pht('Allow Dangerous Changes'))
->addCancelButton($edit_uri);
}
return id(new AphrontDialogResponse())
->setDialog($dialog);
}
}

View file

@ -3,24 +3,16 @@
final class DiffusionRepositoryEditDeleteController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$dialog = new AphrontDialogView();
@ -45,14 +37,10 @@ final class DiffusionRepositoryEditDeleteController
phutil_tag('p', array(), $text_2),
));
$dialog = id(new AphrontDialogView())
->setUser($request->getUser())
return $this->newDialog()
->setTitle(pht('Really want to delete the repository?'))
->appendChild($body)
->addCancelButton($edit_uri, pht('Okay'));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditEncodingController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$user = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$v_encoding = $repository->getDetail('encoding');
@ -79,14 +70,10 @@ final class DiffusionRepositoryEditEncodingController
->setForm($form)
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
private function getEncodingInstructions() {

View file

@ -5,25 +5,17 @@ final class DiffusionRepositoryEditHostingController
private $serve;
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$this->serve = $request->getURIData('serve');
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$this->serve = $request->getURIData('serve');
if (!$this->serve) {
return $this->handleHosting($repository);
} else {
@ -107,14 +99,10 @@ final class DiffusionRepositoryEditHostingController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
public function handleProtocols(PhabricatorRepository $repository) {
@ -272,14 +260,10 @@ final class DiffusionRepositoryEditHostingController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
}

View file

@ -3,15 +3,15 @@
final class DiffusionRepositoryEditMainController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
PhabricatorPolicyFilter::requireCapability(
$viewer,
$repository,
PhabricatorPolicyCapability::CAN_EDIT);
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$is_svn = false;
$is_git = false;
@ -1137,45 +1137,8 @@ final class DiffusionRepositoryEditMainController
}
if ($repository->isImporting()) {
$progress = queryfx_all(
$repository->establishConnection('r'),
'SELECT importStatus, count(*) N FROM %T WHERE repositoryID = %d
GROUP BY importStatus',
id(new PhabricatorRepositoryCommit())->getTableName(),
$repository->getID());
$done = 0;
$total = 0;
foreach ($progress as $row) {
$total += $row['N'] * 4;
$status = $row['importStatus'];
if ($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE) {
$done += $row['N'];
}
if ($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE) {
$done += $row['N'];
}
if ($status & PhabricatorRepositoryCommit::IMPORTED_OWNERS) {
$done += $row['N'];
}
if ($status & PhabricatorRepositoryCommit::IMPORTED_HERALD) {
$done += $row['N'];
}
}
if ($total) {
$percentage = 100 * ($done / $total);
} else {
$percentage = 0;
}
// Cap this at "99.99%", because it's confusing to users when the actual
// fraction is "99.996%" and it rounds up to "100.00%".
if ($percentage > 99.99) {
$percentage = 99.99;
}
$percentage = sprintf('%.2f%%', $percentage);
$ratio = $repository->loadImportProgress();
$percentage = sprintf('%.2f%%', 100 * $ratio);
$view->addItem(
id(new PHUIStatusItemView())

View file

@ -3,23 +3,16 @@
final class DiffusionRepositoryEditStagingController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
}
if (!$repository->supportsStaging()) {
return new Aphront404Response();
@ -43,7 +36,7 @@ final class DiffusionRepositoryEditStagingController
id(new PhabricatorRepositoryEditor())
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request)
->setActor($user)
->setActor($viewer)
->applyTransactions($repository, $xactions);
return id(new AphrontRedirectResponse())->setURI($edit_uri);
@ -55,7 +48,7 @@ final class DiffusionRepositoryEditStagingController
$title = pht('Edit %s', $repository->getName());
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->appendRemarkupInstructions(
pht(
"To make it easier to run integration tests and builds on code ".
@ -79,14 +72,10 @@ final class DiffusionRepositoryEditStagingController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditStorageController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$v_local = $repository->getHumanReadableDetail('local-path');
@ -44,7 +35,7 @@ final class DiffusionRepositoryEditStorageController
}
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Storage Service'))
@ -60,8 +51,8 @@ final class DiffusionRepositoryEditStorageController
"web interface. To edit it, run this command:\n\n %s",
sprintf(
'phabricator/ $ ./bin/repository edit %s --as %s --local-path ...',
$repository->getCallsign(),
$user->getUsername())))
$repository->getMonogram(),
$viewer->getUsername())))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($edit_uri, pht('Done')));
@ -71,14 +62,10 @@ final class DiffusionRepositoryEditStorageController
->setForm($form)
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositoryEditSubversionController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
@ -108,14 +99,10 @@ final class DiffusionRepositoryEditSubversionController
->setHeaderText($title)
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($form_box);
}
}

View file

@ -3,30 +3,22 @@
final class DiffusionRepositoryEditUpdateController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
if ($request->isFormPost()) {
$params = array(
'callsigns' => array(
$repository->getCallsign(),
'repositories' => array(
$repository->getPHID(),
),
);

View file

@ -6,28 +6,10 @@ final class DiffusionRepositoryListController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new PhabricatorRepositorySearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function buildSideNavView($for_app = false) {
$viewer = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new PhabricatorRepositorySearchEngine())
->setViewer($viewer)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
public function handleRequest(AphrontRequest $request) {
return id(new PhabricatorRepositorySearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {

View file

@ -2,8 +2,8 @@
final class DiffusionRepositoryNewController extends DiffusionController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$this->requireApplicationCapability(
DiffusionCreateRepositoriesCapability::CAPABILITY);
@ -70,14 +70,10 @@ final class DiffusionRepositoryNewController extends DiffusionController {
->setHeaderText(pht('Create or Import Repository'))
->setForm($form);
return $this->buildApplicationPage(
array(
$crumbs,
$form_box,
),
array(
'title' => pht('New Repository'),
));
return $this->newPage()
->setTitle(pht('New Repository'))
->setCrumbs($crumbs)
->appendChild($form_box);
}
}

View file

@ -3,25 +3,16 @@
final class DiffusionRepositorySymbolsController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($user)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
$v_sources = $repository->getSymbolSources();
@ -55,7 +46,7 @@ final class DiffusionRepositorySymbolsController
id(new PhabricatorRepositoryEditor())
->setContinueOnNoEffect(true)
->setContentSourceFromRequest($request)
->setActor($user)
->setActor($viewer)
->applyTransactions($repository, $xactions);
return id(new AphrontRedirectResponse())->setURI($edit_uri);
@ -71,7 +62,7 @@ final class DiffusionRepositorySymbolsController
$title = pht('Edit %s', $repository->getName());
$form = id(new AphrontFormView())
->setUser($user)
->setUser($viewer)
->appendRemarkupInstructions($this->getInstructions())
->appendChild(
id(new AphrontFormTextControl())
@ -99,14 +90,10 @@ final class DiffusionRepositorySymbolsController
->setForm($form)
->setFormErrors($errors);
return $this->buildApplicationPage(
array(
$crumbs,
$object_box,
),
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($object_box);
}
private function getInstructions() {

View file

@ -3,24 +3,16 @@
final class DiffusionRepositoryTestAutomationController
extends DiffusionRepositoryEditController {
protected function processDiffusionRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$drequest = $this->diffusionRequest;
$repository = $drequest->getRepository();
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->withIDs(array($repository->getID()))
->executeOne();
if (!$repository) {
return new Aphront404Response();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContextForEdit();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
if (!$repository->canPerformAutomation()) {

View file

@ -2,12 +2,9 @@
final class DiffusionServeController extends DiffusionController {
protected function shouldLoadDiffusionRequest() {
return false;
}
public static function isVCSRequest(AphrontRequest $request) {
if (!self::getCallsign($request)) {
public function isVCSRequest(AphrontRequest $request) {
$identifier = $this->getRepositoryIdentifierFromRequest($request);
if ($identifier === null) {
return null;
}
@ -47,20 +44,8 @@ final class DiffusionServeController extends DiffusionController {
return $vcs;
}
private static function getCallsign(AphrontRequest $request) {
$uri = $request->getRequestURI();
$regex = '@^/diffusion/(?P<callsign>[A-Z]+)(/|$)@';
$matches = null;
if (!preg_match($regex, (string)$uri, $matches)) {
return null;
}
return $matches['callsign'];
}
protected function processDiffusionRequest(AphrontRequest $request) {
$callsign = self::getCallsign($request);
public function handleRequest(AphrontRequest $request) {
$identifier = $this->getRepositoryIdentifierFromRequest($request);
// If authentication credentials have been provided, try to find a user
// that actually matches those credentials.
@ -99,7 +84,7 @@ final class DiffusionServeController extends DiffusionController {
try {
$repository = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withCallsigns(array($callsign))
->withIdentifiers(array($identifier))
->executeOne();
if (!$repository) {
return new PhabricatorVCSResponse(

View file

@ -2,15 +2,13 @@
final class DiffusionSymbolController extends DiffusionController {
private $name;
protected function processDiffusionRequest(AphrontRequest $request) {
$user = $request->getUser();
$this->name = $request->getURIData('name');
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$name = $request->getURIData('name');
$query = id(new DiffusionSymbolQuery())
->setViewer($user)
->setName($this->name);
->setViewer($viewer)
->setName($name);
if ($request->getStr('context')) {
$query->setContext($request->getStr('context'));
@ -48,9 +46,8 @@ final class DiffusionSymbolController extends DiffusionController {
$symbols = $query->execute();
$external_query = id(new DiffusionExternalSymbolQuery())
->withNames(array($this->name));
->withNames(array($name));
if ($request->getStr('context')) {
$external_query->withContexts(array($request->getStr('context')));
@ -137,15 +134,17 @@ final class DiffusionSymbolController extends DiffusionController {
$table->setNoDataString(
pht('No matching symbol could be found in any indexed repository.'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Similar Symbols'));
$panel->setTable($table);
$panel = id(new PHUIObjectBoxView())
->setHeaderText(pht('Similar Symbols'))
->setTable($table);
return $this->buildApplicationPage(
$panel,
array(
'title' => pht('Find Symbol'),
));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Find Symbol'));
return $this->newPage()
->setTitle(pht('Find Symbol'))
->setCrumbs($crumbs)
->appendChild($panel);
}
}

View file

@ -6,22 +6,25 @@ final class DiffusionTagListController extends DiffusionController {
return true;
}
protected function processDiffusionRequest(AphrontRequest $request) {
$drequest = $this->getDiffusionRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$response = $this->loadDiffusionContext();
if ($response) {
return $response;
}
$viewer = $this->getViewer();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$pager = new PHUIPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getInt('offset'));
$pager = id(new PHUIPagerView())
->readFromRequest($request);
$params = array(
'limit' => $pager->getPageSize() + 1,
'offset' => $pager->getOffset(),
);
if ($drequest->getSymbolicCommit()) {
if (strlen($drequest->getSymbolicCommit())) {
$is_commit = true;
$params['commit'] = $drequest->getSymbolicCommit();
} else {
@ -79,18 +82,20 @@ final class DiffusionTagListController extends DiffusionController {
'commit' => $drequest->getSymbolicCommit(),
));
return $this->buildApplicationPage(
array(
$crumbs,
$content,
$pager,
),
array(
'title' => array(
$pager_box = $this->renderTablePagerBox($pager);
return $this->newPage()
->setTitle(
array(
pht('Tags'),
pht('%s Repository', $repository->getCallsign()),
),
));
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
->appendChild(
array(
$content,
$pager_box,
));
}
}

View file

@ -1,63 +0,0 @@
<?php
final class DiffusionFileContent extends Phobject {
private $corpus;
private $blameDict;
private $revList;
private $textList;
public function setTextList(array $text_list) {
$this->textList = $text_list;
return $this;
}
public function getTextList() {
if (!$this->textList) {
return phutil_split_lines($this->getCorpus(), $retain_ends = false);
}
return $this->textList;
}
public function setRevList(array $rev_list) {
$this->revList = $rev_list;
return $this;
}
public function getRevList() {
return $this->revList;
}
public function setBlameDict(array $blame_dict) {
$this->blameDict = $blame_dict;
return $this;
}
public function getBlameDict() {
return $this->blameDict;
}
public function setCorpus($corpus) {
$this->corpus = $corpus;
return $this;
}
public function getCorpus() {
return $this->corpus;
}
public function toDictionary() {
return array(
'corpus' => $this->getCorpus(),
'blameDict' => $this->getBlameDict(),
'revList' => $this->getRevList(),
'textList' => $this->getTextList(),
);
}
public static function newFromConduit(array $dict) {
return id(new DiffusionFileContent())
->setCorpus($dict['corpus'])
->setBlameDict($dict['blameDict'])
->setRevList($dict['revList'])
->setTextList($dict['textList']);
}
}

View file

@ -28,7 +28,7 @@ final class DiffusionHovercardEngineExtension
$author_phid = $commit->getAuthorPHID();
if ($author_phid) {
$author = $viewer->loadHandle($author)->renderLink();
$author = $viewer->renderHandle($author_phid);
} else {
$commit_data = $commit->loadCommitData();
$author = phutil_tag('em', array(), $commit_data->getAuthorName());

View file

@ -14,7 +14,7 @@ final class DiffusionCommitBranchesHeraldField
$repository = $object->getRepository();
$params = array(
'callsign' => $repository->getCallsign(),
'repository' => $repository->getPHID(),
'contains' => $commit->getCommitIdentifier(),
);

View file

@ -130,10 +130,7 @@ final class HeraldCommitAdapter
}
public function getHeraldName() {
return
'r'.
$this->repository->getCallsign().
$this->commit->getCommitIdentifier();
return $this->commit->getMonogram();
}
public function loadAffectedPaths() {

View file

@ -51,6 +51,11 @@ final class DiffusionCommitQuery
* they queried for.
*/
public function withIdentifiers(array $identifiers) {
// Some workflows (like blame lookups) can pass in large numbers of
// duplicate identifiers. We only care about unique identifiers, so
// get rid of duplicates immediately.
$identifiers = array_fuse($identifiers);
$this->identifiers = $identifiers;
return $this;
}
@ -185,7 +190,7 @@ final class DiffusionCommitQuery
// Build the identifierMap
if ($this->identifiers !== null) {
$ids = array_fuse($this->identifiers);
$ids = $this->identifiers;
$prefixes = array(
'r'.$commit->getRepository()->getCallsign(),
'r'.$commit->getRepository()->getCallsign().':',
@ -395,7 +400,6 @@ final class DiffusionCommitQuery
$repos->execute();
$repos = $repos->getIdentifierMap();
foreach ($refs as $key => $ref) {
$repo = idx($repos, $ref['callsign']);
@ -404,7 +408,7 @@ final class DiffusionCommitQuery
}
if ($repo->isSVN()) {
if (!ctype_digit($ref['identifier'])) {
if (!ctype_digit((string)$ref['identifier'])) {
continue;
}
$sql[] = qsprintf(
@ -419,11 +423,25 @@ final class DiffusionCommitQuery
if (strlen($ref['identifier']) < $min_qualified) {
continue;
}
$sql[] = qsprintf(
$conn,
'(commit.repositoryID = %d AND commit.commitIdentifier LIKE %>)',
$repo->getID(),
$ref['identifier']);
$identifier = $ref['identifier'];
if (strlen($identifier) == 40) {
// MySQL seems to do slightly better with this version if the
// clause, so issue it if we have a full commit hash.
$sql[] = qsprintf(
$conn,
'(commit.repositoryID = %d
AND commit.commitIdentifier = %s)',
$repo->getID(),
$identifier);
} else {
$sql[] = qsprintf(
$conn,
'(commit.repositoryID = %d
AND commit.commitIdentifier LIKE %>)',
$repo->getID(),
$identifier);
}
}
}
}

View file

@ -53,7 +53,7 @@ abstract class DiffusionQuery extends PhabricatorQuery {
$repository = $drequest->getRepository();
$core_params = array(
'callsign' => $repository->getCallsign(),
'repository' => $repository->getPHID(),
);
if ($drequest->getBranch() !== null) {

View file

@ -1,32 +0,0 @@
<?php
final class DiffusionGitFileContentQueryTestCase extends PhabricatorTestCase {
public function testAuthorName() {
// A normal case - no parenthesis in user name
$result = DiffusionGitFileContentQuery::match(
'8220d5d54f6d5d5552a636576cbe9c35f15b65b2 '.
'(Andrew Gallagher 2010-12-03 324) $somevar = $this->call()');
$this->assertEqual($result[0], '8220d5d54f6d5d5552a636576cbe9c35f15b65b2');
$this->assertEqual($result[1], 'Andrew Gallagher');
$this->assertEqual($result[2], ' $somevar = $this->call()');
// User name like 'Jimmy (He) Zhang'
$result = DiffusionGitFileContentQuery::match(
'8220d5d54f6d5d5552a636576cbe9c35f15b65b2 '.
'( Jimmy (He) Zhang 2013-10-11 5) '.
'code(); "(string literal 9999-99-99 2)"; more_code();');
$this->assertEqual($result[1], 'Jimmy (He) Zhang');
$this->assertEqual($result[2],
' code(); "(string literal 9999-99-99 2)"; more_code();');
// User name like 'Scott Shapiro (Ads Product Marketing)'
$result = DiffusionGitFileContentQuery::match(
'8220d5d54f6d5d5552a636576cbe9c35f15b65b2 '.
'( Scott Shapiro (Ads Product Marketing) 2013-10-11 5) '.
'code(); "(string literal 9999-99-99 2)"; more_code();');
$this->assertEqual($result[1], 'Scott Shapiro (Ads Product Marketing)');
$this->assertEqual($result[2],
' code(); "(string literal 9999-99-99 2)"; more_code();');
}
}

View file

@ -0,0 +1,182 @@
<?php
abstract class DiffusionBlameQuery extends DiffusionQuery {
private $timeout;
private $paths;
public function setTimeout($timeout) {
$this->timeout = $timeout;
return $this;
}
public function getTimeout() {
return $this->timeout;
}
public function setPaths(array $paths) {
$this->paths = $paths;
return $this;
}
public function getPaths() {
return $this->paths;
}
abstract protected function newBlameFuture(DiffusionRequest $request, $path);
abstract protected function resolveBlameFuture(ExecFuture $future);
final public static function newFromDiffusionRequest(
DiffusionRequest $request) {
return parent::newQueryObject(__CLASS__, $request);
}
final protected function executeQuery() {
$paths = $this->getPaths();
$blame = array();
// Load cache keys: these are the commits at which each path was last
// touched.
$keys = $this->loadCacheKeys($paths);
// Try to read blame data from cache.
$cache = $this->readCacheData($keys);
foreach ($paths as $key => $path) {
if (!isset($cache[$path])) {
continue;
}
$blame[$path] = $cache[$path];
unset($paths[$key]);
}
// If we have no paths left, we filled everything from cache and can
// bail out early.
if (!$paths) {
return $blame;
}
$request = $this->getRequest();
$timeout = $this->getTimeout();
// We're still missing at least some data, so we need to run VCS commands
// to pull it.
$futures = array();
foreach ($paths as $path) {
$future = $this->newBlameFuture($request, $path);
if ($timeout) {
$future->setTimeout($timeout);
}
$futures[$path] = $future;
}
$futures = id(new FutureIterator($futures))
->limit(4);
foreach ($futures as $path => $future) {
$path_blame = $this->resolveBlameFuture($future);
if ($path_blame !== null) {
$blame[$path] = $path_blame;
}
}
// Fill the cache with anything we generated.
$this->writeCacheData(
array_select_keys($keys, $paths),
$blame);
return $blame;
}
private function loadCacheKeys(array $paths) {
$request = $this->getRequest();
$viewer = $request->getUser();
$repository = $request->getRepository();
$repository_id = $repository->getID();
$last_modified = parent::callConduitWithDiffusionRequest(
$viewer,
$request,
'diffusion.lastmodifiedquery',
array(
'paths' => array_fill_keys($paths, $request->getCommit()),
));
$map = array();
foreach ($paths as $path) {
$identifier = idx($last_modified, $path);
if ($identifier === null) {
continue;
}
$path_hash = PhabricatorHash::digestForIndex($path);
$map[$path] = "blame({$repository_id}, {$identifier}, {$path_hash}, raw)";
}
return $map;
}
private function readCacheData(array $keys) {
$cache = PhabricatorCaches::getImmutableCache();
$data = $cache->getKeys($keys);
$results = array();
foreach ($keys as $path => $key) {
if (!isset($data[$key])) {
continue;
}
$results[$path] = $data[$key];
}
// Decode the cache storage format.
foreach ($results as $path => $cache) {
list($head, $body) = explode("\n", $cache, 2);
switch ($head) {
case 'raw':
$body = explode("\n", $body);
break;
default:
$body = null;
break;
}
if ($body === null) {
unset($results[$path]);
} else {
$results[$path] = $body;
}
}
return $results;
}
private function writeCacheData(array $keys, array $blame) {
$writes = array();
foreach ($keys as $path => $key) {
$value = idx($blame, $path);
if ($value === null) {
continue;
}
// For now, just store the entire value with a "raw" header. In the
// future, we could compress this or use IDs instead.
$value = "raw\n".implode("\n", $value);
$writes[$key] = $value;
}
if (!$writes) {
return;
}
$cache = PhabricatorCaches::getImmutableCache();
$data = $cache->setKeys($writes, phutil_units('14 days in seconds'));
}
}

View file

@ -0,0 +1,34 @@
<?php
final class DiffusionGitBlameQuery extends DiffusionBlameQuery {
protected function newBlameFuture(DiffusionRequest $request, $path) {
$repository = $request->getRepository();
$commit = $request->getCommit();
return $repository->getLocalCommandFuture(
'--no-pager blame -s -l %s -- %s',
$commit,
$path);
}
protected function resolveBlameFuture(ExecFuture $future) {
list($err, $stdout) = $future->resolve();
if ($err) {
return null;
}
$result = array();
$lines = phutil_split_lines($stdout);
foreach ($lines as $line) {
list($commit) = explode(' ', $line, 2);
$result[] = $commit;
}
return $result;
}
}

View file

@ -0,0 +1,36 @@
<?php
final class DiffusionMercurialBlameQuery extends DiffusionBlameQuery {
protected function newBlameFuture(DiffusionRequest $request, $path) {
$repository = $request->getRepository();
$commit = $request->getCommit();
// NOTE: We're using "--debug" to make "--changeset" give us the full
// commit hashes.
return $repository->getLocalCommandFuture(
'annotate --debug --changeset --rev %s -- %s',
$commit,
$path);
}
protected function resolveBlameFuture(ExecFuture $future) {
list($err, $stdout) = $future->resolve();
if ($err) {
return null;
}
$result = array();
$lines = phutil_split_lines($stdout);
foreach ($lines as $line) {
list($commit) = explode(':', $line, 2);
$result[] = $commit;
}
return $result;
}
}

Some files were not shown because too many files have changed in this diff Show more