Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14768902
D12533.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D12533.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '9a9b59ca',
- 'core.pkg.js' => '80671b76',
+ 'core.pkg.js' => '348d5193',
'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '3500921f',
'differential.pkg.js' => 'c0506961',
@@ -222,7 +222,7 @@
'rsrc/externals/javelin/lib/__tests__/URI.js' => '1e45fda9',
'rsrc/externals/javelin/lib/__tests__/behavior.js' => '1ea62783',
'rsrc/externals/javelin/lib/behavior.js' => '61cbc29a',
- 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => '3ff74d77',
+ 'rsrc/externals/javelin/lib/control/tokenizer/Tokenizer.js' => 'ab5f468d',
'rsrc/externals/javelin/lib/control/typeahead/Typeahead.js' => '70baed2f',
'rsrc/externals/javelin/lib/control/typeahead/normalizer/TypeaheadNormalizer.js' => 'e6e25838',
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadCompositeSource.js' => '503e17fd',
@@ -689,7 +689,7 @@
'javelin-scrollbar' => 'eaa5b321',
'javelin-sound' => '949c0fe5',
'javelin-stratcom' => '6c53634d',
- 'javelin-tokenizer' => '3ff74d77',
+ 'javelin-tokenizer' => 'ab5f468d',
'javelin-typeahead' => '70baed2f',
'javelin-typeahead-composite-source' => '503e17fd',
'javelin-typeahead-normalizer' => 'e6e25838',
@@ -1080,12 +1080,6 @@
'javelin-dom',
'phortune-credit-card-form',
),
- '3ff74d77' => array(
- 'javelin-dom',
- 'javelin-util',
- 'javelin-stratcom',
- 'javelin-install',
- ),
'40a6a403' => array(
'javelin-install',
'javelin-dom',
@@ -1669,6 +1663,12 @@
'javelin-util',
'phabricator-prefab',
),
+ 'ab5f468d' => array(
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-stratcom',
+ 'javelin-install',
+ ),
'b1a59974' => array(
'javelin-behavior',
'javelin-aphlict',
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -10,7 +10,6 @@
private $uuids;
private $nameContains;
private $remoteURIs;
- private $anyProjectPHIDs;
private $datasourceQuery;
private $numericIdentifiers;
@@ -99,11 +98,6 @@
return $this;
}
- public function withAnyProjects(array $projects) {
- $this->anyProjectPHIDs = $projects;
- return $this;
- }
-
public function withDatasourceQuery($query) {
$this->datasourceQuery = $query;
return $this;
@@ -163,10 +157,13 @@
$data = queryfx_all(
$conn_r,
- 'SELECT * FROM %T r %Q %Q %Q %Q',
+ '%Q FROM %T r %Q %Q %Q %Q %Q %Q',
+ $this->buildSelectClause($conn_r),
$table->getTableName(),
- $this->buildJoinsClause($conn_r),
+ $this->buildJoinClause($conn_r),
$this->buildWhereClause($conn_r),
+ $this->buildGroupClause($conn_r),
+ $this->buildHavingClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
@@ -390,32 +387,46 @@
return $map;
}
- private function buildJoinsClause(AphrontDatabaseConnection $conn_r) {
- $joins = array();
-
- $join_summary_table = $this->needCommitCounts ||
- $this->needMostRecentCommits;
-
- $vector = $this->getOrderVector();
- if ($vector->containsKey('committed') ||
- $vector->containsKey('size')) {
- $join_summary_table = true;
+ protected function buildSelectClause(AphrontDatabaseConnection $conn) {
+ $parts = $this->buildSelectClauseParts($conn);
+ if ($this->shouldJoinSummaryTable()) {
+ $parts[] = 's.*';
}
+ return $this->formatSelectClause($parts);
+ }
- if ($join_summary_table) {
+ protected function buildJoinClause(AphrontDatabaseConnection $conn_r) {
+ $joins = $this->buildJoinClauseParts($conn_r);
+
+ if ($this->shouldJoinSummaryTable()) {
$joins[] = qsprintf(
$conn_r,
'LEFT JOIN %T s ON r.id = s.repositoryID',
PhabricatorRepository::TABLE_SUMMARY);
}
- if ($this->anyProjectPHIDs) {
- $joins[] = qsprintf(
- $conn_r,
- 'JOIN edge e ON e.src = r.phid');
+ return $this->formatJoinClause($joins);
+ }
+
+ private function shouldJoinSummaryTable() {
+ if ($this->needCommitCounts) {
+ return true;
}
- return implode(' ', $joins);
+ if ($this->needMostRecentCommits) {
+ return true;
+ }
+
+ $vector = $this->getOrderVector();
+ if ($vector->containsKey('committed')) {
+ return true;
+ }
+
+ if ($vector->containsKey('size')) {
+ return true;
+ }
+
+ return false;
}
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
@@ -492,13 +503,6 @@
$this->nameContains);
}
- if ($this->anyProjectPHIDs) {
- $where[] = qsprintf(
- $conn_r,
- 'e.dst IN (%Ls)',
- $this->anyProjectPHIDs);
- }
-
if (strlen($this->datasourceQuery)) {
// This handles having "rP" match callsigns starting with "P...".
$query = trim($this->datasourceQuery);
diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
--- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
+++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php
@@ -20,7 +20,10 @@
$saved->setParameter('hosted', $request->getStr('hosted'));
$saved->setParameter('types', $request->getArr('types'));
$saved->setParameter('name', $request->getStr('name'));
- $saved->setParameter('anyProjectPHIDs', $request->getArr('anyProjects'));
+
+ $saved->setParameter(
+ 'projects',
+ $this->readProjectsFromRequest($request, 'projects'));
return $saved;
}
@@ -60,10 +63,9 @@
$query->withNameContains($name);
}
- $any_project_phids = $saved->getParameter('anyProjectPHIDs');
- if ($any_project_phids) {
- $query->withAnyProjects($any_project_phids);
- }
+ $adjusted = clone $saved;
+ $adjusted->setParameter('projects', $this->readProjectTokens($saved));
+ $this->setQueryProjects($query, $adjusted);
return $query;
}
@@ -76,7 +78,7 @@
$types = $saved_query->getParameter('types', array());
$types = array_fuse($types);
$name = $saved_query->getParameter('name');
- $any_project_phids = $saved_query->getParameter('anyProjectPHIDs', array());
+ $projects = $this->readProjectTokens($saved_query);
$form
->appendChild(
@@ -91,10 +93,10 @@
->setValue($name))
->appendControl(
id(new AphrontFormTokenizerControl())
- ->setDatasource(new PhabricatorProjectDatasource())
- ->setName('anyProjects')
- ->setLabel(pht('In Any Project'))
- ->setValue($any_project_phids))
+ ->setDatasource(new PhabricatorProjectLogicalDatasource())
+ ->setName('projects')
+ ->setLabel(pht('Projects'))
+ ->setValue($projects))
->appendChild(
id(new AphrontFormSelectControl())
->setName('status')
@@ -266,4 +268,15 @@
return $list;
}
+ private function readProjectTokens(PhabricatorSavedQuery $saved) {
+ $projects = $saved->getParameter('projects', array());
+
+ $any = $saved->getParameter('anyProjectPHIDs', array());
+ foreach ($any as $project) {
+ $projects[] = 'any('.$project.')';
+ }
+
+ return $projects;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 24, 7:41 PM (21 h, 12 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7042952
Default Alt Text
D12533.diff (7 KB)
Attached To
Mode
D12533: Support tokenizer functions in Diffusion
Attached
Detach File
Event Timeline
Log In to Comment