diff --git a/resources/sql/autopatches/20160111.repo.01.slugx.sql b/resources/sql/autopatches/20160111.repo.01.slugx.sql new file mode 100644 index 0000000000..41be6517d0 --- /dev/null +++ b/resources/sql/autopatches/20160111.repo.01.slugx.sql @@ -0,0 +1,2 @@ +UPDATE {$NAMESPACE}_repository.repository_transaction + SET transactionType = 'repo:slug' WHERE transactionType = 'repo:clone-name'; diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php index 1e4de51cff..65f7dd0974 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php @@ -17,7 +17,7 @@ final class DiffusionRepositoryEditBasicController $v_name = $repository->getName(); $v_desc = $repository->getDetail('description'); - $v_clone_name = $repository->getRepositorySlug(); + $v_slug = $repository->getRepositorySlug(); $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs( $repository->getPHID(), PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); @@ -30,10 +30,7 @@ final class DiffusionRepositoryEditBasicController $v_name = $request->getStr('name'); $v_desc = $request->getStr('description'); $v_projects = $request->getArr('projectPHIDs'); - - if ($repository->isHosted()) { - $v_clone_name = $request->getStr('cloneName'); - } + $v_slug = $request->getStr('slug'); if (!strlen($v_name)) { $e_name = pht('Required'); @@ -49,7 +46,7 @@ final class DiffusionRepositoryEditBasicController $type_name = PhabricatorRepositoryTransaction::TYPE_NAME; $type_desc = PhabricatorRepositoryTransaction::TYPE_DESCRIPTION; $type_edge = PhabricatorTransactions::TYPE_EDGE; - $type_clone_name = PhabricatorRepositoryTransaction::TYPE_CLONE_NAME; + $type_slug = PhabricatorRepositoryTransaction::TYPE_SLUG; $xactions[] = id(clone $template) ->setTransactionType($type_name) @@ -60,8 +57,8 @@ final class DiffusionRepositoryEditBasicController ->setNewValue($v_desc); $xactions[] = id(clone $template) - ->setTransactionType($type_clone_name) - ->setNewValue($v_clone_name); + ->setTransactionType($type_slug) + ->setNewValue($v_slug); $xactions[] = id(clone $template) ->setTransactionType($type_edge) @@ -85,7 +82,7 @@ final class DiffusionRepositoryEditBasicController } catch (PhabricatorApplicationTransactionValidationException $ex) { $validation_exception = $ex; - $e_slug = $ex->getShortMessage($type_clone_name); + $e_slug = $ex->getShortMessage($type_slug); } } } @@ -102,23 +99,13 @@ final class DiffusionRepositoryEditBasicController ->setName('name') ->setLabel(pht('Name')) ->setValue($v_name) - ->setError($e_name)); - - if ($repository->isHosted()) { - $form - ->appendChild( - id(new AphrontFormTextControl()) - ->setName('cloneName') - ->setLabel(pht('Clone/Checkout As')) - ->setValue($v_clone_name) - ->setError($e_slug) - ->setCaption( - pht( - 'Optional directory name to use when cloning or checking out '. - 'this repository.'))); - } - - $form + ->setError($e_name)) + ->appendChild( + id(new AphrontFormTextControl()) + ->setName('slug') + ->setLabel(pht('Short Name')) + ->setValue($v_slug) + ->setError($e_slug)) ->appendChild( id(new PhabricatorRemarkupControl()) ->setUser($viewer) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php index 4a48f02bf9..886809dedd 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -286,15 +286,12 @@ final class DiffusionRepositoryEditMainController $view->addProperty(pht('Type'), $type); $view->addProperty(pht('Callsign'), $repository->getCallsign()); - $clone_name = $repository->getRepositorySlug(); - - if ($repository->isHosted()) { - $view->addProperty( - pht('Clone/Checkout As'), - $clone_name - ? $clone_name.'/' - : phutil_tag('em', array(), $repository->getCloneName().'/')); + $short_name = $repository->getRepositorySlug(); + if ($short_name === null) { + $short_name = $repository->getCloneName(); + $short_name = phutil_tag('em', array(), $short_name); } + $view->addProperty(pht('Short Name'), $short_name); $view->invokeWillRenderEvent(); diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php index 9e04a5552f..fc397daa1e 100644 --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -39,7 +39,7 @@ final class PhabricatorRepositoryEditor $types[] = PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY; $types[] = PhabricatorRepositoryTransaction::TYPE_CREDENTIAL; $types[] = PhabricatorRepositoryTransaction::TYPE_DANGEROUS; - $types[] = PhabricatorRepositoryTransaction::TYPE_CLONE_NAME; + $types[] = PhabricatorRepositoryTransaction::TYPE_SLUG; $types[] = PhabricatorRepositoryTransaction::TYPE_SERVICE; $types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE; $types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES; @@ -98,7 +98,7 @@ final class PhabricatorRepositoryEditor return $object->getCredentialPHID(); case PhabricatorRepositoryTransaction::TYPE_DANGEROUS: return $object->shouldAllowDangerousChanges(); - case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: + case PhabricatorRepositoryTransaction::TYPE_SLUG: return $object->getRepositorySlug(); case PhabricatorRepositoryTransaction::TYPE_SERVICE: return $object->getAlmanacServicePHID(); @@ -147,7 +147,7 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_STAGING_URI: case PhabricatorRepositoryTransaction::TYPE_AUTOMATION_BLUEPRINTS: return $xaction->getNewValue(); - case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: + case PhabricatorRepositoryTransaction::TYPE_SLUG: $name = $xaction->getNewValue(); if (strlen($name)) { return $name; @@ -220,7 +220,7 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_DANGEROUS: $object->setDetail('allow-dangerous-changes', $xaction->getNewValue()); return; - case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: + case PhabricatorRepositoryTransaction::TYPE_SLUG: $object->setRepositorySlug($xaction->getNewValue()); return; case PhabricatorRepositoryTransaction::TYPE_SERVICE: @@ -331,7 +331,7 @@ final class PhabricatorRepositoryEditor case PhabricatorRepositoryTransaction::TYPE_PUSH_POLICY: case PhabricatorRepositoryTransaction::TYPE_CREDENTIAL: case PhabricatorRepositoryTransaction::TYPE_DANGEROUS: - case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: + case PhabricatorRepositoryTransaction::TYPE_SLUG: case PhabricatorRepositoryTransaction::TYPE_SERVICE: case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES: case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE: @@ -454,7 +454,7 @@ final class PhabricatorRepositoryEditor } break; - case PhabricatorRepositoryTransaction::TYPE_CLONE_NAME: + case PhabricatorRepositoryTransaction::TYPE_SLUG: foreach ($xactions as $xaction) { $old = $xaction->getOldValue(); $new = $xaction->getNewValue(); diff --git a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php index c9077e0236..a10ac0a60b 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php +++ b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php @@ -23,7 +23,7 @@ final class PhabricatorRepositoryTransaction const TYPE_PUSH_POLICY = 'repo:push-policy'; const TYPE_CREDENTIAL = 'repo:credential'; const TYPE_DANGEROUS = 'repo:dangerous'; - const TYPE_CLONE_NAME = 'repo:clone-name'; + const TYPE_SLUG = 'repo:slug'; const TYPE_SERVICE = 'repo:service'; const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source'; const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language'; @@ -369,19 +369,19 @@ final class PhabricatorRepositoryTransaction '%s enabled protection against dangerous changes.', $this->renderHandleLink($author_phid)); } - case self::TYPE_CLONE_NAME: + case self::TYPE_SLUG: if (strlen($old) && !strlen($new)) { return pht( - '%s removed the clone name of this repository.', + '%s removed the short name of this repository.', $this->renderHandleLink($author_phid)); } else if (strlen($new) && !strlen($old)) { return pht( - '%s set the clone name of this repository to "%s".', + '%s set the short name of this repository to "%s".', $this->renderHandleLink($author_phid), $new); } else { return pht( - '%s changed the clone name of this repository from "%s" to "%s".', + '%s changed the short name of this repository from "%s" to "%s".', $this->renderHandleLink($author_phid), $old, $new);