launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22817
[Merge] lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag into lp:launchpad.
Commit message:
Remove code.import.git_target feature flag.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-code-import-git-target-feature-flag/+merge/353323
It's been enabled everywhere relevant for a year and a half now.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag into lp:launchpad.
=== modified file 'lib/lp/code/errors.py'
--- lib/lp/code/errors.py 2018-07-13 09:17:40 +0000
+++ lib/lp/code/errors.py 2018-08-17 12:03:36 +0000
@@ -31,7 +31,6 @@
'CodeImportAlreadyRunning',
'CodeImportInvalidTargetType',
'CodeImportNotInReviewedState',
- 'CodeImportGitTargetFeatureDisabled',
'ClaimReviewFailed',
'DiffNotFound',
'GitDefaultConflict',
@@ -558,15 +557,6 @@
(target.__class__.__name__, target_rcs_type))
-@error_status(httplib.UNAUTHORIZED)
-class CodeImportGitTargetFeatureDisabled(Exception):
- """Only certain users can create new Git-targeted code imports."""
-
- def __init__(self):
- super(CodeImportGitTargetFeatureDisabled, self).__init__(
- "You do not have permission to create Git-targeted code imports.")
-
-
@error_status(httplib.BAD_REQUEST)
class TooNewRecipeFormat(Exception):
"""The format of the recipe supplied was too new."""
=== modified file 'lib/lp/code/interfaces/codeimport.py'
--- lib/lp/code/interfaces/codeimport.py 2016-11-12 02:24:09 +0000
+++ lib/lp/code/interfaces/codeimport.py 2018-08-17 12:03:36 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Code import interfaces."""
@@ -6,7 +6,6 @@
__metaclass__ = type
__all__ = [
- 'CODE_IMPORT_GIT_TARGET_FEATURE_FLAG',
'ICodeImport',
'ICodeImportSet',
]
@@ -52,9 +51,6 @@
)
-CODE_IMPORT_GIT_TARGET_FEATURE_FLAG = u'code.import.git_target'
-
-
def validate_cvs_root(cvsroot):
try:
root = CVSRoot(cvsroot)
=== modified file 'lib/lp/code/model/hasbranches.py'
--- lib/lp/code/model/hasbranches.py 2016-10-13 15:52:36 +0000
+++ lib/lp/code/model/hasbranches.py 2018-08-17 12:03:36 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Mixin classes to implement methods for IHas<code related bits>."""
@@ -20,23 +20,18 @@
BranchMergeProposalStatus,
TargetRevisionControlSystems,
)
-from lp.code.errors import CodeImportGitTargetFeatureDisabled
from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING
from lp.code.interfaces.branchcollection import (
IAllBranches,
IBranchCollection,
)
-from lp.code.interfaces.codeimport import (
- CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
- ICodeImportSet,
- )
+from lp.code.interfaces.codeimport import ICodeImportSet
from lp.code.interfaces.gitcollection import (
IAllGitRepositories,
IGitCollection,
)
from lp.registry.interfaces.sourcepackage import ISourcePackage
from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.features import getFeatureFlag
class HasBranchesMixin:
@@ -139,9 +134,6 @@
"""See `IHasCodeImports`."""
if target_rcs_type is None:
target_rcs_type = TargetRevisionControlSystems.BZR
- if (target_rcs_type == TargetRevisionControlSystems.GIT and
- not getFeatureFlag(CODE_IMPORT_GIT_TARGET_FEATURE_FLAG)):
- raise CodeImportGitTargetFeatureDisabled
return getUtility(ICodeImportSet).new(
registrant, self, branch_name, rcs_type, target_rcs_type,
url=url, cvs_root=cvs_root, cvs_module=cvs_module, owner=owner)
=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2018-05-13 10:35:52 +0000
+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2018-08-17 12:03:36 +0000
@@ -117,7 +117,7 @@
>>> browser.open("http://code.launchpad.dev/+code-imports/+new")
>>> browser.getControl('Project').value = "firefox"
>>> browser.getControl('Name').value = "lp-git-import"
- >>> browser.getControl('Git').click()
+ >>> browser.getControl('Git', index=0).click()
>>> browser.getControl('Repo URL', index=0).value = (
... "git://git.launchpad.net/firefox.git")
>>> browser.getControl('Request Import').click()
@@ -189,7 +189,7 @@
>>> browser.open("http://code.launchpad.dev/+code-imports/+new")
>>> browser.getControl('Project').value = "firefox"
>>> browser.getControl('Name').value = "git-import"
- >>> browser.getControl('Git').click()
+ >>> browser.getControl('Git', index=0).click()
>>> browser.getControl('Repo URL', index=0).value = (
... "git://example.com/firefox.git")
>>> browser.getControl('Request Import').click()
@@ -210,22 +210,17 @@
a name for the import repository, and a Git repository location. The URL is
allowed to match that of an existing Bazaar-targeted import.
- >>> from lp.code.interfaces.codeimport import (
- ... CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
- ... )
>>> from lp.code.tests.helpers import GitHostingFixture
- >>> from lp.services.features.testing import FeatureFixture
- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
- ... browser.open("http://code.launchpad.dev/+code-imports/+new")
- ... browser.getControl('Project').value = "firefox"
- ... browser.getControl('Name').value = "upstream"
- ... browser.getControl('Git', index=0).click()
- ... browser.getControl('Git', index=1).click()
- ... browser.getControl('Repo URL', index=0).value = (
- ... "git://example.com/firefox.git")
- ... with GitHostingFixture():
- ... browser.getControl('Request Import').click()
+ >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
+ >>> browser.getControl('Project').value = "firefox"
+ >>> browser.getControl('Name').value = "upstream"
+ >>> browser.getControl('Git', index=0).click()
+ >>> browser.getControl('Git', index=1).click()
+ >>> browser.getControl('Repo URL', index=0).value = (
+ ... "git://example.com/firefox.git")
+ >>> with GitHostingFixture():
+ ... browser.getControl('Request Import').click()
When the user clicks continue, the approved import repository is created.
=== modified file 'lib/lp/code/stories/webservice/xx-code-import.txt'
--- lib/lp/code/stories/webservice/xx-code-import.txt 2018-05-13 10:35:52 +0000
+++ lib/lp/code/stories/webservice/xx-code-import.txt 2018-08-17 12:03:36 +0000
@@ -189,27 +189,14 @@
>>> print(representation['date_last_successful'])
None
-We can create a Git-to-Git import, provided that we have the feature flag.
-
- >>> from lp.code.interfaces.codeimport import (
- ... CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
- ... )
- >>> from lp.services.features.testing import FeatureFixture
+We can create a Git-to-Git import.
>>> product_url = '/' + product_name
>>> new_remote_url = factory.getUniqueURL()
- >>> response = import_webservice.named_post(
- ... product_url, 'newCodeImport', branch_name='new-import',
- ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
- >>> print(response.status)
- 401
- >>> print(response.body)
- You do not have permission to create Git-targeted code imports.
- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
- ... with GitHostingFixture():
- ... response = import_webservice.named_post(
- ... product_url, 'newCodeImport', branch_name='new-import',
- ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
+ >>> with GitHostingFixture():
+ ... response = import_webservice.named_post(
+ ... product_url, 'newCodeImport', branch_name='new-import',
+ ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
>>> print(response.status)
201
>>> location = response.getHeader('Location')
@@ -272,12 +259,11 @@
>>> distro_source_package_url = (
... '/' + distribution.name + '/+source/' + source_package.name)
>>> new_remote_url = factory.getUniqueURL()
- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
- ... with GitHostingFixture():
- ... response = import_webservice.named_post(
- ... distro_source_package_url, 'newCodeImport',
- ... branch_name='new-import', rcs_type='Git',
- ... target_rcs_type='Git', url=new_remote_url)
+ >>> with GitHostingFixture():
+ ... response = import_webservice.named_post(
+ ... distro_source_package_url, 'newCodeImport',
+ ... branch_name='new-import', rcs_type='Git',
+ ... target_rcs_type='Git', url=new_remote_url)
>>> print(response.status)
201
>>> location = response.getHeader('Location')
=== modified file 'lib/lp/code/templates/codeimport-new.pt'
--- lib/lp/code/templates/codeimport-new.pt 2016-10-14 17:25:51 +0000
+++ lib/lp/code/templates/codeimport-new.pt 2018-08-17 12:03:36 +0000
@@ -74,8 +74,7 @@
<tal:widget define="widget nocall:view/widgets/git_repo_url">
<metal:block use-macro="context/@@launchpad_form/widget_row" />
</tal:widget>
- <tal:widget define="widget nocall:view/widgets/git_target_rcs_type"
- condition="request/features/code.import.git_target">
+ <tal:widget define="widget nocall:view/widgets/git_target_rcs_type">
<metal:block use-macro="context/@@launchpad_form/widget_row" />
</tal:widget>
</table>
=== modified file 'lib/lp/code/templates/configure-code.pt'
--- lib/lp/code/templates/configure-code.pt 2016-10-15 14:05:27 +0000
+++ lib/lp/code/templates/configure-code.pt 2018-08-17 12:03:36 +0000
@@ -153,8 +153,7 @@
</td>
</tr>
- <tr id="git_mirror"
- tal:condition="request/features/code.import.git_target">
+ <tr id="git_mirror">
<td>
<label tal:replace="structure view/git_repository_type_import">
Import a repository hosted somewhere else
=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py 2018-05-18 20:41:16 +0000
+++ lib/lp/registry/browser/tests/test_product.py 2018-08-17 12:03:36 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for product views."""
@@ -31,7 +31,6 @@
ServiceUsage,
)
from lp.code.enums import RevisionControlSystems
-from lp.code.interfaces.codeimport import CODE_IMPORT_GIT_TARGET_FEATURE_FLAG
from lp.code.interfaces.gitrepository import IGitRepositorySet
from lp.code.tests.helpers import GitHostingFixture
from lp.registry.browser.product import (
@@ -50,7 +49,6 @@
from lp.registry.model.product import Product
from lp.services.config import config
from lp.services.database.interfaces import IStore
-from lp.services.features.testing import FeatureFixture
from lp.services.webapp.publisher import canonical_url
from lp.services.webapp.vhosts import allvhosts
from lp.testing import (
@@ -947,16 +945,7 @@
text='Project settings updated.')
self.assertThat(browser.contents, HTMLContains(tag))
- def test_import_git_repository_requires_feature_flag(self):
- project = self.factory.makeProduct()
- browser = self.getBrowser(project, '+configure-code')
- self.assertRaises(
- LookupError, browser.getControl,
- 'Import a Git repository hosted somewhere else')
-
def test_import_git_repository(self):
- self.useFixture(
- FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}))
self.useFixture(GitHostingFixture())
owner = self.factory.makePerson()
project = self.factory.makeProduct(owner=owner)
@@ -984,8 +973,6 @@
self.assertEqual(project.name, repo.name)
def test_import_git_repository_bad_scheme(self):
- self.useFixture(
- FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}))
owner = self.factory.makePerson()
project = self.factory.makeProduct(owner=owner)
browser = self.getBrowser(project, '+configure-code')
Follow ups