Merge lp:~jelmer/launchpad/no-code-import-approval into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 13821
Proposed branch: lp:~jelmer/launchpad/no-code-import-approval
Merge into: lp:launchpad
Diff against target: 581 lines (+81/-125)
13 files modified
lib/lp/code/doc/codeimport-event.txt (+5/-5)
lib/lp/code/doc/codeimport.txt (+1/-5)
lib/lp/code/model/codeimport.py (+4/-8)
lib/lp/code/model/tests/test_branch.py (+0/-2)
lib/lp/code/model/tests/test_codeimport.py (+12/-40)
lib/lp/code/model/tests/test_codeimportjob.py (+16/-11)
lib/lp/code/stories/codeimport/xx-admin-codeimport.txt (+3/-20)
lib/lp/code/stories/codeimport/xx-create-codeimport.txt (+9/-4)
lib/lp/code/stories/codeimport/xx-edit-codeimport.txt (+3/-1)
lib/lp/code/stories/webservice/xx-code-import.txt (+2/-2)
lib/lp/testing/factory.py (+11/-13)
lib/lp/testing/tests/test_factory.py (+4/-3)
utilities/sourcedeps.cache (+11/-11)
To merge this branch: bzr merge lp:~jelmer/launchpad/no-code-import-approval
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+73187@code.launchpad.net

This proposal supersedes a proposal from 2011-08-28.

Commit message

[r=benji][bug=418932] Remove the requirement for svn and cvs imports to be pre-approved by a Launchpad admin.

Description of the change

Remove the requirement for svn and cvs imports to be pre-approved by a Launchpad admin, fixing bug #418932.

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks fine.

