Merge lp:~mwhudson/launchpad/bzr-svn-ui into lp:launchpad/db-devel
- bzr-svn-ui
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Tim Penhey |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~mwhudson/launchpad/bzr-svn-ui |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
512 lines (+163/-46) 12 files modified
lib/lp/code/browser/branch.py (+10/-2) lib/lp/code/browser/codeimport.py (+9/-6) lib/lp/code/browser/tests/test_codeimport.py (+60/-0) lib/lp/code/doc/codeimport.txt (+1/-1) lib/lp/code/enums.py (+1/-1) lib/lp/code/model/tests/test_codeimport.py (+2/-2) lib/lp/code/stories/codeimport/xx-admin-codeimport.txt (+40/-12) lib/lp/code/stories/codeimport/xx-codeimport-list.txt (+16/-11) lib/lp/code/stories/codeimport/xx-codeimport-view.txt (+4/-2) lib/lp/code/stories/codeimport/xx-create-codeimport.txt (+8/-0) lib/lp/code/templates/branch-import-details.pt (+11/-8) lib/lp/code/templates/codeimport-new.pt (+1/-1) |
To merge this branch: | bzr merge lp:~mwhudson/launchpad/bzr-svn-ui |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Penhey (community) | conditional | Approve | |
Review via email: mp+15792@code.launchpad.net |
Commit message
New subversion code imports will be done with bzr-svn.
Description of the change
Michael Hudson-Doyle (mwhudson) wrote : | # |
Tim Penhey (thumper) wrote : | # |
review approve conditional
merge approved
Just some minor tweaks, but on the whole, awesome!
Tim
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -79,7 +79,8 @@
> from lp.code.
> latest_
> from lp.code.enums import (
> - BranchLifecycle
> + BranchLifecycle
> + UICreatableBran
> from lp.code.errors import InvalidBranchMe
> from lp.code.
> BranchCreationF
> @@ -501,6 +502,14 @@
> return list(self.
>
> @property
> + def is_svn_
> + """True if an imported branch is a SVN import."""
> + # You should only be calling this if it's an SVN code import
Well, we should only be calling this if it is an import of any kind.
> + assert self.context.
> + return self.context.
> + (RevisionContro
> +
> + @property
> def svn_url_
> """True if an imported branch's SVN URL is HTTP or HTTPS."""
> # You should only be calling this if it's an SVN code import
> === added file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -0,0 +1,58 @@
> +# Copyright 2009 Canonical Ltd. This software is licensed under the
> +# GNU Affero General Public License version 3 (see the file LICENSE).
> +
> +"""Tests for the code import browser code."""
> +
> +__metaclass__ = type
> +
> +import re
> +import unittest
> +
> +from canonical.
> +from canonical.
> +from canonical.
> +
> +from lp.code.enums import RevisionControl
> +from lp.testing import TestCaseWithFactory
> +
> +
> +class TestImportDetai
> +
> + layer = DatabaseFunctio
> +
> + def assertSvnDetail
> + """Assert the `svn_details` tag described a Subversion import."""
> + self.assertEqua
> + text = re.sub('\s+', ' ', extract_
> + self.assertTrue(
> + text.startswith(
> + 'This branch is an import of the Subversion branch'))
> + self.assertEqua
I'm not sure I'd add this last assert here as we only show the anchor if
the subversion url is http. But the rest looks good.
> + def test_bzr_
> + # The branch page for a bzr-svn-imported branch contains a summary
of
> + # the import details.
> + bzr_svn_import = self.factory.
> + rcs...
Michael Hudson-Doyle (mwhudson) wrote : | # |
Tim Penhey wrote:
> Review: Approve conditional
> review approve conditional
> merge approved
>
> Just some minor tweaks, but on the whole, awesome!
Thanks.
>> === modified file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -79,7 +79,8 @@
>> from lp.code.
>> latest_
>> from lp.code.enums import (
>> - BranchLifecycle
>> + BranchLifecycle
>> + UICreatableBran
>> from lp.code.errors import InvalidBranchMe
>> from lp.code.
>> BranchCreationF
>> @@ -501,6 +502,14 @@
>> return list(self.
>>
>> @property
>> + def is_svn_
>> + """True if an imported branch is a SVN import."""
>> + # You should only be calling this if it's an SVN code import
>
> Well, we should only be calling this if it is an import of any kind.
Uh. Right. Fixed.
>> + assert self.context.
>> + return self.context.
>> + (RevisionContro
>> +
>> + @property
>> def svn_url_
>> """True if an imported branch's SVN URL is HTTP or HTTPS."""
>> # You should only be calling this if it's an SVN code import
>> === added file 'lib/lp/
>> --- lib/lp/
>> +++ lib/lp/
>> @@ -0,0 +1,58 @@
>> +# Copyright 2009 Canonical Ltd. This software is licensed under the
>> +# GNU Affero General Public License version 3 (see the file LICENSE).
>> +
>> +"""Tests for the code import browser code."""
>> +
>> +__metaclass__ = type
>> +
>> +import re
>> +import unittest
>> +
>> +from canonical.
>> +from canonical.
>> +from canonical.
>> +
>> +from lp.code.enums import RevisionControl
>> +from lp.testing import TestCaseWithFactory
>> +
>> +
>> +class TestImportDetai
>> +
>> + layer = DatabaseFunctio
>> +
>> + def assertSvnDetail
>> + """Assert the `svn_details` tag described a Subversion import."""
>> + self.assertEqua
>> + text = re.sub('\s+', ' ', extract_
>> + self.assertTrue(
>> + text.startswith(
>> + 'This branch is an import of the Subversion branch'))
>> + self.assertEqua
>
> I'm not sure I'd add this last assert here as we only show the anchor if
> the subversion url is http. But the rest looks good.
You're right, the tests are more focused without that assert.
>> + def t...
Preview Diff
1 | === modified file 'lib/lp/code/browser/branch.py' | |||
2 | --- lib/lp/code/browser/branch.py 2009-12-07 02:57:22 +0000 | |||
3 | +++ lib/lp/code/browser/branch.py 2009-12-08 19:25:27 +0000 | |||
4 | @@ -79,7 +79,8 @@ | |||
5 | 79 | from lp.code.browser.branchmergeproposal import ( | 79 | from lp.code.browser.branchmergeproposal import ( |
6 | 80 | latest_proposals_for_each_branch) | 80 | latest_proposals_for_each_branch) |
7 | 81 | from lp.code.enums import ( | 81 | from lp.code.enums import ( |
9 | 82 | BranchLifecycleStatus, BranchType, UICreatableBranchType) | 82 | BranchLifecycleStatus, BranchType, RevisionControlSystems, |
10 | 83 | UICreatableBranchType) | ||
11 | 83 | from lp.code.errors import InvalidBranchMergeProposal | 84 | from lp.code.errors import InvalidBranchMergeProposal |
12 | 84 | from lp.code.interfaces.branch import ( | 85 | from lp.code.interfaces.branch import ( |
13 | 85 | BranchCreationForbidden, BranchExists, IBranch, | 86 | BranchCreationForbidden, BranchExists, IBranch, |
14 | @@ -501,6 +502,14 @@ | |||
15 | 501 | return list(self.context.code_import.results[:10]) | 502 | return list(self.context.code_import.results[:10]) |
16 | 502 | 503 | ||
17 | 503 | @property | 504 | @property |
18 | 505 | def is_svn_import(self): | ||
19 | 506 | """True if an imported branch is a SVN import.""" | ||
20 | 507 | # You should only be calling this if it's a code import | ||
21 | 508 | assert self.context.code_import | ||
22 | 509 | return self.context.code_import.rcs_type in \ | ||
23 | 510 | (RevisionControlSystems.SVN, RevisionControlSystems.BZR_SVN) | ||
24 | 511 | |||
25 | 512 | @property | ||
26 | 504 | def svn_url_is_web(self): | 513 | def svn_url_is_web(self): |
27 | 505 | """True if an imported branch's SVN URL is HTTP or HTTPS.""" | 514 | """True if an imported branch's SVN URL is HTTP or HTTPS.""" |
28 | 506 | # You should only be calling this if it's an SVN code import | 515 | # You should only be calling this if it's an SVN code import |
29 | @@ -849,7 +858,6 @@ | |||
30 | 849 | The keys are 'delete' and 'alter'; the values are dicts of | 858 | The keys are 'delete' and 'alter'; the values are dicts of |
31 | 850 | 'item', 'reason' and 'allowed'. | 859 | 'item', 'reason' and 'allowed'. |
32 | 851 | """ | 860 | """ |
33 | 852 | branch = self.context | ||
34 | 853 | row_dict = {'delete': [], 'alter': [], 'break_link': []} | 861 | row_dict = {'delete': [], 'alter': [], 'break_link': []} |
35 | 854 | for item, action, reason, allowed in ( | 862 | for item, action, reason, allowed in ( |
36 | 855 | self.display_deletion_requirements): | 863 | self.display_deletion_requirements): |
37 | 856 | 864 | ||
38 | === modified file 'lib/lp/code/browser/codeimport.py' | |||
39 | --- lib/lp/code/browser/codeimport.py 2009-08-24 20:28:33 +0000 | |||
40 | +++ lib/lp/code/browser/codeimport.py 2009-12-08 19:25:27 +0000 | |||
41 | @@ -227,7 +227,7 @@ | |||
42 | 227 | custom_widget('rcs_type', LaunchpadRadioWidget) | 227 | custom_widget('rcs_type', LaunchpadRadioWidget) |
43 | 228 | 228 | ||
44 | 229 | initial_values = { | 229 | initial_values = { |
46 | 230 | 'rcs_type': RevisionControlSystems.SVN, | 230 | 'rcs_type': RevisionControlSystems.BZR_SVN, |
47 | 231 | 'branch_name': 'trunk', | 231 | 'branch_name': 'trunk', |
48 | 232 | } | 232 | } |
49 | 233 | 233 | ||
50 | @@ -258,7 +258,7 @@ | |||
51 | 258 | fields = soup.findAll('input') | 258 | fields = soup.findAll('input') |
52 | 259 | [cvs_button, svn_button, git_button, empty_marker] = [ | 259 | [cvs_button, svn_button, git_button, empty_marker] = [ |
53 | 260 | field for field in fields | 260 | field for field in fields |
55 | 261 | if field.get('value') in ['CVS', 'SVN', 'GIT', '1']] | 261 | if field.get('value') in ['CVS', 'BZR_SVN', 'GIT', '1']] |
56 | 262 | cvs_button['onclick'] = 'updateWidgets()' | 262 | cvs_button['onclick'] = 'updateWidgets()' |
57 | 263 | svn_button['onclick'] = 'updateWidgets()' | 263 | svn_button['onclick'] = 'updateWidgets()' |
58 | 264 | git_button['onclick'] = 'updateWidgets()' | 264 | git_button['onclick'] = 'updateWidgets()' |
59 | @@ -360,7 +360,7 @@ | |||
60 | 360 | data['svn_branch_url'] = None | 360 | data['svn_branch_url'] = None |
61 | 361 | data['git_repo_url'] = None | 361 | data['git_repo_url'] = None |
62 | 362 | self._validateCVS(data.get('cvs_root'), data.get('cvs_module')) | 362 | self._validateCVS(data.get('cvs_root'), data.get('cvs_module')) |
64 | 363 | elif rcs_type == RevisionControlSystems.SVN: | 363 | elif rcs_type == RevisionControlSystems.BZR_SVN: |
65 | 364 | data['cvs_root'] = None | 364 | data['cvs_root'] = None |
66 | 365 | data['cvs_module'] = None | 365 | data['cvs_module'] = None |
67 | 366 | data['git_repo_url'] = None | 366 | data['git_repo_url'] = None |
68 | @@ -371,7 +371,8 @@ | |||
69 | 371 | data['svn_branch_url'] = None | 371 | data['svn_branch_url'] = None |
70 | 372 | self._validateGit(data.get('git_repo_url')) | 372 | self._validateGit(data.get('git_repo_url')) |
71 | 373 | else: | 373 | else: |
73 | 374 | raise AssertionError('Unknown revision control type.') | 374 | raise AssertionError( |
74 | 375 | 'Unexpected revision control type %r.' % rcs_type) | ||
75 | 375 | 376 | ||
76 | 376 | 377 | ||
77 | 377 | class EditCodeImportForm(Interface): | 378 | class EditCodeImportForm(Interface): |
78 | @@ -458,7 +459,8 @@ | |||
79 | 458 | if self.code_import.rcs_type == RevisionControlSystems.CVS: | 459 | if self.code_import.rcs_type == RevisionControlSystems.CVS: |
80 | 459 | self.form_fields = self.form_fields.omit( | 460 | self.form_fields = self.form_fields.omit( |
81 | 460 | 'svn_branch_url', 'git_repo_url') | 461 | 'svn_branch_url', 'git_repo_url') |
83 | 461 | elif self.code_import.rcs_type == RevisionControlSystems.SVN: | 462 | elif self.code_import.rcs_type in (RevisionControlSystems.SVN, |
84 | 463 | RevisionControlSystems.BZR_SVN): | ||
85 | 462 | self.form_fields = self.form_fields.omit( | 464 | self.form_fields = self.form_fields.omit( |
86 | 463 | 'cvs_root', 'cvs_module', 'git_repo_url') | 465 | 'cvs_root', 'cvs_module', 'git_repo_url') |
87 | 464 | elif self.code_import.rcs_type == RevisionControlSystems.GIT: | 466 | elif self.code_import.rcs_type == RevisionControlSystems.GIT: |
88 | @@ -493,7 +495,8 @@ | |||
89 | 493 | self._validateCVS( | 495 | self._validateCVS( |
90 | 494 | data.get('cvs_root'), data.get('cvs_module'), | 496 | data.get('cvs_root'), data.get('cvs_module'), |
91 | 495 | self.code_import) | 497 | self.code_import) |
93 | 496 | elif self.code_import.rcs_type == RevisionControlSystems.SVN: | 498 | elif self.code_import.rcs_type in (RevisionControlSystems.SVN, |
94 | 499 | RevisionControlSystems.BZR_SVN): | ||
95 | 497 | self._validateSVN( | 500 | self._validateSVN( |
96 | 498 | data.get('svn_branch_url'), self.code_import) | 501 | data.get('svn_branch_url'), self.code_import) |
97 | 499 | elif self.code_import.rcs_type == RevisionControlSystems.GIT: | 502 | elif self.code_import.rcs_type == RevisionControlSystems.GIT: |
98 | 500 | 503 | ||
99 | === added file 'lib/lp/code/browser/tests/test_codeimport.py' | |||
100 | --- lib/lp/code/browser/tests/test_codeimport.py 1970-01-01 00:00:00 +0000 | |||
101 | +++ lib/lp/code/browser/tests/test_codeimport.py 2009-12-08 19:25:27 +0000 | |||
102 | @@ -0,0 +1,60 @@ | |||
103 | 1 | # Copyright 2009 Canonical Ltd. This software is licensed under the | ||
104 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | ||
105 | 3 | |||
106 | 4 | """Tests for the code import browser code.""" | ||
107 | 5 | |||
108 | 6 | __metaclass__ = type | ||
109 | 7 | |||
110 | 8 | import re | ||
111 | 9 | import unittest | ||
112 | 10 | |||
113 | 11 | from canonical.launchpad.testing.pages import extract_text, find_tag_by_id | ||
114 | 12 | from canonical.launchpad.webapp import canonical_url | ||
115 | 13 | from canonical.testing.layers import DatabaseFunctionalLayer | ||
116 | 14 | |||
117 | 15 | from lp.code.enums import RevisionControlSystems | ||
118 | 16 | from lp.testing import TestCaseWithFactory | ||
119 | 17 | |||
120 | 18 | |||
121 | 19 | class TestImportDetails(TestCaseWithFactory): | ||
122 | 20 | |||
123 | 21 | layer = DatabaseFunctionalLayer | ||
124 | 22 | |||
125 | 23 | def assertSvnDetailsDisplayed(self, svn_details, rcs_type): | ||
126 | 24 | """Assert the `svn_details` tag describes a Subversion import. | ||
127 | 25 | |||
128 | 26 | :param svn_details: The BeautifulSoup object for the | ||
129 | 27 | 'svn-import-details' area. | ||
130 | 28 | :param rcs_type: SVN or BZR_SVN from RevisionControlSystems. | ||
131 | 29 | """ | ||
132 | 30 | self.assertEquals(rcs_type.title, svn_details.span['title']) | ||
133 | 31 | text = re.sub('\s+', ' ', extract_text(svn_details)) | ||
134 | 32 | self.assertTrue( | ||
135 | 33 | text.startswith( | ||
136 | 34 | 'This branch is an import of the Subversion branch')) | ||
137 | 35 | |||
138 | 36 | def test_bzr_svn_import(self): | ||
139 | 37 | # The branch page for a bzr-svn-imported branch contains | ||
140 | 38 | # a summary of the import details. | ||
141 | 39 | bzr_svn_import = self.factory.makeCodeImport( | ||
142 | 40 | rcs_type=RevisionControlSystems.BZR_SVN) | ||
143 | 41 | browser = self.getUserBrowser(canonical_url(bzr_svn_import.branch)) | ||
144 | 42 | svn_details = find_tag_by_id(browser.contents, 'svn-import-details') | ||
145 | 43 | self.assertSvnDetailsDisplayed( | ||
146 | 44 | svn_details, RevisionControlSystems.BZR_SVN) | ||
147 | 45 | |||
148 | 46 | def test_cscvs_svn_import(self): | ||
149 | 47 | # The branch page for a cscvs-imported svn branch contains a summary | ||
150 | 48 | # of the import details. | ||
151 | 49 | bzr_svn_import = self.factory.makeCodeImport( | ||
152 | 50 | rcs_type=RevisionControlSystems.SVN) | ||
153 | 51 | browser = self.getUserBrowser(canonical_url(bzr_svn_import.branch)) | ||
154 | 52 | svn_details = find_tag_by_id(browser.contents, 'svn-import-details') | ||
155 | 53 | self.assertSvnDetailsDisplayed( | ||
156 | 54 | svn_details, RevisionControlSystems.SVN) | ||
157 | 55 | |||
158 | 56 | |||
159 | 57 | |||
160 | 58 | def test_suite(): | ||
161 | 59 | return unittest.TestLoader().loadTestsFromName(__name__) | ||
162 | 60 | |||
163 | 0 | 61 | ||
164 | === modified file 'lib/lp/code/doc/codeimport.txt' | |||
165 | --- lib/lp/code/doc/codeimport.txt 2009-12-06 20:28:49 +0000 | |||
166 | +++ lib/lp/code/doc/codeimport.txt 2009-12-08 19:25:27 +0000 | |||
167 | @@ -56,7 +56,7 @@ | |||
168 | 56 | >>> for item in RevisionControlSystems: | 56 | >>> for item in RevisionControlSystems: |
169 | 57 | ... print item.title | 57 | ... print item.title |
170 | 58 | Concurrent Versions System | 58 | Concurrent Versions System |
172 | 59 | Subversion | 59 | Subversion via CSCVS |
173 | 60 | Subversion via bzr-svn | 60 | Subversion via bzr-svn |
174 | 61 | Git | 61 | Git |
175 | 62 | 62 | ||
176 | 63 | 63 | ||
177 | === modified file 'lib/lp/code/enums.py' | |||
178 | --- lib/lp/code/enums.py 2009-07-17 00:26:05 +0000 | |||
179 | +++ lib/lp/code/enums.py 2009-12-08 19:25:27 +0000 | |||
180 | @@ -388,7 +388,7 @@ | |||
181 | 388 | """) | 388 | """) |
182 | 389 | 389 | ||
183 | 390 | SVN = DBItem(2, """ | 390 | SVN = DBItem(2, """ |
185 | 391 | Subversion | 391 | Subversion via CSCVS |
186 | 392 | 392 | ||
187 | 393 | Imports from SVN using CSCVS. | 393 | Imports from SVN using CSCVS. |
188 | 394 | """) | 394 | """) |
189 | 395 | 395 | ||
190 | === modified file 'lib/lp/code/model/tests/test_codeimport.py' | |||
191 | --- lib/lp/code/model/tests/test_codeimport.py 2009-09-01 04:05:11 +0000 | |||
192 | +++ lib/lp/code/model/tests/test_codeimport.py 2009-12-08 19:25:27 +0000 | |||
193 | @@ -534,7 +534,7 @@ | |||
194 | 534 | def make_active_import(factory, project_name=None, product_name=None, | 534 | def make_active_import(factory, project_name=None, product_name=None, |
195 | 535 | branch_name=None, svn_branch_url=None, | 535 | branch_name=None, svn_branch_url=None, |
196 | 536 | cvs_root=None, cvs_module=None, git_repo_url=None, | 536 | cvs_root=None, cvs_module=None, git_repo_url=None, |
198 | 537 | last_update=None): | 537 | last_update=None, rcs_type=None): |
199 | 538 | """Make a new CodeImport for a new Product, maybe in a new Project. | 538 | """Make a new CodeImport for a new Product, maybe in a new Project. |
200 | 539 | 539 | ||
201 | 540 | The import will be 'active' in the sense used by | 540 | The import will be 'active' in the sense used by |
202 | @@ -549,7 +549,7 @@ | |||
203 | 549 | code_import = factory.makeCodeImport( | 549 | code_import = factory.makeCodeImport( |
204 | 550 | product=product, branch_name=branch_name, | 550 | product=product, branch_name=branch_name, |
205 | 551 | svn_branch_url=svn_branch_url, cvs_root=cvs_root, | 551 | svn_branch_url=svn_branch_url, cvs_root=cvs_root, |
207 | 552 | cvs_module=cvs_module, git_repo_url=git_repo_url) | 552 | cvs_module=cvs_module, git_repo_url=git_repo_url, rcs_type=None) |
208 | 553 | make_import_active(factory, code_import, last_update) | 553 | make_import_active(factory, code_import, last_update) |
209 | 554 | return code_import | 554 | return code_import |
210 | 555 | 555 | ||
211 | 556 | 556 | ||
212 | === modified file 'lib/lp/code/stories/codeimport/xx-admin-codeimport.txt' | |||
213 | --- lib/lp/code/stories/codeimport/xx-admin-codeimport.txt 2009-11-13 10:43:32 +0000 | |||
214 | +++ lib/lp/code/stories/codeimport/xx-admin-codeimport.txt 2009-12-08 19:25:27 +0000 | |||
215 | @@ -1,11 +1,13 @@ | |||
217 | 1 | = Administrating code imports = | 1 | Administrating code imports |
218 | 2 | =========================== | ||
219 | 2 | 3 | ||
220 | 3 | The code import details are displayed on the main branch page for | 4 | The code import details are displayed on the main branch page for |
221 | 4 | imported branches. If the logged in user is an import operator | 5 | imported branches. If the logged in user is an import operator |
222 | 5 | (member of VCS imports or Launchpad admin) then they can see a link | 6 | (member of VCS imports or Launchpad admin) then they can see a link |
223 | 6 | to edit the details. | 7 | to edit the details. |
224 | 7 | 8 | ||
226 | 8 | >>> from canonical.launchpad.ftests import ANONYMOUS, login, logout | 9 | >>> from lp.code.enums import RevisionControlSystems |
227 | 10 | >>> from lp.testing import ANONYMOUS, login, logout | ||
228 | 9 | >>> login('test@canonical.com') | 11 | >>> login('test@canonical.com') |
229 | 10 | 12 | ||
230 | 11 | >>> svn_import = factory.makeCodeImport( | 13 | >>> svn_import = factory.makeCodeImport( |
231 | @@ -14,6 +16,12 @@ | |||
232 | 14 | >>> svn_import_location = str(canonical_url(svn_import.branch)) | 16 | >>> svn_import_location = str(canonical_url(svn_import.branch)) |
233 | 15 | >>> svn_import_branch_unique_name = svn_import.branch.unique_name | 17 | >>> svn_import_branch_unique_name = svn_import.branch.unique_name |
234 | 16 | 18 | ||
235 | 19 | >>> bzr_svn_import = factory.makeCodeImport( | ||
236 | 20 | ... svn_branch_url='svn://svn.example.com/bzr-svn/trunk', | ||
237 | 21 | ... rcs_type=RevisionControlSystems.BZR_SVN) | ||
238 | 22 | >>> bzr_svn_import_location = str(canonical_url(bzr_svn_import.branch)) | ||
239 | 23 | >>> bzr_svn_import_branch_unique_name = bzr_svn_import.branch.unique_name | ||
240 | 24 | |||
241 | 17 | >>> cvs_import = factory.makeCodeImport( | 25 | >>> cvs_import = factory.makeCodeImport( |
242 | 18 | ... cvs_root=":pserver:anonymous@cvs.example.com:/fooix", | 26 | ... cvs_root=":pserver:anonymous@cvs.example.com:/fooix", |
243 | 19 | ... cvs_module="fooix") | 27 | ... cvs_module="fooix") |
244 | @@ -30,7 +38,8 @@ | |||
245 | 30 | ... auth='Basic david.allouche@canonical.com:test') | 38 | ... auth='Basic david.allouche@canonical.com:test') |
246 | 31 | 39 | ||
247 | 32 | 40 | ||
249 | 33 | == Editing the import == | 41 | Editing the import |
250 | 42 | ------------------ | ||
251 | 34 | 43 | ||
252 | 35 | Both VCS Imports members and Launchpad administrators can edit the | 44 | Both VCS Imports members and Launchpad administrators can edit the |
253 | 36 | import: | 45 | import: |
254 | @@ -46,7 +55,8 @@ | |||
255 | 46 | from svn://svn.example.com/fooix/trunk. | 55 | from svn://svn.example.com/fooix/trunk. |
256 | 47 | 56 | ||
257 | 48 | 57 | ||
259 | 49 | == Editing details == | 58 | Editing details |
260 | 59 | --------------- | ||
261 | 50 | 60 | ||
262 | 51 | There are a number of buttons shown on the editing page for | 61 | There are a number of buttons shown on the editing page for |
263 | 52 | import operators. | 62 | import operators. |
264 | @@ -87,7 +97,8 @@ | |||
265 | 87 | >>> print_form_fields(import_browser) | 97 | >>> print_form_fields(import_browser) |
266 | 88 | field.git_repo_url: git://git.example.org/fooix | 98 | field.git_repo_url: git://git.example.org/fooix |
267 | 89 | 99 | ||
269 | 90 | === Editing the import location === | 100 | Editing the import location |
270 | 101 | +++++++++++++++++++++++++++ | ||
271 | 91 | 102 | ||
272 | 92 | The +edit-import page allows the import operator to edit the location | 103 | The +edit-import page allows the import operator to edit the location |
273 | 93 | an import is from. | 104 | an import is from. |
274 | @@ -102,6 +113,16 @@ | |||
275 | 102 | ... print extract_text(message) | 113 | ... print extract_text(message) |
276 | 103 | The code import has been updated. | 114 | The code import has been updated. |
277 | 104 | 115 | ||
278 | 116 | bzr-svn imports, | ||
279 | 117 | |||
280 | 118 | >>> import_browser.open(bzr_svn_import_location + '/+edit-import') | ||
281 | 119 | >>> import_browser.getControl('Branch URL').value = \ | ||
282 | 120 | ... 'svn://svn-new.example.com/bzr-svn/trunk' | ||
283 | 121 | >>> import_browser.getControl('Update').click() | ||
284 | 122 | >>> for message in get_feedback_messages(import_browser.contents): | ||
285 | 123 | ... print extract_text(message) | ||
286 | 124 | The code import has been updated. | ||
287 | 125 | |||
288 | 105 | CVS imports, | 126 | CVS imports, |
289 | 106 | 127 | ||
290 | 107 | >>> import_browser.open(cvs_import_location + '/+edit-import') | 128 | >>> import_browser.open(cvs_import_location + '/+edit-import') |
291 | @@ -125,7 +146,8 @@ | |||
292 | 125 | The code import has been updated. | 146 | The code import has been updated. |
293 | 126 | 147 | ||
294 | 127 | 148 | ||
296 | 128 | === Approving an import === | 149 | Approving an import |
297 | 150 | +++++++++++++++++++ | ||
298 | 129 | 151 | ||
299 | 130 | When a code import is approved, a pending job is created for it. | 152 | When a code import is approved, a pending job is created for it. |
300 | 131 | 153 | ||
301 | @@ -141,7 +163,8 @@ | |||
302 | 141 | The code import has been approved. | 163 | The code import has been approved. |
303 | 142 | 164 | ||
304 | 143 | 165 | ||
306 | 144 | === Invalidating an import === | 166 | Invalidating an import |
307 | 167 | ++++++++++++++++++++++ | ||
308 | 145 | 168 | ||
309 | 146 | >>> import_browser.getLink('Edit import source or review import').click() | 169 | >>> import_browser.getLink('Edit import source or review import').click() |
310 | 147 | >>> import_browser.getControl('Mark Invalid').click() | 170 | >>> import_browser.getControl('Mark Invalid').click() |
311 | @@ -153,7 +176,8 @@ | |||
312 | 153 | The code import has been set as invalid. | 176 | The code import has been set as invalid. |
313 | 154 | 177 | ||
314 | 155 | 178 | ||
316 | 156 | === Suspending an import === | 179 | Suspending an import |
317 | 180 | ++++++++++++++++++++ | ||
318 | 157 | 181 | ||
319 | 158 | >>> import_browser.getLink('Edit import source or review import').click() | 182 | >>> import_browser.getLink('Edit import source or review import').click() |
320 | 159 | >>> import_browser.getControl('Suspend').click() | 183 | >>> import_browser.getControl('Suspend').click() |
321 | @@ -165,7 +189,8 @@ | |||
322 | 165 | The code import has been suspended. | 189 | The code import has been suspended. |
323 | 166 | 190 | ||
324 | 167 | 191 | ||
326 | 168 | === Marking an import as failing === | 192 | Marking an import as failing |
327 | 193 | ++++++++++++++++++++++++++++ | ||
328 | 169 | 194 | ||
329 | 170 | >>> import_browser.getLink('Edit import source or review import').click() | 195 | >>> import_browser.getLink('Edit import source or review import').click() |
330 | 171 | >>> import_browser.getControl('Mark Failing').click() | 196 | >>> import_browser.getControl('Mark Failing').click() |
331 | @@ -177,7 +202,8 @@ | |||
332 | 177 | The code import has been marked as failing. | 202 | The code import has been marked as failing. |
333 | 178 | 203 | ||
334 | 179 | 204 | ||
336 | 180 | == Import details for a running job == | 205 | Import details for a running job |
337 | 206 | -------------------------------- | ||
338 | 181 | 207 | ||
339 | 182 | If the job for an approved import is running, then the import details | 208 | If the job for an approved import is running, then the import details |
340 | 183 | says how long ago since it started. | 209 | says how long ago since it started. |
341 | @@ -218,7 +244,8 @@ | |||
342 | 218 | Changeset 2 | 244 | Changeset 2 |
343 | 219 | 245 | ||
344 | 220 | 246 | ||
346 | 221 | == Import details for a import that has been imported successfully == | 247 | Import details for a import that has been imported successfully |
347 | 248 | --------------------------------------------------------------- | ||
348 | 222 | 249 | ||
349 | 223 | If a branch has been successfully imported in the past, then the date | 250 | If a branch has been successfully imported in the past, then the date |
350 | 224 | that it was last successful is shown, as well as when the next import | 251 | that it was last successful is shown, as well as when the next import |
351 | @@ -245,7 +272,8 @@ | |||
352 | 245 | ... | 272 | ... |
353 | 246 | 273 | ||
354 | 247 | 274 | ||
356 | 248 | == Requesting an import == | 275 | Requesting an import |
357 | 276 | -------------------- | ||
358 | 249 | 277 | ||
359 | 250 | If an import is waiting for its next update, any logged in user can | 278 | If an import is waiting for its next update, any logged in user can |
360 | 251 | click a button to request an immediate import. | 279 | click a button to request an immediate import. |
361 | 252 | 280 | ||
362 | === modified file 'lib/lp/code/stories/codeimport/xx-codeimport-list.txt' | |||
363 | --- lib/lp/code/stories/codeimport/xx-codeimport-list.txt 2009-06-15 21:05:06 +0000 | |||
364 | +++ lib/lp/code/stories/codeimport/xx-codeimport-list.txt 2009-12-08 19:25:27 +0000 | |||
365 | @@ -8,7 +8,7 @@ | |||
366 | 8 | >>> import pytz | 8 | >>> import pytz |
367 | 9 | >>> from lp.codehosting.codeimport.tests.test_workermonitor import ( | 9 | >>> from lp.codehosting.codeimport.tests.test_workermonitor import ( |
368 | 10 | ... nuke_codeimport_sample_data) | 10 | ... nuke_codeimport_sample_data) |
370 | 11 | >>> from canonical.database.sqlbase import flush_database_updates | 11 | >>> from lp.code.enums import RevisionControlSystems |
371 | 12 | >>> from lp.code.model.tests.test_codeimport import ( | 12 | >>> from lp.code.model.tests.test_codeimport import ( |
372 | 13 | ... make_active_import) | 13 | ... make_active_import) |
373 | 14 | >>> from lp.code.interfaces.codeimport import ICodeImportSet | 14 | >>> from lp.code.interfaces.codeimport import ICodeImportSet |
374 | @@ -21,23 +21,27 @@ | |||
375 | 21 | ... factory, product_name="myproject", branch_name="trunk", | 21 | ... factory, product_name="myproject", branch_name="trunk", |
376 | 22 | ... svn_branch_url="http://example.com/svn/myproject/trunk", | 22 | ... svn_branch_url="http://example.com/svn/myproject/trunk", |
377 | 23 | ... last_update=datetime.datetime(2007, 1, 1, tzinfo=pytz.UTC)) | 23 | ... last_update=datetime.datetime(2007, 1, 1, tzinfo=pytz.UTC)) |
378 | 24 | >>> active_bzr_svn_import = make_active_import( | ||
379 | 25 | ... factory, product_name="ourproject", branch_name="trunk", | ||
380 | 26 | ... svn_branch_url="http://example.com/bzr-svn/myproject/trunk", | ||
381 | 27 | ... rcs_type=RevisionControlSystems.BZR_SVN, | ||
382 | 28 | ... last_update=datetime.datetime(2007, 1, 2, tzinfo=pytz.UTC)) | ||
383 | 24 | >>> active_cvs_import = make_active_import( | 29 | >>> active_cvs_import = make_active_import( |
384 | 25 | ... factory, product_name="hisproj", branch_name="main", | 30 | ... factory, product_name="hisproj", branch_name="main", |
385 | 26 | ... cvs_root=":pserver:anon@example.com:/cvs", cvs_module="hisproj", | 31 | ... cvs_root=":pserver:anon@example.com:/cvs", cvs_module="hisproj", |
387 | 27 | ... last_update=datetime.datetime(2007, 1, 2, tzinfo=pytz.UTC)) | 32 | ... last_update=datetime.datetime(2007, 1, 3, tzinfo=pytz.UTC)) |
388 | 28 | >>> active_git_import = make_active_import( | 33 | >>> active_git_import = make_active_import( |
389 | 29 | ... factory, product_name="herproj", branch_name="master", | 34 | ... factory, product_name="herproj", branch_name="master", |
390 | 30 | ... git_repo_url="git://git.example.org/herproj", | 35 | ... git_repo_url="git://git.example.org/herproj", |
393 | 31 | ... last_update=datetime.datetime(2007, 1, 3, tzinfo=pytz.UTC)) | 36 | ... last_update=datetime.datetime(2007, 1, 4, tzinfo=pytz.UTC)) |
392 | 32 | >>> flush_database_updates() | ||
394 | 33 | >>> len(list(code_import_set.getActiveImports())) | 37 | >>> len(list(code_import_set.getActiveImports())) |
396 | 34 | 3 | 38 | 4 |
397 | 35 | >>> logout() | 39 | >>> logout() |
398 | 36 | 40 | ||
399 | 37 | The page is linked to from the "$N imported branches" text. | 41 | The page is linked to from the "$N imported branches" text. |
400 | 38 | 42 | ||
401 | 39 | >>> browser.open('http://code.launchpad.dev') | 43 | >>> browser.open('http://code.launchpad.dev') |
403 | 40 | >>> browser.getLink('3 imported branches').click() | 44 | >>> browser.getLink('4 imported branches').click() |
404 | 41 | >>> print browser.title | 45 | >>> print browser.title |
405 | 42 | Available code imports | 46 | Available code imports |
406 | 43 | 47 | ||
407 | @@ -48,10 +52,11 @@ | |||
408 | 48 | ... print extract_text(table) | 52 | ... print extract_text(table) |
409 | 49 | 53 | ||
410 | 50 | >>> print_import_table() | 54 | >>> print_import_table() |
415 | 51 | Project Branch Name Source Details Last Updated | 55 | Project Branch Name Source Details Last Updated |
416 | 52 | herproj master git://git.example.org/herproj 2007-01-03 | 56 | herproj master git://git.example.org/herproj 2007-01-04 |
417 | 53 | hisproj main :pserver:anon@example.com:/cvs hisproj 2007-01-02 | 57 | hisproj main :pserver:anon@example.com:/cvs hisproj 2007-01-03 |
418 | 54 | myproject trunk http://example.com/svn/myproject/trunk 2007-01-01 | 58 | myproject trunk http://example.com/svn/myproject/trunk 2007-01-01 |
419 | 59 | ourproject trunk http://example.com/bzr-svn/myproject/trunk 2007-01-02 | ||
420 | 55 | 60 | ||
421 | 56 | You can filter the list by product: | 61 | You can filter the list by product: |
422 | 57 | 62 | ||
423 | @@ -59,4 +64,4 @@ | |||
424 | 59 | >>> browser.getControl('Search', index=0).click() | 64 | >>> browser.getControl('Search', index=0).click() |
425 | 60 | >>> print_import_table() | 65 | >>> print_import_table() |
426 | 61 | Project Branch Name Source Details Last Updated | 66 | Project Branch Name Source Details Last Updated |
428 | 62 | hisproj main :pserver:anon@example.com:/cvs hisproj 2007-01-02 | 67 | hisproj main :pserver:anon@example.com:/cvs hisproj 2007-01-03 |
429 | 63 | 68 | ||
430 | === modified file 'lib/lp/code/stories/codeimport/xx-codeimport-view.txt' | |||
431 | --- lib/lp/code/stories/codeimport/xx-codeimport-view.txt 2009-08-18 00:44:31 +0000 | |||
432 | +++ lib/lp/code/stories/codeimport/xx-codeimport-view.txt 2009-12-08 19:25:27 +0000 | |||
433 | @@ -1,4 +1,5 @@ | |||
435 | 1 | = Code imports = | 1 | Code imports |
436 | 2 | ============ | ||
437 | 2 | 3 | ||
438 | 3 | For now, there is no link to the page that lists all code imports, so | 4 | For now, there is no link to the page that lists all code imports, so |
439 | 4 | we browse there directly: | 5 | we browse there directly: |
440 | @@ -31,7 +32,8 @@ | |||
441 | 31 | 'http://code.launchpad.dev/~vcs-imports/gnome-terminal/import' | 32 | 'http://code.launchpad.dev/~vcs-imports/gnome-terminal/import' |
442 | 32 | 33 | ||
443 | 33 | 34 | ||
445 | 34 | = Filtering the code import list = | 35 | Filtering the code import list |
446 | 36 | ============================== | ||
447 | 35 | 37 | ||
448 | 36 | The code import listing is filterable, though only on review status so | 38 | The code import listing is filterable, though only on review status so |
449 | 37 | far. There are no invalid imports in the sample data, so if we filter | 39 | far. There are no invalid imports in the sample data, so if we filter |
450 | 38 | 40 | ||
451 | === modified file 'lib/lp/code/stories/codeimport/xx-create-codeimport.txt' | |||
452 | --- lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-11-05 11:06:27 +0000 | |||
453 | +++ lib/lp/code/stories/codeimport/xx-create-codeimport.txt 2009-12-08 19:25:27 +0000 | |||
454 | @@ -54,6 +54,14 @@ | |||
455 | 54 | <Link text='http://svn.example.com/firefox/trunk' | 54 | <Link text='http://svn.example.com/firefox/trunk' |
456 | 55 | url='http://svn.example.com/firefox/trunk'> | 55 | url='http://svn.example.com/firefox/trunk'> |
457 | 56 | 56 | ||
458 | 57 | The fact that this is an import via bzr-svn is indicated in a 'title' | ||
459 | 58 | attribute on the text of 'Subversion'. | ||
460 | 59 | |||
461 | 60 | >>> svn_span = find_tag_by_id(browser.contents, 'svn-import-details').span | ||
462 | 61 | >>> print extract_text(svn_span) | ||
463 | 62 | Subversion | ||
464 | 63 | >>> print svn_span['title'] | ||
465 | 64 | Subversion via bzr-svn | ||
466 | 57 | 65 | ||
467 | 58 | Requesting a Git import | 66 | Requesting a Git import |
468 | 59 | ======================= | 67 | ======================= |
469 | 60 | 68 | ||
470 | === modified file 'lib/lp/code/templates/branch-import-details.pt' | |||
471 | --- lib/lp/code/templates/branch-import-details.pt 2009-12-03 18:33:22 +0000 | |||
472 | +++ lib/lp/code/templates/branch-import-details.pt 2009-12-08 19:25:27 +0000 | |||
473 | @@ -45,15 +45,18 @@ | |||
474 | 45 | </p> | 45 | </p> |
475 | 46 | </tal:git-import> | 46 | </tal:git-import> |
476 | 47 | 47 | ||
484 | 48 | <tal:svn-import condition="code_import/rcs_type/enumvalue:SVN"> | 48 | <tal:svn-import condition="view/is_svn_import"> |
485 | 49 | <p>This branch is an import of the Subversion branch from | 49 | <p id="svn-import-details"> |
486 | 50 | <tal:is-web-url condition="view/svn_url_is_web"> | 50 | This branch is an import of the |
487 | 51 | <a tal:attributes="href code_import/svn_branch_url" | 51 | <span tal:attributes="title code_import/rcs_type/title">Subversion</span> |
488 | 52 | tal:content="code_import/svn_branch_url" />. | 52 | branch from |
489 | 53 | </tal:is-web-url> | 53 | <tal:is-web-url condition="view/svn_url_is_web"> |
490 | 54 | <tal:not-web-url condition="not: view/svn_url_is_web"> | 54 | <a tal:attributes="href code_import/svn_branch_url" |
491 | 55 | tal:content="code_import/svn_branch_url" />. | ||
492 | 56 | </tal:is-web-url> | ||
493 | 57 | <tal:not-web-url condition="not: view/svn_url_is_web"> | ||
494 | 55 | <span tal:replace="code_import/svn_branch_url" />. | 58 | <span tal:replace="code_import/svn_branch_url" />. |
496 | 56 | </tal:not-web-url> | 59 | </tal:not-web-url> |
497 | 57 | </p> | 60 | </p> |
498 | 58 | </tal:svn-import> | 61 | </tal:svn-import> |
499 | 59 | 62 | ||
500 | 60 | 63 | ||
501 | === modified file 'lib/lp/code/templates/codeimport-new.pt' | |||
502 | --- lib/lp/code/templates/codeimport-new.pt 2009-09-18 03:00:45 +0000 | |||
503 | +++ lib/lp/code/templates/codeimport-new.pt 2009-12-08 19:25:27 +0000 | |||
504 | @@ -112,7 +112,7 @@ | |||
505 | 112 | updateField(form['field.cvs_root'], rcs_type == 'CVS'); | 112 | updateField(form['field.cvs_root'], rcs_type == 'CVS'); |
506 | 113 | updateField(form['field.cvs_module'], rcs_type == 'CVS'); | 113 | updateField(form['field.cvs_module'], rcs_type == 'CVS'); |
507 | 114 | // SVN | 114 | // SVN |
509 | 115 | updateField(form['field.svn_branch_url'], rcs_type == 'SVN'); | 115 | updateField(form['field.svn_branch_url'], rcs_type == 'BZR_SVN'); |
510 | 116 | } | 116 | } |
511 | 117 | registerLaunchpadFunction(updateWidgets); | 117 | registerLaunchpadFunction(updateWidgets); |
512 | 118 | //]]> | 118 | //]]> |
Hi Tim,
This branch updates the UI for the bzr-svn transition. It fixes the branch index page to show information about bzr-svn branches, fixes the edit import page and makes selecting "subversion" on the new import form create a bzr-svn import.
Some of the new tests duplicate parts of a page test (I wrote them before I found the page test) but I left them in so we can think about cleaning up the page test one day.
Cheers,
mwh