Merge lp:~rockstar/launchpad/code-import-cvs-oops into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/code-import-cvs-oops
Merge into: lp:launchpad
Diff against target: 114 lines
2 files modified
lib/lp/code/interfaces/codeimport.py (+2/-0)
lib/lp/code/stories/codeimport/xx-create-codeimport.txt (+37/-8)
To merge this branch: bzr merge lp:~rockstar/launchpad/code-import-cvs-oops
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+13589@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi Henninge-

  This branch fixes bug #306290 - The CVS root validator uses the CVSRoot class
from cscvs. It takes a CVS root string and parses it into a class using a
regex. It's regex is built to be more permissable than the code import system
wants. Basically, we only want to import using the pserver. I added a test to
verify that it finds the right properties, and to raise a
LaunchpadValidationError when the pserver is left off.

  To test, run bin/test -vvt stories/codeimport/xx-create-codeimport.txt

  While I was there, I also converted the test the ReST.

 reviewer henninge

Cheers,
Paul

Revision history for this message
Henning Eggers (henninge) wrote :

Thank you for this nice fix and for updating the test to ReST.

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/interfaces/codeimport.py'
--- lib/lp/code/interfaces/codeimport.py 2009-07-17 00:26:05 +0000
+++ lib/lp/code/interfaces/codeimport.py 2009-10-19 17:40:27 +0000
@@ -31,6 +31,8 @@
31 raise LaunchpadValidationError(e)31 raise LaunchpadValidationError(e)
32 if root.method == 'local':32 if root.method == 'local':
33 raise LaunchpadValidationError('Local CVS roots are not allowed.')33 raise LaunchpadValidationError('Local CVS roots are not allowed.')
34 if not root.hostname:
35 raise LaunchpadValidationError('CVS root is invalid.')
34 if root.hostname.count('.') == 0:36 if root.hostname.count('.') == 0:
35 raise LaunchpadValidationError(37 raise LaunchpadValidationError(
36 'Please use a fully qualified host name.')38 'Please use a fully qualified host name.')
3739
=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-09-18 15:24:30 +0000
+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-10-19 17:40:27 +0000
@@ -1,4 +1,5 @@
1= Creating a code import =1Creating a code import
2======================
23
3Users are able to specifically request a code import of their4Users are able to specifically request a code import of their
4project's code. The main link to this is a large button on5project's code. The main link to this is a large button on
@@ -24,7 +25,8 @@
24 >>> browser.getLink(id="new-code-import").click()25 >>> browser.getLink(id="new-code-import").click()
2526
2627
27== Requesting a Subversion import ==28Requesting a Subversion import
29==============================
2830
29The default foreign VCS type is Subversion.31The default foreign VCS type is Subversion.
3032
@@ -53,7 +55,8 @@
53 url='http://svn.example.com/firefox/trunk'>55 url='http://svn.example.com/firefox/trunk'>
5456
5557
56== Requesting a Git import ==58Requesting a Git import
59=======================
5760
58The default foreign VCS type is Subversion.61The default foreign VCS type is Subversion.
5962
@@ -82,7 +85,8 @@
82 The next import is scheduled to run as soon as possible.85 The next import is scheduled to run as soon as possible.
8386
8487
85== Requesting a CVS import ==88Requesting a CVS import
89=======================
8690
87The user is required to enter both the CVS root and module in order91The user is required to enter both the CVS root and module in order
88to identify the CVS branch. A project and branch name are also required.92to identify the CVS branch. A project and branch name are also required.
@@ -102,7 +106,29 @@
102 :pserver:anonymous@cvs.example.com:/mozilla/cvs.106 :pserver:anonymous@cvs.example.com:/mozilla/cvs.
103107
104108
105== Requesting an import that is already being imported ==109Requesting a CVS import with invalid information
110================================================
111
112If the :pserver is left off the beginning, the CVSROOT is invalid for our
113purposes.
114
115 >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
116 >>> browser.getControl('Project').value = "firefox"
117 >>> browser.getControl('Branch Name').value = "import2"
118 >>> browser.getControl('CVS').click()
119 >>> browser.getControl('Repository').value = (
120 ... ":anonymous@cvs.example.com:/mozilla/cvs")
121 >>> browser.getControl('Module').value = "firefox"
122 >>> browser.getControl('Request Import').click()
123
124 >>> for message in get_feedback_messages(browser.contents):
125 ... print extract_text(message)
126 There is 1 error.
127 CVS root is invalid.
128
129
130Requesting an import that is already being imported
131===================================================
106132
107If a user requests an import that is already being imported, then133If a user requests an import that is already being imported, then
108the validation message points the user to the existing branch.134the validation message points the user to the existing branch.
@@ -137,7 +163,8 @@
137 the imported branch ~vcs-imports/firefox/imported.163 the imported branch ~vcs-imports/firefox/imported.
138164
139165
140== Reqeusting an import whose name would clash ==166Requesting an import whose name would clash
167===========================================
141168
142Instead of Launchpad trying to come up with names for the imported169Instead of Launchpad trying to come up with names for the imported
143branches, the user is asked to enter one when requesting the import.170branches, the user is asked to enter one when requesting the import.
@@ -156,7 +183,8 @@
156 There is already an existing import for firefox with the name of imported.183 There is already an existing import for firefox with the name of imported.
157184
158185
159== Requesting an import on a project where the user doesn't have permission ==186Requesting an import on a project where the user doesn't have permission
187========================================================================
160188
161If there are privacy policies that disallow the user from creating branches189If there are privacy policies that disallow the user from creating branches
162then an error is shown to the user.190then an error is shown to the user.
@@ -173,7 +201,8 @@
173 You are not allowed to register imports for Launchpad.201 You are not allowed to register imports for Launchpad.
174202
175203
176== Requesting an import for a product that does not exist ==204Requesting an import for a product that does not exist
205======================================================
177206
178If there are privacy policies that disallow the user from creating branches207If there are privacy policies that disallow the user from creating branches
179then an error is shown to the user.208then an error is shown to the user.