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
1=== modified file 'lib/lp/code/interfaces/codeimport.py'
2--- lib/lp/code/interfaces/codeimport.py 2009-07-17 00:26:05 +0000
3+++ lib/lp/code/interfaces/codeimport.py 2009-10-19 17:40:27 +0000
4@@ -31,6 +31,8 @@
5 raise LaunchpadValidationError(e)
6 if root.method == 'local':
7 raise LaunchpadValidationError('Local CVS roots are not allowed.')
8+ if not root.hostname:
9+ raise LaunchpadValidationError('CVS root is invalid.')
10 if root.hostname.count('.') == 0:
11 raise LaunchpadValidationError(
12 'Please use a fully qualified host name.')
13
14=== modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt'
15--- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-09-18 15:24:30 +0000
16+++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-10-19 17:40:27 +0000
17@@ -1,4 +1,5 @@
18-= Creating a code import =
19+Creating a code import
20+======================
21
22 Users are able to specifically request a code import of their
23 project's code. The main link to this is a large button on
24@@ -24,7 +25,8 @@
25 >>> browser.getLink(id="new-code-import").click()
26
27
28-== Requesting a Subversion import ==
29+Requesting a Subversion import
30+==============================
31
32 The default foreign VCS type is Subversion.
33
34@@ -53,7 +55,8 @@
35 url='http://svn.example.com/firefox/trunk'>
36
37
38-== Requesting a Git import ==
39+Requesting a Git import
40+=======================
41
42 The default foreign VCS type is Subversion.
43
44@@ -82,7 +85,8 @@
45 The next import is scheduled to run as soon as possible.
46
47
48-== Requesting a CVS import ==
49+Requesting a CVS import
50+=======================
51
52 The user is required to enter both the CVS root and module in order
53 to identify the CVS branch. A project and branch name are also required.
54@@ -102,7 +106,29 @@
55 :pserver:anonymous@cvs.example.com:/mozilla/cvs.
56
57
58-== Requesting an import that is already being imported ==
59+Requesting a CVS import with invalid information
60+================================================
61+
62+If the :pserver is left off the beginning, the CVSROOT is invalid for our
63+purposes.
64+
65+ >>> browser.open("http://code.launchpad.dev/+code-imports/+new")
66+ >>> browser.getControl('Project').value = "firefox"
67+ >>> browser.getControl('Branch Name').value = "import2"
68+ >>> browser.getControl('CVS').click()
69+ >>> browser.getControl('Repository').value = (
70+ ... ":anonymous@cvs.example.com:/mozilla/cvs")
71+ >>> browser.getControl('Module').value = "firefox"
72+ >>> browser.getControl('Request Import').click()
73+
74+ >>> for message in get_feedback_messages(browser.contents):
75+ ... print extract_text(message)
76+ There is 1 error.
77+ CVS root is invalid.
78+
79+
80+Requesting an import that is already being imported
81+===================================================
82
83 If a user requests an import that is already being imported, then
84 the validation message points the user to the existing branch.
85@@ -137,7 +163,8 @@
86 the imported branch ~vcs-imports/firefox/imported.
87
88
89-== Reqeusting an import whose name would clash ==
90+Requesting an import whose name would clash
91+===========================================
92
93 Instead of Launchpad trying to come up with names for the imported
94 branches, the user is asked to enter one when requesting the import.
95@@ -156,7 +183,8 @@
96 There is already an existing import for firefox with the name of imported.
97
98
99-== Requesting an import on a project where the user doesn't have permission ==
100+Requesting an import on a project where the user doesn't have permission
101+========================================================================
102
103 If there are privacy policies that disallow the user from creating branches
104 then an error is shown to the user.
105@@ -173,7 +201,8 @@
106 You are not allowed to register imports for Launchpad.
107
108
109-== Requesting an import for a product that does not exist ==
110+Requesting an import for a product that does not exist
111+======================================================
112
113 If there are privacy policies that disallow the user from creating branches
114 then an error is shown to the user.