Merge lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag into lp:launchpad

Proposed by Colin Watson on 2018-08-17
Status: Merged
Merged at revision: 18753
Proposed branch: lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag
Merge into: lp:launchpad
Diff against target: 289 lines (+27/-83)
8 files modified
lib/lp/code/errors.py (+0/-10)
lib/lp/code/interfaces/codeimport.py (+1/-5)
lib/lp/code/model/hasbranches.py (+2/-10)
lib/lp/code/stories/codeimport/xx-create-codeimport.txt (+11/-16)
lib/lp/code/stories/webservice/xx-code-import.txt (+10/-24)
lib/lp/code/templates/codeimport-new.pt (+1/-2)
lib/lp/code/templates/configure-code.pt (+1/-2)
lib/lp/registry/browser/tests/test_product.py (+1/-14)
To merge this branch: bzr merge lp:~cjwatson/launchpad/remove-code-import-git-target-feature-flag
Reviewer Review Type Date Requested Status
William Grant code 2018-08-17 Approve on 2018-08-19
Review via email: mp+353323@code.launchpad.net

Commit message

Remove code.import.git_target feature flag.

Description of the change

It's been enabled everywhere relevant for a year and a half now.

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/errors.py'
2--- lib/lp/code/errors.py 2018-07-13 09:17:40 +0000
3+++ lib/lp/code/errors.py 2018-08-17 12:03:36 +0000
4@@ -31,7 +31,6 @@
5 'CodeImportAlreadyRunning',
6 'CodeImportInvalidTargetType',
7 'CodeImportNotInReviewedState',
8- 'CodeImportGitTargetFeatureDisabled',
9 'ClaimReviewFailed',
10 'DiffNotFound',
11 'GitDefaultConflict',
12@@ -558,15 +557,6 @@
13 (target.__class__.__name__, target_rcs_type))
14
15
16-@error_status(httplib.UNAUTHORIZED)
17-class CodeImportGitTargetFeatureDisabled(Exception):
18- """Only certain users can create new Git-targeted code imports."""
19-
20- def __init__(self):
21- super(CodeImportGitTargetFeatureDisabled, self).__init__(
22- "You do not have permission to create Git-targeted code imports.")
23-
24-
25 @error_status(httplib.BAD_REQUEST)
26 class TooNewRecipeFormat(Exception):
27 """The format of the recipe supplied was too new."""
28
29=== modified file 'lib/lp/code/interfaces/codeimport.py'
30--- lib/lp/code/interfaces/codeimport.py 2016-11-12 02:24:09 +0000
31+++ lib/lp/code/interfaces/codeimport.py 2018-08-17 12:03:36 +0000
32@@ -1,4 +1,4 @@
33-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
34+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
35 # GNU Affero General Public License version 3 (see the file LICENSE).
36
37 """Code import interfaces."""
38@@ -6,7 +6,6 @@
39 __metaclass__ = type
40
41 __all__ = [
42- 'CODE_IMPORT_GIT_TARGET_FEATURE_FLAG',
43 'ICodeImport',
44 'ICodeImportSet',
45 ]
46@@ -52,9 +51,6 @@
47 )
48
49
50-CODE_IMPORT_GIT_TARGET_FEATURE_FLAG = u'code.import.git_target'
51-
52-
53 def validate_cvs_root(cvsroot):
54 try:
55 root = CVSRoot(cvsroot)
56
57=== modified file 'lib/lp/code/model/hasbranches.py'
58--- lib/lp/code/model/hasbranches.py 2016-10-13 15:52:36 +0000
59+++ lib/lp/code/model/hasbranches.py 2018-08-17 12:03:36 +0000
60@@ -1,4 +1,4 @@
61-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
62+# Copyright 2009-2018 Canonical Ltd. This software is licensed under the
63 # GNU Affero General Public License version 3 (see the file LICENSE).
64
65 """Mixin classes to implement methods for IHas<code related bits>."""
66@@ -20,23 +20,18 @@
67 BranchMergeProposalStatus,
68 TargetRevisionControlSystems,
69 )
70-from lp.code.errors import CodeImportGitTargetFeatureDisabled
71 from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING
72 from lp.code.interfaces.branchcollection import (
73 IAllBranches,
74 IBranchCollection,
75 )
76-from lp.code.interfaces.codeimport import (
77- CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
78- ICodeImportSet,
79- )
80+from lp.code.interfaces.codeimport import ICodeImportSet
81 from lp.code.interfaces.gitcollection import (
82 IAllGitRepositories,
83 IGitCollection,
84 )
85 from lp.registry.interfaces.sourcepackage import ISourcePackage
86 from lp.services.database.decoratedresultset import DecoratedResultSet
87-from lp.services.features import getFeatureFlag
88
89
90 class HasBranchesMixin:
91@@ -139,9 +134,6 @@
92 """See `IHasCodeImports`."""
93 if target_rcs_type is None:
94 target_rcs_type = TargetRevisionControlSystems.BZR
95- if (target_rcs_type == TargetRevisionControlSystems.GIT and
96- not getFeatureFlag(CODE_IMPORT_GIT_TARGET_FEATURE_FLAG)):
97- raise CodeImportGitTargetFeatureDisabled
98 return getUtility(ICodeImportSet).new(
99 registrant, self, branch_name, rcs_type, target_rcs_type,
100 url=url, cvs_root=cvs_root, cvs_module=cvs_module, owner=owner)
101
102=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
103--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2018-05-13 10:35:52 +0000
104+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2018-08-17 12:03:36 +0000
105@@ -117,7 +117,7 @@
106 >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
107 >>> browser.getControl('Project').value = "firefox"
108 >>> browser.getControl('Name').value = "lp-git-import"
109- >>> browser.getControl('Git').click()
110+ >>> browser.getControl('Git', index=0).click()
111 >>> browser.getControl('Repo URL', index=0).value = (
112 ... "git://git.launchpad.net/firefox.git")
113 >>> browser.getControl('Request Import').click()
114@@ -189,7 +189,7 @@
115 >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
116 >>> browser.getControl('Project').value = "firefox"
117 >>> browser.getControl('Name').value = "git-import"
118- >>> browser.getControl('Git').click()
119+ >>> browser.getControl('Git', index=0).click()
120 >>> browser.getControl('Repo URL', index=0).value = (
121 ... "git://example.com/firefox.git")
122 >>> browser.getControl('Request Import').click()
123@@ -210,22 +210,17 @@
124 a name for the import repository, and a Git repository location. The URL is
125 allowed to match that of an existing Bazaar-targeted import.
126
127- >>> from lp.code.interfaces.codeimport import (
128- ... CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
129- ... )
130 >>> from lp.code.tests.helpers import GitHostingFixture
131- >>> from lp.services.features.testing import FeatureFixture
132
133- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
134- ... browser.open("http://code.launchpad.dev/+code-imports/+new")
135- ... browser.getControl('Project').value = "firefox"
136- ... browser.getControl('Name').value = "upstream"
137- ... browser.getControl('Git', index=0).click()
138- ... browser.getControl('Git', index=1).click()
139- ... browser.getControl('Repo URL', index=0).value = (
140- ... "git://example.com/firefox.git")
141- ... with GitHostingFixture():
142- ... browser.getControl('Request Import').click()
143+ >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
144+ >>> browser.getControl('Project').value = "firefox"
145+ >>> browser.getControl('Name').value = "upstream"
146+ >>> browser.getControl('Git', index=0).click()
147+ >>> browser.getControl('Git', index=1).click()
148+ >>> browser.getControl('Repo URL', index=0).value = (
149+ ... "git://example.com/firefox.git")
150+ >>> with GitHostingFixture():
151+ ... browser.getControl('Request Import').click()
152
153 When the user clicks continue, the approved import repository is created.
154
155
156=== modified file 'lib/lp/code/stories/webservice/xx-code-import.txt'
157--- lib/lp/code/stories/webservice/xx-code-import.txt 2018-05-13 10:35:52 +0000
158+++ lib/lp/code/stories/webservice/xx-code-import.txt 2018-08-17 12:03:36 +0000
159@@ -189,27 +189,14 @@
160 >>> print(representation['date_last_successful'])
161 None
162
163-We can create a Git-to-Git import, provided that we have the feature flag.
164-
165- >>> from lp.code.interfaces.codeimport import (
166- ... CODE_IMPORT_GIT_TARGET_FEATURE_FLAG,
167- ... )
168- >>> from lp.services.features.testing import FeatureFixture
169+We can create a Git-to-Git import.
170
171 >>> product_url = '/' + product_name
172 >>> new_remote_url = factory.getUniqueURL()
173- >>> response = import_webservice.named_post(
174- ... product_url, 'newCodeImport', branch_name='new-import',
175- ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
176- >>> print(response.status)
177- 401
178- >>> print(response.body)
179- You do not have permission to create Git-targeted code imports.
180- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
181- ... with GitHostingFixture():
182- ... response = import_webservice.named_post(
183- ... product_url, 'newCodeImport', branch_name='new-import',
184- ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
185+ >>> with GitHostingFixture():
186+ ... response = import_webservice.named_post(
187+ ... product_url, 'newCodeImport', branch_name='new-import',
188+ ... rcs_type='Git', target_rcs_type='Git', url=new_remote_url)
189 >>> print(response.status)
190 201
191 >>> location = response.getHeader('Location')
192@@ -272,12 +259,11 @@
193 >>> distro_source_package_url = (
194 ... '/' + distribution.name + '/+source/' + source_package.name)
195 >>> new_remote_url = factory.getUniqueURL()
196- >>> with FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}):
197- ... with GitHostingFixture():
198- ... response = import_webservice.named_post(
199- ... distro_source_package_url, 'newCodeImport',
200- ... branch_name='new-import', rcs_type='Git',
201- ... target_rcs_type='Git', url=new_remote_url)
202+ >>> with GitHostingFixture():
203+ ... response = import_webservice.named_post(
204+ ... distro_source_package_url, 'newCodeImport',
205+ ... branch_name='new-import', rcs_type='Git',
206+ ... target_rcs_type='Git', url=new_remote_url)
207 >>> print(response.status)
208 201
209 >>> location = response.getHeader('Location')
210
211=== modified file 'lib/lp/code/templates/codeimport-new.pt'
212--- lib/lp/code/templates/codeimport-new.pt 2016-10-14 17:25:51 +0000
213+++ lib/lp/code/templates/codeimport-new.pt 2018-08-17 12:03:36 +0000
214@@ -74,8 +74,7 @@
215 <tal:widget define="widget nocall:view/widgets/git_repo_url">
216 <metal:block use-macro="context/@@launchpad_form/widget_row" />
217 </tal:widget>
218- <tal:widget define="widget nocall:view/widgets/git_target_rcs_type"
219- condition="request/features/code.import.git_target">
220+ <tal:widget define="widget nocall:view/widgets/git_target_rcs_type">
221 <metal:block use-macro="context/@@launchpad_form/widget_row" />
222 </tal:widget>
223 </table>
224
225=== modified file 'lib/lp/code/templates/configure-code.pt'
226--- lib/lp/code/templates/configure-code.pt 2016-10-15 14:05:27 +0000
227+++ lib/lp/code/templates/configure-code.pt 2018-08-17 12:03:36 +0000
228@@ -153,8 +153,7 @@
229 </td>
230 </tr>
231
232- <tr id="git_mirror"
233- tal:condition="request/features/code.import.git_target">
234+ <tr id="git_mirror">
235 <td>
236 <label tal:replace="structure view/git_repository_type_import">
237 Import a repository hosted somewhere else
238
239=== modified file 'lib/lp/registry/browser/tests/test_product.py'
240--- lib/lp/registry/browser/tests/test_product.py 2018-05-18 20:41:16 +0000
241+++ lib/lp/registry/browser/tests/test_product.py 2018-08-17 12:03:36 +0000
242@@ -1,4 +1,4 @@
243-# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
244+# Copyright 2010-2018 Canonical Ltd. This software is licensed under the
245 # GNU Affero General Public License version 3 (see the file LICENSE).
246
247 """Tests for product views."""
248@@ -31,7 +31,6 @@
249 ServiceUsage,
250 )
251 from lp.code.enums import RevisionControlSystems
252-from lp.code.interfaces.codeimport import CODE_IMPORT_GIT_TARGET_FEATURE_FLAG
253 from lp.code.interfaces.gitrepository import IGitRepositorySet
254 from lp.code.tests.helpers import GitHostingFixture
255 from lp.registry.browser.product import (
256@@ -50,7 +49,6 @@
257 from lp.registry.model.product import Product
258 from lp.services.config import config
259 from lp.services.database.interfaces import IStore
260-from lp.services.features.testing import FeatureFixture
261 from lp.services.webapp.publisher import canonical_url
262 from lp.services.webapp.vhosts import allvhosts
263 from lp.testing import (
264@@ -947,16 +945,7 @@
265 text='Project settings updated.')
266 self.assertThat(browser.contents, HTMLContains(tag))
267
268- def test_import_git_repository_requires_feature_flag(self):
269- project = self.factory.makeProduct()
270- browser = self.getBrowser(project, '+configure-code')
271- self.assertRaises(
272- LookupError, browser.getControl,
273- 'Import a Git repository hosted somewhere else')
274-
275 def test_import_git_repository(self):
276- self.useFixture(
277- FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}))
278 self.useFixture(GitHostingFixture())
279 owner = self.factory.makePerson()
280 project = self.factory.makeProduct(owner=owner)
281@@ -984,8 +973,6 @@
282 self.assertEqual(project.name, repo.name)
283
284 def test_import_git_repository_bad_scheme(self):
285- self.useFixture(
286- FeatureFixture({CODE_IMPORT_GIT_TARGET_FEATURE_FLAG: u'on'}))
287 owner = self.factory.makePerson()
288 project = self.factory.makeProduct(owner=owner)
289 browser = self.getBrowser(project, '+configure-code')