Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15429294
D14988.id36221.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14988.id36221.diff
View Options
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
@@ -17,6 +17,7 @@
private $callsignIdentifiers;
private $phidIdentifiers;
private $monogramIdentifiers;
+ private $slugIdentifiers;
private $identifierMap;
@@ -56,26 +57,38 @@
$callsigns = array();
$phids = array();
$monograms = array();
+ $slugs = array();
foreach ($identifiers as $identifier) {
if (ctype_digit((string)$identifier)) {
$ids[$identifier] = $identifier;
- } else if (preg_match('/^(r[A-Z]+)|(R[1-9]\d*)\z/', $identifier)) {
+ continue;
+ }
+
+ if (preg_match('/^(r[A-Z]+)|(R[1-9]\d*)\z/', $identifier)) {
$monograms[$identifier] = $identifier;
- } else {
- $repository_type = PhabricatorRepositoryRepositoryPHIDType::TYPECONST;
- if (phid_get_type($identifier) === $repository_type) {
- $phids[$identifier] = $identifier;
- } else {
- $callsigns[$identifier] = $identifier;
- }
+ continue;
+ }
+
+ $repository_type = PhabricatorRepositoryRepositoryPHIDType::TYPECONST;
+ if (phid_get_type($identifier) === $repository_type) {
+ $phids[$identifier] = $identifier;
+ continue;
}
+
+ if (preg_match('/^[A-Z]+\z/', $identifier)) {
+ $callsigns[$identifier] = $identifier;
+ continue;
+ }
+
+ $slugs[$identifier] = $identifier;
}
$this->numericIdentifiers = $ids;
$this->callsignIdentifiers = $callsigns;
$this->phidIdentifiers = $phids;
$this->monogramIdentifiers = $monograms;
+ $this->slugIdentifiers = $slugs;
return $this;
}
@@ -305,6 +318,26 @@
}
}
+ if ($this->slugIdentifiers) {
+ $slug_map = array();
+ foreach ($repositories as $repository) {
+ $slug = $repository->getRepositorySlug();
+ if ($slug === null) {
+ continue;
+ }
+
+ $normal = phutil_utf8_strtolower($slug);
+ $slug_map[$normal] = $repository;
+ }
+
+ foreach ($this->slugIdentifiers as $slug) {
+ $normal = phutil_utf8_strtolower($slug);
+ if (isset($slug_map[$normal])) {
+ $this->identifierMap[$slug] = $slug_map[$normal];
+ }
+ }
+ }
+
return $repositories;
}
@@ -480,7 +513,8 @@
if ($this->numericIdentifiers ||
$this->callsignIdentifiers ||
$this->phidIdentifiers ||
- $this->monogramIdentifiers) {
+ $this->monogramIdentifiers ||
+ $this->slugIdentifiers) {
$identifier_clause = array();
if ($this->numericIdentifiers) {
@@ -531,6 +565,13 @@
}
}
+ if ($this->slugIdentifiers) {
+ $identifier_clause[] = qsprintf(
+ $conn,
+ 'r.repositorySlug IN (%Ls)',
+ $this->slugIdentifiers);
+ }
+
$where = array('('.implode(' OR ', $identifier_clause).')');
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 1:33 AM (6 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7603792
Default Alt Text
D14988.id36221.diff (3 KB)
Attached To
Mode
D14988: Allow repository short names to be used as identifiers
Attached
Detach File
Event Timeline
Log In to Comment