It's unfortunate that the state is named "reviewed" when no one has
actually reviewed the import. Perhaps we could rename that status to
something like "pending" or "awaiting import" and remove the notion of
approval altogether.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/doc/codeimport-event.txt'
--- lib/lp/code/doc/codeimport-event.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/code/doc/codeimport-event.txt 2011-08-30 00:09:34 +0000
@@ -120,7 +120,7 @@
120 >>> print_items(svn_create_event)120 >>> print_items(svn_create_event)
121 CODE_IMPORT <muted>121 CODE_IMPORT <muted>
122 OWNER ...122 OWNER ...
123 REVIEW_STATUS u'NEW'123 REVIEW_STATUS u'REVIEWED'
124 ASSIGNEE None124 ASSIGNEE None
125 UPDATE_INTERVAL None125 UPDATE_INTERVAL None
126 URL u'svn://svn.example.com/trunk'126 URL u'svn://svn.example.com/trunk'
@@ -144,7 +144,7 @@
144 >>> print_items(cvs_create_event)144 >>> print_items(cvs_create_event)
145 CODE_IMPORT <muted>145 CODE_IMPORT <muted>
146 OWNER ...146 OWNER ...
147 REVIEW_STATUS u'NEW'147 REVIEW_STATUS u'REVIEWED'
148 ASSIGNEE None148 ASSIGNEE None
149 UPDATE_INTERVAL None149 UPDATE_INTERVAL None
150 CVS_ROOT u':pserver:anonymous@cvs.example.com:/cvsroot'150 CVS_ROOT u':pserver:anonymous@cvs.example.com:/cvsroot'
@@ -206,7 +206,7 @@
206206
207 >>> from lp.code.enums import CodeImportReviewStatus207 >>> from lp.code.enums import CodeImportReviewStatus
208 >>> removeSecurityProxy(svn_import).review_status = (208 >>> removeSecurityProxy(svn_import).review_status = (
209 ... CodeImportReviewStatus.REVIEWED)209 ... CodeImportReviewStatus.SUSPENDED)
210210
211After applying changes, the newModify method can create an event that211After applying changes, the newModify method can create an event that
212details the changes that have been applied.212details the changes that have been applied.
@@ -234,8 +234,8 @@
234 >>> print_items(modify_event)234 >>> print_items(modify_event)
235 CODE_IMPORT <muted>235 CODE_IMPORT <muted>
236 OWNER ...236 OWNER ...
237 REVIEW_STATUS u'REVIEWED'237 REVIEW_STATUS u'SUSPENDED'
238 OLD_REVIEW_STATUS u'NEW'238 OLD_REVIEW_STATUS u'REVIEWED'
239 ASSIGNEE None239 ASSIGNEE None
240 UPDATE_INTERVAL None240 UPDATE_INTERVAL None
241 URL u'svn://svn.example.com/trunk'241 URL u'svn://svn.example.com/trunk'
242242
=== modified file 'lib/lp/code/doc/codeimport.txt'
--- lib/lp/code/doc/codeimport.txt 2011-06-28 17:13:42 +0000
+++ lib/lp/code/doc/codeimport.txt 2011-08-30 00:09:34 +0000
@@ -243,7 +243,7 @@
243 >>> code_import = factory.makeProductCodeImport(243 >>> code_import = factory.makeProductCodeImport(
244 ... svn_branch_url='http://svn.example.com/project')244 ... svn_branch_url='http://svn.example.com/project')
245 >>> print code_import.review_status.title245 >>> print code_import.review_status.title
246 Pending Review246 Reviewed
247247
248When an import operator updates the code import emails are sent out to248When an import operator updates the code import emails are sent out to
249the branch subscribers and members of VCS Imports that describe the249the branch subscribers and members of VCS Imports that describe the
@@ -275,8 +275,6 @@
275 To: david.allouche@canonical.com, ...275 To: david.allouche@canonical.com, ...
276 Subject: Code import product.../name... status: Reviewed276 Subject: Code import product.../name... status: Reviewed
277 <BLANKLINE>277 <BLANKLINE>
278 The import has been approved and an import will start shortly.
279 <BLANKLINE>
280 ... is now being imported from:278 ... is now being imported from:
281 http://svn.example.com/project/trunk279 http://svn.example.com/project/trunk
282 instead of:280 instead of:
@@ -293,8 +291,6 @@
293 To: import@example.com291 To: import@example.com
294 Subject: Code import product.../name... status: Reviewed292 Subject: Code import product.../name... status: Reviewed
295 <BLANKLINE>293 <BLANKLINE>
296 The import has been approved and an import will start shortly.
297 <BLANKLINE>
298 ... is now being imported from:294 ... is now being imported from:
299 http://svn.example.com/project/trunk295 http://svn.example.com/project/trunk
300 instead of:296 instead of:
301297
=== modified file 'lib/lp/code/model/codeimport.py'
--- lib/lp/code/model/codeimport.py 2011-08-28 07:29:11 +0000
+++ lib/lp/code/model/codeimport.py 2011-08-30 00:09:34 +0000
@@ -198,7 +198,8 @@
198 setattr(self, name, value)198 setattr(self, name, value)
199 if 'review_status' in data:199 if 'review_status' in data:
200 if data['review_status'] == CodeImportReviewStatus.REVIEWED:200 if data['review_status'] == CodeImportReviewStatus.REVIEWED:
201 CodeImportJobWorkflow().newJob(self)201 if self.import_job is None:
202 CodeImportJobWorkflow().newJob(self)
202 else:203 else:
203 self._removeJob()204 self._removeJob()
204 event = event_set.newModify(self, user, token)205 event = event_set.newModify(self, user, token)
@@ -265,13 +266,8 @@
265 "Don't know how to sanity check source details for unknown "266 "Don't know how to sanity check source details for unknown "
266 "rcs_type %s" % rcs_type)267 "rcs_type %s" % rcs_type)
267 if review_status is None:268 if review_status is None:
268 # Auto approve git and hg imports.269 # Auto approve imports.
269 if rcs_type in (270 review_status = CodeImportReviewStatus.REVIEWED
270 RevisionControlSystems.GIT, RevisionControlSystems.HG,
271 RevisionControlSystems.BZR):
272 review_status = CodeImportReviewStatus.REVIEWED
273 else:
274 review_status = CodeImportReviewStatus.NEW
275 if not target.supports_code_imports:271 if not target.supports_code_imports:
276 raise AssertionError("%r doesn't support code imports" % target)272 raise AssertionError("%r doesn't support code imports" % target)
277 if owner is None:273 if owner is None:
278274
=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py 2011-08-25 22:58:14 +0000
+++ lib/lp/code/model/tests/test_branch.py 2011-08-30 00:09:34 +0000
@@ -1510,7 +1510,6 @@
1510 """break_links allows deleting a code import branch."""1510 """break_links allows deleting a code import branch."""
1511 code_import = self.factory.makeCodeImport()1511 code_import = self.factory.makeCodeImport()
1512 code_import_id = code_import.id1512 code_import_id = code_import.id
1513 self.factory.makeCodeImportJob(code_import)
1514 code_import.branch.destroySelf(break_references=True)1513 code_import.branch.destroySelf(break_references=True)
1515 self.assertRaises(1514 self.assertRaises(
1516 SQLObjectNotFound, CodeImport.get, code_import_id)1515 SQLObjectNotFound, CodeImport.get, code_import_id)
@@ -1575,7 +1574,6 @@
1575 """DeleteCodeImport.__call__ must delete the CodeImport."""1574 """DeleteCodeImport.__call__ must delete the CodeImport."""
1576 code_import = self.factory.makeCodeImport()1575 code_import = self.factory.makeCodeImport()
1577 code_import_id = code_import.id1576 code_import_id = code_import.id
1578 self.factory.makeCodeImportJob(code_import)
1579 DeleteCodeImport(code_import)()1577 DeleteCodeImport(code_import)()
1580 self.assertRaises(1578 self.assertRaises(
1581 SQLObjectNotFound, CodeImport.get, code_import_id)1579 SQLObjectNotFound, CodeImport.get, code_import_id)
15821580
=== modified file 'lib/lp/code/model/tests/test_codeimport.py'
--- lib/lp/code/model/tests/test_codeimport.py 2011-08-28 08:36:14 +0000
+++ lib/lp/code/model/tests/test_codeimport.py 2011-08-30 00:09:34 +0000
@@ -56,20 +56,6 @@
5656
57 layer = DatabaseFunctionalLayer57 layer = DatabaseFunctionalLayer
5858
59 def test_new_svn_import(self):
60 """A new subversion code import should have NEW status."""
61 code_import = CodeImportSet().new(
62 registrant=self.factory.makePerson(),
63 target=IBranchTarget(self.factory.makeProduct()),
64 branch_name='imported',
65 rcs_type=RevisionControlSystems.SVN,
66 url=self.factory.getUniqueURL())
67 self.assertEqual(
68 CodeImportReviewStatus.NEW,
69 code_import.review_status)
70 # No job is created for the import.
71 self.assertIs(None, code_import.import_job)
72
73 def test_new_svn_import_svn_scheme(self):59 def test_new_svn_import_svn_scheme(self):
74 """A subversion import can use the svn:// scheme."""60 """A subversion import can use the svn:// scheme."""
75 code_import = CodeImportSet().new(61 code_import = CodeImportSet().new(
@@ -79,10 +65,10 @@
79 rcs_type=RevisionControlSystems.SVN,65 rcs_type=RevisionControlSystems.SVN,
80 url=self.factory.getUniqueURL(scheme="svn"))66 url=self.factory.getUniqueURL(scheme="svn"))
81 self.assertEqual(67 self.assertEqual(
82 CodeImportReviewStatus.NEW,68 CodeImportReviewStatus.REVIEWED,
83 code_import.review_status)69 code_import.review_status)
84 # No job is created for the import.70 # No job is created for the import.
85 self.assertIs(None, code_import.import_job)71 self.assertIsNot(None, code_import.import_job)
8672
87 def test_reviewed_svn_import(self):73 def test_reviewed_svn_import(self):
88 """A specific review status can be set for a new import."""74 """A specific review status can be set for a new import."""
@@ -92,30 +78,15 @@
92 branch_name='imported',78 branch_name='imported',
93 rcs_type=RevisionControlSystems.SVN,79 rcs_type=RevisionControlSystems.SVN,
94 url=self.factory.getUniqueURL(),80 url=self.factory.getUniqueURL(),
95 review_status=CodeImportReviewStatus.REVIEWED)81 review_status=None)
96 self.assertEqual(82 self.assertEqual(
97 CodeImportReviewStatus.REVIEWED,83 CodeImportReviewStatus.REVIEWED,
98 code_import.review_status)84 code_import.review_status)
99 # A job is created for the import.85 # A job is created for the import.
100 self.assertIsNot(None, code_import.import_job)86 self.assertIsNot(None, code_import.import_job)
10187
102 def test_new_cvs_import(self):88 def test_cvs_import_reviewed(self):
103 """A new CVS code import should have NEW status."""89 """A new CVS code import should have REVIEWED status."""
104 code_import = CodeImportSet().new(
105 registrant=self.factory.makePerson(),
106 target=IBranchTarget(self.factory.makeProduct()),
107 branch_name='imported',
108 rcs_type=RevisionControlSystems.CVS,
109 cvs_root=self.factory.getUniqueURL(),
110 cvs_module='module')
111 self.assertEqual(
112 CodeImportReviewStatus.NEW,
113 code_import.review_status)
114 # No job is created for the import.
115 self.assertIs(None, code_import.import_job)
116
117 def test_reviewed_cvs_import(self):
118 """A specific review status can be set for a new import."""
119 code_import = CodeImportSet().new(90 code_import = CodeImportSet().new(
120 registrant=self.factory.makePerson(),91 registrant=self.factory.makePerson(),
121 target=IBranchTarget(self.factory.makeProduct()),92 target=IBranchTarget(self.factory.makeProduct()),
@@ -123,7 +94,7 @@
123 rcs_type=RevisionControlSystems.CVS,94 rcs_type=RevisionControlSystems.CVS,
124 cvs_root=self.factory.getUniqueURL(),95 cvs_root=self.factory.getUniqueURL(),
125 cvs_module='module',96 cvs_module='module',
126 review_status=CodeImportReviewStatus.REVIEWED)97 review_status=None)
127 self.assertEqual(98 self.assertEqual(
128 CodeImportReviewStatus.REVIEWED,99 CodeImportReviewStatus.REVIEWED,
129 code_import.review_status)100 code_import.review_status)
@@ -275,8 +246,7 @@
275 """Ensure deleting CodeImport objects deletes associated jobs."""246 """Ensure deleting CodeImport objects deletes associated jobs."""
276 code_import = self.factory.makeCodeImport()247 code_import = self.factory.makeCodeImport()
277 login_person(getUtility(ILaunchpadCelebrities).vcs_imports.teamowner)248 login_person(getUtility(ILaunchpadCelebrities).vcs_imports.teamowner)
278 code_import_job = self.factory.makeCodeImportJob(code_import)249 job_id = code_import.import_job.id
279 job_id = code_import_job.id
280 CodeImportJobSet().getById(job_id)250 CodeImportJobSet().getById(job_id)
281 job = CodeImportJobSet().getById(job_id)251 job = CodeImportJobSet().getById(job_id)
282 assert job is not None252 assert job is not None
@@ -644,7 +614,8 @@
644 # tryFailingImportAgain only succeeds for imports that are FAILING.614 # tryFailingImportAgain only succeeds for imports that are FAILING.
645 outcomes = {}615 outcomes = {}
646 for status in CodeImportReviewStatus.items:616 for status in CodeImportReviewStatus.items:
647 code_import = self.factory.makeCodeImport()617 code_import = self.factory.makeCodeImport(
618 review_status=CodeImportReviewStatus.NEW)
648 code_import.updateFromData(619 code_import.updateFromData(
649 {'review_status': status}, self.factory.makePerson())620 {'review_status': status}, self.factory.makePerson())
650 try:621 try:
@@ -726,9 +697,10 @@
726 self.assertEqual(requester, e.requesting_user)697 self.assertEqual(requester, e.requesting_user)
727698
728 def test_exception_on_disabled(self):699 def test_exception_on_disabled(self):
729 # get an SVN request, which isn't reviewed by default700 # get an SVN request which is suspended
730 code_import = self.factory.makeCodeImport(701 code_import = self.factory.makeCodeImport(
731 svn_branch_url=self.factory.getUniqueURL())702 svn_branch_url=self.factory.getUniqueURL(),
703 review_status=CodeImportReviewStatus.SUSPENDED)
732 requester = self.factory.makePerson()704 requester = self.factory.makePerson()
733 # which leads to an exception if we try and ask for an import705 # which leads to an exception if we try and ask for an import
734 self.assertRaises(706 self.assertRaises(
735707
=== modified file 'lib/lp/code/model/tests/test_codeimportjob.py'
--- lib/lp/code/model/tests/test_codeimportjob.py 2011-06-29 12:00:39 +0000
+++ lib/lp/code/model/tests/test_codeimportjob.py 2011-08-30 00:09:34 +0000
@@ -115,7 +115,8 @@
115115
116 def makeJob(self, state, date_due_delta, requesting_user=None):116 def makeJob(self, state, date_due_delta, requesting_user=None):
117 """Create a CodeImportJob object from a spec."""117 """Create a CodeImportJob object from a spec."""
118 code_import = self.factory.makeCodeImport()118 code_import = self.factory.makeCodeImport(
119 review_status=CodeImportReviewStatus.NEW)
119 job = self.factory.makeCodeImportJob(code_import)120 job = self.factory.makeCodeImportJob(code_import)
120 if state == CodeImportJobState.RUNNING:121 if state == CodeImportJobState.RUNNING:
121 getUtility(ICodeImportJobWorkflow).startJob(job, self.machine)122 getUtility(ICodeImportJobWorkflow).startJob(job, self.machine)
@@ -387,11 +388,12 @@
387 def test_wrongReviewStatus(self):388 def test_wrongReviewStatus(self):
388 # CodeImportJobWorkflow.newJob fails if the CodeImport review_status389 # CodeImportJobWorkflow.newJob fails if the CodeImport review_status
389 # is different from REVIEWED.390 # is different from REVIEWED.
390 new_import = self.factory.makeCodeImport()391 new_import = self.factory.makeCodeImport(
392 review_status=CodeImportReviewStatus.SUSPENDED)
391 branch_name = new_import.branch.unique_name393 branch_name = new_import.branch.unique_name
392 # Testing newJob failure.394 # Testing newJob failure.
393 self.assertFailure(395 self.assertFailure(
394 "Review status of %s is not REVIEWED: NEW" % (branch_name,),396 "Review status of %s is not REVIEWED: SUSPENDED" % (branch_name,),
395 getUtility(ICodeImportJobWorkflow).newJob, new_import)397 getUtility(ICodeImportJobWorkflow).newJob, new_import)
396398
397 def test_existingJob(self):399 def test_existingJob(self):
@@ -417,14 +419,17 @@
417 # If there is no CodeImportResult for the CodeImport, then the new419 # If there is no CodeImportResult for the CodeImport, then the new
418 # CodeImportJob has date_due set to UTC_NOW.420 # CodeImportJob has date_due set to UTC_NOW.
419 code_import = self.getCodeImportForDateDueTest()421 code_import = self.getCodeImportForDateDueTest()
420 job = getUtility(ICodeImportJobWorkflow).newJob(code_import)422 self.assertSqlAttributeEqualsDate(code_import.import_job, 'date_due',
421 self.assertSqlAttributeEqualsDate(job, 'date_due', UTC_NOW)423 UTC_NOW)
422424
423 def test_dateDueRecentPreviousResult(self):425 def test_dateDueRecentPreviousResult(self):
424 # If there is a CodeImportResult for the CodeImport that is more426 # If there is a CodeImportResult for the CodeImport that is more
425 # recent than the effective_update_interval, then the new427 # recent than the effective_update_interval, then the new
426 # CodeImportJob has date_due set in the future.428 # CodeImportJob has date_due set in the future.
427 code_import = self.getCodeImportForDateDueTest()429 code_import = self.getCodeImportForDateDueTest()
430 # A code import job is automatically started when a reviewed code import
431 # is created. Remove it, so a "clean" one can be created later.
432 removeSecurityProxy(code_import).import_job.destroySelf()
428 # Create a CodeImportResult that started a long time ago. This one433 # Create a CodeImportResult that started a long time ago. This one
429 # must be superseded by the more recent one created below.434 # must be superseded by the more recent one created below.
430 machine = self.factory.makeCodeImportMachine()435 machine = self.factory.makeCodeImportMachine()
@@ -469,8 +474,8 @@
469 date_job_started=datetime(2000, 1, 1, 12, 0, 0, tzinfo=UTC),474 date_job_started=datetime(2000, 1, 1, 12, 0, 0, tzinfo=UTC),
470 date_created=datetime(2000, 1, 1, 12, 5, 0, tzinfo=UTC))475 date_created=datetime(2000, 1, 1, 12, 5, 0, tzinfo=UTC))
471 # When we create the job, its date due must be set to UTC_NOW.476 # When we create the job, its date due must be set to UTC_NOW.
472 job = getUtility(ICodeImportJobWorkflow).newJob(code_import)477 self.assertSqlAttributeEqualsDate(code_import.import_job, 'date_due',
473 self.assertSqlAttributeEqualsDate(job, 'date_due', UTC_NOW)478 UTC_NOW)
474479
475480
476class TestCodeImportJobWorkflowDeletePendingJob(TestCaseWithFactory,481class TestCodeImportJobWorkflowDeletePendingJob(TestCaseWithFactory,
@@ -500,7 +505,8 @@
500 def test_noJob(self):505 def test_noJob(self):
501 # CodeImportJobWorkflow.deletePendingJob fails if the506 # CodeImportJobWorkflow.deletePendingJob fails if the
502 # CodeImport is not associated to a CodeImportJob.507 # CodeImport is not associated to a CodeImportJob.
503 new_import = self.factory.makeCodeImport()508 new_import = self.factory.makeCodeImport(
509 review_status=CodeImportReviewStatus.NEW)
504 branch_name = new_import.branch.unique_name510 branch_name = new_import.branch.unique_name
505 # Testing deletePendingJob failure.511 # Testing deletePendingJob failure.
506 self.assertFailure(512 self.assertFailure(
@@ -578,7 +584,7 @@
578 # CodeImportJobWorkflow.requestJob sets requesting_user and584 # CodeImportJobWorkflow.requestJob sets requesting_user and
579 # date_due if the current date_due is in the future.585 # date_due if the current date_due is in the future.
580 code_import = self.factory.makeCodeImport()586 code_import = self.factory.makeCodeImport()
581 pending_job = self.factory.makeCodeImportJob(code_import)587 pending_job = code_import.import_job
582 person = self.factory.makePerson()588 person = self.factory.makePerson()
583 # Set date_due in the future. ICodeImportJob does not allow setting589 # Set date_due in the future. ICodeImportJob does not allow setting
584 # date_due, so we must use removeSecurityProxy.590 # date_due, so we must use removeSecurityProxy.
@@ -877,8 +883,7 @@
877 unchecked_result_fields.difference_update(['log_file', 'status'])883 unchecked_result_fields.difference_update(['log_file', 'status'])
878884
879 code_import = self.factory.makeCodeImport()885 code_import = self.factory.makeCodeImport()
880 removeSecurityProxy(code_import).review_status = \886 removeSecurityProxy(code_import).import_job.destroySelf()
881 CodeImportReviewStatus.REVIEWED
882 self.assertFinishJobPassesThroughJobField(887 self.assertFinishJobPassesThroughJobField(
883 'code_import', 'code_import', code_import)888 'code_import', 'code_import', code_import)
884 unchecked_result_fields.remove('code_import')889 unchecked_result_fields.remove('code_import')
885890
=== modified file 'lib/lp/code/stories/codeimport/xx-admin-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-admin-codeimport.txt 2010-04-28 02:49:58 +0000
+++ lib/lp/code/stories/codeimport/xx-admin-codeimport.txt 2011-08-30 00:09:34 +0000
@@ -61,9 +61,11 @@
61 ... print extract_text(div)61 ... print extract_text(div)
62 >>> import_browser.open(svn_import_location)62 >>> import_browser.open(svn_import_location)
63 >>> print_import_details(import_browser)63 >>> print_import_details(import_browser)
64 Import Status: Pending Review64 Import Status: Reviewed
65 This branch is an import of the Subversion branch65 This branch is an import of the Subversion branch
66 from svn://svn.example.com/fooix/trunk.66 from svn://svn.example.com/fooix/trunk.
67 The next import is scheduled to run
68 as soon as possible.
67 Edit import source or review import69 Edit import source or review import
6870
6971
@@ -76,7 +78,6 @@
76 >>> import_browser.getLink('Edit import source or review import').click()78 >>> import_browser.getLink('Edit import source or review import').click()
77 >>> print_submit_buttons(import_browser.contents)79 >>> print_submit_buttons(import_browser.contents)
78 Update80 Update
79 Approve
80 Mark Invalid81 Mark Invalid
81 Suspend82 Suspend
82 Mark Failing83 Mark Failing
@@ -190,24 +191,6 @@
190 The code import has been updated.191 The code import has been updated.
191192
192193
193Approving an import
194+++++++++++++++++++
195
196When a code import is approved, a pending job is created for it.
197
198 >>> import_browser.open(svn_import_location + '/+edit-import')
199 >>> import_browser.getControl('Approve').click()
200 >>> print_import_details(import_browser)
201 Import Status: Reviewed
202 ...
203 The next import is scheduled to run as soon as possible.
204 Edit import source or review import
205
206 >>> for message in get_feedback_messages(import_browser.contents):
207 ... print extract_text(message)
208 The code import has been approved.
209
210
211Invalidating an import194Invalidating an import
212++++++++++++++++++++++195++++++++++++++++++++++
213196
214197
=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2010-09-28 19:25:54 +0000
+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2011-08-30 00:09:34 +0000
@@ -72,9 +72,11 @@
72When the user clicks continue, the import branch is created72When the user clicks continue, the import branch is created
7373
74 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))74 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))
75 Import Status: Pending Review75 Import Status: Reviewed
76 This branch is an import of the Subversion branch76 This branch is an import of the Subversion branch
77 from http://svn.example.com/firefox/trunk.77 from http://svn.example.com/firefox/trunk.
78 The next import is scheduled to run
79 as soon as possible.
78 >>> browser.getLink("http://svn.example.com/firefox/trunk")80 >>> browser.getLink("http://svn.example.com/firefox/trunk")
79 <Link text='http://svn.example.com/firefox/trunk'81 <Link text='http://svn.example.com/firefox/trunk'
80 url='http://svn.example.com/firefox/trunk'>82 url='http://svn.example.com/firefox/trunk'>
@@ -98,9 +100,11 @@
98 >>> browser.getControl('Project').value = "firefox"100 >>> browser.getControl('Project').value = "firefox"
99 >>> browser.getControl('Request Import').click()101 >>> browser.getControl('Request Import').click()
100 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))102 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))
101 Import Status: Pending Review103 Import Status: Reviewed
102 This branch is an import of the Subversion branch104 This branch is an import of the Subversion branch
103 from http://user:password@svn.example.com/firefox/trunk.105 from http://user:password@svn.example.com/firefox/trunk.
106 The next import is scheduled to run
107 as soon as possible.
104108
105109
106Requesting a Git import110Requesting a Git import
@@ -165,10 +169,11 @@
165 >>> browser.getControl('Request Import').click()169 >>> browser.getControl('Request Import').click()
166170
167 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))171 >>> print extract_text(find_tag_by_id(browser.contents, "import-details"))
168 Import Status: Pending Review172 Import Status: Reviewed
169 This branch is an import of the CVS module firefox from173 This branch is an import of the CVS module firefox from
170 :pserver:anonymous@cvs.example.com:/mozilla/cvs.174 :pserver:anonymous@cvs.example.com:/mozilla/cvs.
171175 The next import is scheduled to run
176 as soon as possible.
172177
173Requesting a CVS import with invalid information178Requesting a CVS import with invalid information
174================================================179================================================
175180
=== modified file 'lib/lp/code/stories/codeimport/xx-edit-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-edit-codeimport.txt 2010-03-18 15:39:58 +0000
+++ lib/lp/code/stories/codeimport/xx-edit-codeimport.txt 2011-08-30 00:09:34 +0000
@@ -43,9 +43,11 @@
43 ... print extract_text(div)43 ... print extract_text(div)
44 >>> anon_browser.open(svn_import_location)44 >>> anon_browser.open(svn_import_location)
45 >>> print_import_details(anon_browser)45 >>> print_import_details(anon_browser)
46 Import Status: Pending Review46 Import Status: Reviewed
47 This branch is an import of the Subversion branch47 This branch is an import of the Subversion branch
48 from svn://svn.example.com/fooix/trunk.48 from svn://svn.example.com/fooix/trunk.
49 The next import is scheduled to run
50 as soon as possible.
4951
50Because it's an svn:// URL, it doesn't get linkified:52Because it's an svn:// URL, it doesn't get linkified:
5153
5254
=== modified file 'lib/lp/code/stories/webservice/xx-code-import.txt'
--- lib/lp/code/stories/webservice/xx-code-import.txt 2010-04-16 05:03:03 +0000
+++ lib/lp/code/stories/webservice/xx-code-import.txt 2011-08-30 00:09:34 +0000
@@ -55,7 +55,7 @@
55 >>> print representation['branch_link']55 >>> print representation['branch_link']
56 http://.../~import-owner/scruff/import56 http://.../~import-owner/scruff/import
57 >>> print representation['review_status']57 >>> print representation['review_status']
58 Pending Review58 Reviewed
59 >>> print representation['rcs_type']59 >>> print representation['rcs_type']
60 Subversion via CSCVS60 Subversion via CSCVS
61 >>> print representation['url']61 >>> print representation['url']
@@ -105,7 +105,7 @@
105 >>> print representation['branch_link']105 >>> print representation['branch_link']
106 http://.../~import-owner/scruffbuntu/manic/scruff/import106 http://.../~import-owner/scruffbuntu/manic/scruff/import
107 >>> print representation['review_status']107 >>> print representation['review_status']
108 Pending Review108 Reviewed
109 >>> print representation['rcs_type']109 >>> print representation['rcs_type']
110 Subversion via CSCVS110 Subversion via CSCVS
111 >>> print representation['url']111 >>> print representation['url']
112112
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2011-08-29 17:47:36 +0000
+++ lib/lp/testing/factory.py 2011-08-30 00:09:34 +0000
@@ -2153,34 +2153,32 @@
2153 else:2153 else:
2154 assert rcs_type in (RevisionControlSystems.SVN,2154 assert rcs_type in (RevisionControlSystems.SVN,
2155 RevisionControlSystems.BZR_SVN)2155 RevisionControlSystems.BZR_SVN)
2156 code_import = code_import_set.new(2156 return code_import_set.new(
2157 registrant, target, branch_name, rcs_type=rcs_type,2157 registrant, target, branch_name, rcs_type=rcs_type,
2158 url=svn_branch_url)2158 url=svn_branch_url, review_status=review_status)
2159 elif git_repo_url is not None:2159 elif git_repo_url is not None:
2160 assert rcs_type in (None, RevisionControlSystems.GIT)2160 assert rcs_type in (None, RevisionControlSystems.GIT)
2161 code_import = code_import_set.new(2161 return code_import_set.new(
2162 registrant, target, branch_name,2162 registrant, target, branch_name,
2163 rcs_type=RevisionControlSystems.GIT,2163 rcs_type=RevisionControlSystems.GIT,
2164 url=git_repo_url)2164 url=git_repo_url, review_status=review_status)
2165 elif hg_repo_url is not None:2165 elif hg_repo_url is not None:
2166 code_import = code_import_set.new(2166 return code_import_set.new(
2167 registrant, target, branch_name,2167 registrant, target, branch_name,
2168 rcs_type=RevisionControlSystems.HG,2168 rcs_type=RevisionControlSystems.HG,
2169 url=hg_repo_url)2169 url=hg_repo_url, review_status=review_status)
2170 elif bzr_branch_url is not None:2170 elif bzr_branch_url is not None:
2171 code_import = code_import_set.new(2171 return code_import_set.new(
2172 registrant, target, branch_name,2172 registrant, target, branch_name,
2173 rcs_type=RevisionControlSystems.BZR,2173 rcs_type=RevisionControlSystems.BZR,
2174 url=bzr_branch_url)2174 url=bzr_branch_url, review_status=review_status)
2175 else:2175 else:
2176 assert rcs_type in (None, RevisionControlSystems.CVS)2176 assert rcs_type in (None, RevisionControlSystems.CVS)
2177 code_import = code_import_set.new(2177 return code_import_set.new(
2178 registrant, target, branch_name,2178 registrant, target, branch_name,
2179 rcs_type=RevisionControlSystems.CVS,2179 rcs_type=RevisionControlSystems.CVS,
2180 cvs_root=cvs_root, cvs_module=cvs_module)2180 cvs_root=cvs_root, cvs_module=cvs_module,
2181 if review_status:2181 review_status=review_status)
2182 removeSecurityProxy(code_import).review_status = review_status
2183 return code_import
21842182
2185 def makeChangelog(self, spn=None, versions=[]):2183 def makeChangelog(self, spn=None, versions=[]):
2186 """Create and return a LFA of a valid Debian-style changelog."""2184 """Create and return a LFA of a valid Debian-style changelog."""
21872185
=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py 2011-08-26 04:15:38 +0000
+++ lib/lp/testing/tests/test_factory.py 2011-08-30 00:09:34 +0000
@@ -345,15 +345,16 @@
345345
346 # makeCodeImport346 # makeCodeImport
347 def test_makeCodeImportNoStatus(self):347 def test_makeCodeImportNoStatus(self):
348 # If makeCodeImport is not given a review status, it defaults to NEW.348 # If makeCodeImport is not given a review status,
349 # it defaults to REVIEWED.
349 code_import = self.factory.makeCodeImport()350 code_import = self.factory.makeCodeImport()
350 self.assertEqual(351 self.assertEqual(
351 CodeImportReviewStatus.NEW, code_import.review_status)352 CodeImportReviewStatus.REVIEWED, code_import.review_status)
352353
353 def test_makeCodeImportReviewStatus(self):354 def test_makeCodeImportReviewStatus(self):
354 # If makeCodeImport is given a review status, then that is the status355 # If makeCodeImport is given a review status, then that is the status
355 # of the created import.356 # of the created import.
356 status = CodeImportReviewStatus.REVIEWED357 status = CodeImportReviewStatus.SUSPENDED
357 code_import = self.factory.makeCodeImport(review_status=status)358 code_import = self.factory.makeCodeImport(review_status=status)
358 self.assertEqual(status, code_import.review_status)359 self.assertEqual(status, code_import.review_status)
359360
360361
=== modified file 'utilities/sourcedeps.cache'
--- utilities/sourcedeps.cache 2011-08-28 22:55:16 +0000
+++ utilities/sourcedeps.cache 2011-08-30 00:09:34 +0000
@@ -1,4 +1,8 @@
1{1{
2 "bzr-builder": [
3 68,
4 "launchpad@pqm.canonical.com-20101123183213-777lz46xgagn1deg"
5 ],
2 "testresources": [6 "testresources": [
3 16, 7 16,
4 "robertc@robertcollins.net-20050911111209-ee5da49011cf936a"8 "robertc@robertcollins.net-20050911111209-ee5da49011cf936a"
@@ -27,18 +31,14 @@
27 24, 31 24,
28 "launchpad@pqm.canonical.com-20100601182722-wo7h2fh0fvyw3aaq"32 "launchpad@pqm.canonical.com-20100601182722-wo7h2fh0fvyw3aaq"
29 ], 33 ],
34 "lpreview": [
35 23,
36 "launchpad@pqm.canonical.com-20090720061538-euyh68ifavhy0pi8"
37 ],
30 "bzr-git": [38 "bzr-git": [
31 259, 39 259,
32 "launchpad@pqm.canonical.com-20110601140035-gl5merbechngjw5s"40 "launchpad@pqm.canonical.com-20110601140035-gl5merbechngjw5s"
33 ], 41 ],
34 "loggerhead": [
35 455,
36 "danilo@canonical.com-20110817125309-2r1fgcrqt5kr5h43"
37 ],
38 "bzr-builder": [
39 68,
40 "launchpad@pqm.canonical.com-20101123183213-777lz46xgagn1deg"
41 ],
42 "bzr-loom": [42 "bzr-loom": [
43 49, 43 49,
44 "launchpad@pqm.canonical.com-20110601122412-54vo3k8yae9i2zve"44 "launchpad@pqm.canonical.com-20110601122412-54vo3k8yae9i2zve"
@@ -47,9 +47,9 @@
47 4, 47 4,
48 "sinzui-20090526164636-1swugzupwvjgomo4"48 "sinzui-20090526164636-1swugzupwvjgomo4"
49 ], 49 ],
50 "lpreview": [50 "loggerhead": [
51 23, 51 455,
52 "launchpad@pqm.canonical.com-20090720061538-euyh68ifavhy0pi8"52 "danilo@canonical.com-20110817125309-2r1fgcrqt5kr5h43"
53 ], 53 ],
54 "difftacular": [54 "difftacular": [
55 6, 55 6,