Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14036563
D15305.id36924.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D15305.id36924.diff
View Options
diff --git a/resources/sql/autopatches/20160218.callsigns.1.sql b/resources/sql/autopatches/20160218.callsigns.1.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20160218.callsigns.1.sql
@@ -0,0 +1,4 @@
+/* Make callsigns nullable, and thus optional. */
+
+ALTER TABLE {$NAMESPACE}_repository.repository
+ CHANGE callsign callsign VARCHAR(32) COLLATE {$COLLATE_SORT};
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
@@ -149,14 +149,6 @@
// If we're creating a new repository, set all this core stuff.
if ($is_create) {
- $callsign = $form->getPage('name')
- ->getControl('callsign')->getValue();
-
- // We must set this to a unique value to save the repository
- // initially, and it's immutable, so we don't bother using
- // transactions to apply this change.
- $repository->setCallsign($callsign);
-
$xactions[] = id(clone $template)
->setTransactionType($type_name)
->setNewValue(
@@ -343,7 +335,7 @@
}
-/* -( Page: Name and Callsign )-------------------------------------------- */
+/* -( Page: Name )--------------------------------------------------------- */
private function buildNamePage() {
@@ -359,23 +351,7 @@
->addControl(
id(new AphrontFormTextControl())
->setName('name')
- ->setLabel(pht('Name'))
- ->setCaption(pht('Human-readable repository name.')))
- ->addRemarkupInstructions(
- pht(
- '**Choose a "Callsign" for the repository.** This is a short, '.
- 'unique string which identifies commits elsewhere in Phabricator. '.
- 'For example, you might use `M` for your mobile app repository '.
- 'and `B` for your backend repository.'.
- "\n\n".
- '**Callsigns must be UPPERCASE**, and can not be edited after the '.
- 'repository is created. Generally, you should choose short '.
- 'callsigns.'))
- ->addControl(
- id(new AphrontFormTextControl())
- ->setName('callsign')
- ->setLabel(pht('Callsign'))
- ->setCaption(pht('Short UPPERCASE identifier.')));
+ ->setLabel(pht('Name')));
}
public function validateNamePage(PHUIFormPageView $page) {
@@ -387,38 +363,7 @@
pht('You must choose a name for this repository.'));
}
- $c_call = $page->getControl('callsign');
- $v_call = $c_call->getValue();
- if (!strlen($v_call)) {
- $c_call->setError(pht('Required'));
- $page->addPageError(
- pht('You must choose a callsign for this repository.'));
- } else if (!preg_match('/^[A-Z]+\z/', $v_call)) {
- $c_call->setError(pht('Invalid'));
- $page->addPageError(
- pht('The callsign must contain only UPPERCASE letters.'));
- } else {
- $exists = false;
- try {
- $repo = id(new PhabricatorRepositoryQuery())
- ->setViewer($this->getRequest()->getUser())
- ->withCallsigns(array($v_call))
- ->executeOne();
- $exists = (bool)$repo;
- } catch (PhabricatorPolicyException $ex) {
- $exists = true;
- }
- if ($exists) {
- $c_call->setError(pht('Not Unique'));
- $page->addPageError(
- pht(
- 'Another repository already uses that callsign. You must choose '.
- 'a unique callsign.'));
- }
- }
-
- return $c_name->isValid() &&
- $c_call->isValid();
+ return $c_name->isValid();
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
@@ -284,7 +284,12 @@
$repository->getVersionControlSystem());
$view->addProperty(pht('Type'), $type);
- $view->addProperty(pht('Callsign'), $repository->getCallsign());
+
+ $callsign = $repository->getCallsign();
+ if (!strlen($callsign)) {
+ $callsign = phutil_tag('em', array(), pht('No Callsign'));
+ }
+ $view->addProperty(pht('Callsign'), $callsign);
$short_name = $repository->getRepositorySlug();
if ($short_name === null) {
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -93,7 +93,7 @@
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'sort255',
- 'callsign' => 'sort32',
+ 'callsign' => 'sort32?',
'repositorySlug' => 'sort64?',
'versionControlSystem' => 'text32',
'uuid' => 'text64?',
@@ -149,13 +149,21 @@
}
public function getMonogram() {
- return 'r'.$this->getCallsign();
+ $callsign = $this->getCallsign();
+ if (strlen($callsign)) {
+ return "r{$callsign}";
+ }
+
+ $id = $this->getID();
+ return "R{$id}";
}
public function getDisplayName() {
- // TODO: This is intended to produce a human-readable name that is not
- // necessarily a global, unique identifier. Eventually, it may just return
- // a string like "skynet" instead of "rSKYNET".
+ $slug = $this->getRepositorySlug();
+ if (strlen($slug)) {
+ return $slug;
+ }
+
return $this->getMonogram();
}
@@ -699,7 +707,13 @@
}
public function getURI() {
- return '/diffusion/'.$this->getCallsign().'/';
+ $callsign = $this->getCallsign();
+ if (strlen($callsign)) {
+ return "/diffusion/{$callsign}/";
+ }
+
+ $id = $this->getID();
+ return "/diffusion/{$id}/";
}
public function getPathURI($path) {
@@ -708,7 +722,12 @@
public function getCommitURI($identifier) {
$callsign = $this->getCallsign();
- return "/r{$callsign}{$identifier}";
+ if (strlen($callsign)) {
+ return "/r{$callsign}{$identifier}";
+ }
+
+ $id = $this->getID();
+ return "/R{$id}:{$identifier}";
}
public static function parseRepositoryServicePath($request_path) {
@@ -1063,7 +1082,13 @@
}
if ($need_scope) {
- $scope = 'r'.$this->getCallsign();
+ $callsign = $this->getCallsign();
+ if ($callsign) {
+ $scope = "r{$callsign}";
+ } else {
+ $id = $this->getID();
+ $scope = "R{$id}:";
+ }
$name = $scope.$name;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 11, 10:48 AM (6 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6762510
Default Alt Text
D15305.id36924.diff (6 KB)
Attached To
Mode
D15305: Make repository callsigns optional
Attached
Detach File
Event Timeline
Log In to Comment