Merge lp:~gmb/launchpad/cw-refactor-create-rename-bwu-567793 into lp:launchpad
- cw-refactor-create-rename-bwu-567793
- Merge into devel
Proposed by
Graham Binns
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Graham Binns | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~gmb/launchpad/cw-refactor-create-rename-bwu-567793 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~allenap/launchpad/no-transactions-in-externalbugtracker-bug-564574 | ||||
Diff against target: |
935 lines (+117/-117) 26 files modified
lib/lp/bugs/doc/bug-watch-activity.txt (+4/-4) lib/lp/bugs/doc/bugwatch.txt (+2/-2) lib/lp/bugs/doc/checkwatches-batching.txt (+2/-2) lib/lp/bugs/doc/checkwatches-cli-switches.txt (+3/-3) lib/lp/bugs/doc/checkwatches.txt (+10/-10) lib/lp/bugs/doc/externalbugtracker-bug-imports.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-bugzilla.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-comment-imports.txt (+3/-3) lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt (+4/-4) lib/lp/bugs/doc/externalbugtracker-debbugs.txt (+3/-3) lib/lp/bugs/doc/externalbugtracker-linking-back.txt (+7/-7) lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-mantis.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-roundup.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-rt.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-sourceforge.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker-trac.txt (+2/-2) lib/lp/bugs/doc/externalbugtracker.txt (+17/-17) lib/lp/bugs/externalbugtracker/bugzilla.py (+7/-7) lib/lp/bugs/externalbugtracker/debbugs.py (+1/-1) lib/lp/bugs/scripts/checkwatches/__init__.py (+3/-3) lib/lp/bugs/scripts/checkwatches/core.py (+6/-6) lib/lp/bugs/scripts/checkwatches/tests/test_core.py (+19/-19) lib/lp/bugs/scripts/importdebianbugs.py (+2/-2) lib/lp/bugs/scripts/tests/test_bugimport.py (+6/-6) |
||||
To merge this branch: | bzr merge lp:~gmb/launchpad/cw-refactor-create-rename-bwu-567793 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Canonical Launchpad Engineering | code | Pending | |
Review via email: mp+23842@code.launchpad.net |
Commit message
Rename BugWatchUpdater to CheckwatchesMaster and move checkwatches.
Description of the change
This branch is the first stage of a big, mad checkwatches refactoring.
In this branch I renamed BugWatchUpdater to CheckwatchesMaster* (since we're going to use BugWatchUpdater for something else). I also renamed checkwatches.
*Note, I hate this name and think it's wrong; please suggest another one.
To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) : | # |
review:
Approve
Revision history for this message
Robert Collins (lifeless) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/bugs/doc/bug-watch-activity.txt' |
2 | --- lib/lp/bugs/doc/bug-watch-activity.txt 2010-03-22 14:28:03 +0000 |
3 | +++ lib/lp/bugs/doc/bug-watch-activity.txt 2010-04-21 12:20:54 +0000 |
4 | @@ -68,12 +68,12 @@ |
5 | BugWatchActivity entry. |
6 | |
7 | We can demonstrate this by passing our bug watch to |
8 | -BugWatchUpdater.updateBugWatches(). |
9 | +CheckwatchesMaster.updateBugWatches(). |
10 | |
11 | >>> from canonical.launchpad.scripts.logger import QuietFakeLogger |
12 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
13 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
14 | >>> from lp.bugs.tests.externalbugtracker import TestExternalBugTracker |
15 | - >>> updater = BugWatchUpdater(transaction, QuietFakeLogger()) |
16 | + >>> updater = CheckwatchesMaster(transaction, QuietFakeLogger()) |
17 | >>> updater.updateBugWatches( |
18 | ... TestExternalBugTracker('http://example.com'), [bug_watch]) |
19 | |
20 | @@ -128,7 +128,7 @@ |
21 | >>> print most_recent_activity.oops_id |
22 | OOPS... |
23 | |
24 | -The BugWatchUpdater also adds BugWatchActivity entries when errors occur |
25 | +The CheckwatchesMaster also adds BugWatchActivity entries when errors occur |
26 | that don't have an entry in the BugWatchActivityStatus DB Enum. |
27 | |
28 | >>> broken_bugtracker.get_remote_status_error = Exception |
29 | |
30 | === modified file 'lib/lp/bugs/doc/bugwatch.txt' |
31 | --- lib/lp/bugs/doc/bugwatch.txt 2010-03-26 10:39:53 +0000 |
32 | +++ lib/lp/bugs/doc/bugwatch.txt 2010-04-21 12:20:54 +0000 |
33 | @@ -462,9 +462,9 @@ |
34 | >>> import transaction |
35 | >>> from lp.bugs.tests.externalbugtracker import ( |
36 | ... TestRoundup) |
37 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
38 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
39 | >>> from canonical.launchpad.scripts.logger import FakeLogger |
40 | - >>> bug_watch_updater = BugWatchUpdater(transaction, FakeLogger()) |
41 | + >>> bug_watch_updater = CheckwatchesMaster(transaction, FakeLogger()) |
42 | >>> external_bugtracker = TestRoundup(bug_tracker.baseurl) |
43 | >>> bug_watch_updater.updateBugWatches(external_bugtracker, [bug_watch]) |
44 | INFO Updating 1 watches for 1 bugs on http://some.where |
45 | |
46 | === modified file 'lib/lp/bugs/doc/checkwatches-batching.txt' |
47 | --- lib/lp/bugs/doc/checkwatches-batching.txt 2010-03-26 15:24:59 +0000 |
48 | +++ lib/lp/bugs/doc/checkwatches-batching.txt 2010-04-21 12:20:54 +0000 |
49 | @@ -6,10 +6,10 @@ |
50 | for batching up operations. |
51 | |
52 | >>> import transaction |
53 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
54 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
55 | >>> from pprint import pprint |
56 | |
57 | - >>> updater = BugWatchUpdater(transaction) |
58 | + >>> updater = CheckwatchesMaster(transaction) |
59 | >>> transaction.commit() |
60 | |
61 | |
62 | |
63 | === modified file 'lib/lp/bugs/doc/checkwatches-cli-switches.txt' |
64 | --- lib/lp/bugs/doc/checkwatches-cli-switches.txt 2010-04-21 12:20:52 +0000 |
65 | +++ lib/lp/bugs/doc/checkwatches-cli-switches.txt 2010-04-21 12:20:54 +0000 |
66 | @@ -1,6 +1,6 @@ |
67 | = Updating selected bug trackers = |
68 | |
69 | -The BugWatchUpdater class can be instructed to update only a subset of |
70 | +The CheckwatchesMaster class can be instructed to update only a subset of |
71 | bugtrackers. This is acheived by passing a list of bug tracker names to |
72 | the updateBugTrackers() method. |
73 | |
74 | @@ -9,7 +9,7 @@ |
75 | ... cursor, sqlvalues, ZopelessTransactionManager) |
76 | >>> from canonical.database.constants import UTC_NOW |
77 | >>> from canonical.launchpad.scripts import FakeLogger |
78 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
79 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
80 | |
81 | We'll update all bugtrackers so that the test doesn't try to make any |
82 | external connections. |
83 | @@ -20,7 +20,7 @@ |
84 | >>> transaction.commit() |
85 | |
86 | >>> transactionmgr = ZopelessTransactionManager._installed |
87 | - >>> updater = BugWatchUpdater(transactionmgr, logger=FakeLogger()) |
88 | + >>> updater = CheckwatchesMaster(transactionmgr, logger=FakeLogger()) |
89 | |
90 | >>> updater.updateBugTrackers(['debbugs', 'gnome-bugzilla']) |
91 | DEBUG...No watches to update on http://bugs.debian.org |
92 | |
93 | === modified file 'lib/lp/bugs/doc/checkwatches.txt' |
94 | --- lib/lp/bugs/doc/checkwatches.txt 2010-04-21 12:20:52 +0000 |
95 | +++ lib/lp/bugs/doc/checkwatches.txt 2010-04-21 12:20:54 +0000 |
96 | @@ -109,7 +109,7 @@ |
97 | >>> from canonical.launchpad.interfaces import ( |
98 | ... BugTrackerType, IBugSet) |
99 | >>> from lp.bugs.scripts.checkwatches import ( |
100 | - ... BugWatchUpdater) |
101 | + ... CheckwatchesMaster) |
102 | >>> from canonical.launchpad.interfaces import ( |
103 | ... IPersonSet) |
104 | >>> sample_person = getUtility(IPersonSet).getByEmail( |
105 | @@ -150,7 +150,7 @@ |
106 | ... raise socket.timeout("Connection timed out.") |
107 | >>> try: |
108 | ... urllib2.urlopen = do_not_urlopen |
109 | - ... updater = BugWatchUpdater(transaction.manager) |
110 | + ... updater = CheckwatchesMaster(transaction.manager) |
111 | ... updater.updateBugTrackers( |
112 | ... bug_tracker_names=[example_bug_tracker_name]) |
113 | ... finally: |
114 | @@ -212,7 +212,7 @@ |
115 | >>> try: |
116 | ... externalbugtracker.get_external_bugtracker = ( |
117 | ... broken_get_external_bugtracker) |
118 | - ... updater = BugWatchUpdater(transaction.manager) |
119 | + ... updater = CheckwatchesMaster(transaction.manager) |
120 | ... transaction.commit() |
121 | ... updater._updateBugTracker(example_bug_tracker) |
122 | ... finally: |
123 | @@ -261,7 +261,7 @@ |
124 | >>> from canonical.launchpad.scripts import FakeLogger |
125 | |
126 | >>> transaction.commit() |
127 | - >>> updater = BugWatchUpdater(transaction.manager) |
128 | + >>> updater = CheckwatchesMaster(transaction.manager) |
129 | >>> original_log = updater.logger |
130 | >>> batch_size = externalbugtracker.Roundup.batch_size |
131 | >>> try: |
132 | @@ -283,7 +283,7 @@ |
133 | ----------------------------------------- |
134 | |
135 | It's possible to update all the watches on a bug tracker using |
136 | -checkwatches using BugWatchUpdater's forceUpdateAll() method. |
137 | +checkwatches using CheckwatchesMaster's forceUpdateAll() method. |
138 | forceUpdateAll() accepts a bug_tracker_name argument because it's |
139 | called by the checkwatches script, which doesn't know or care about |
140 | IBugTracker and instances thereof. |
141 | @@ -310,11 +310,11 @@ |
142 | been recently checked or not. |
143 | |
144 | We'll create a helper method here, because we want to monkey patch the |
145 | -BugWatchUpdater's logger. |
146 | +CheckwatchesMaster's logger. |
147 | |
148 | >>> def update_all(bug_tracker_name, batch_size=None): |
149 | ... transaction.commit() |
150 | - ... updater = BugWatchUpdater(transaction.manager) |
151 | + ... updater = CheckwatchesMaster(transaction.manager) |
152 | ... updater.logger = FakeLogger() |
153 | ... updater.forceUpdateAll(bug_tracker_name, batch_size) |
154 | |
155 | @@ -367,10 +367,10 @@ |
156 | 5 |
157 | |
158 | With a batch_size of 1, only one bug watch will be updated at once. |
159 | -We'll use a custom BugWatchUpdater to make sure that no connections are |
160 | +We'll use a custom CheckwatchesMaster to make sure that no connections are |
161 | made. |
162 | |
163 | - >>> class NonConnectingUpdater(BugWatchUpdater): |
164 | + >>> class NonConnectingUpdater(CheckwatchesMaster): |
165 | ... |
166 | ... def _updateBugTracker(self, bug_tracker, batch_size): |
167 | ... # Update as many watches as the batch size says. |
168 | @@ -476,7 +476,7 @@ |
169 | generated to updateBugWatches we can see that its comments will be |
170 | synced and it will be linked to the remote bug. |
171 | |
172 | - >>> updater = BugWatchUpdater(transaction.manager) |
173 | + >>> updater = CheckwatchesMaster(transaction.manager) |
174 | >>> transaction.commit() |
175 | |
176 | >>> remote_system = UselessExternalBugTracker('http://example.com') |
177 | |
178 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bug-imports.txt' |
179 | --- lib/lp/bugs/doc/externalbugtracker-bug-imports.txt 2010-03-25 11:44:28 +0000 |
180 | +++ lib/lp/bugs/doc/externalbugtracker-bug-imports.txt 2010-04-21 12:20:54 +0000 |
181 | @@ -45,14 +45,14 @@ |
182 | imported into, and the remote bug number. At the moment only |
183 | distributions are supported as the bug target. |
184 | |
185 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
186 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
187 | >>> from canonical.testing import LaunchpadZopelessLayer |
188 | >>> debian = getUtility(IDistributionSet).getByName('debian') |
189 | >>> external_bugtracker._bugs['3'] = { |
190 | ... 'package': 'evolution', |
191 | ... 'reporter': ("Joe Bloggs", "joe.bloggs@example.com")} |
192 | >>> transaction.commit() |
193 | - >>> bug_watch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn) |
194 | + >>> bug_watch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn) |
195 | >>> bug = bug_watch_updater.importBug( |
196 | ... external_bugtracker, bugtracker, debian, '3') |
197 | |
198 | |
199 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt' |
200 | --- lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-03-25 11:44:28 +0000 |
201 | +++ lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-04-21 12:20:54 +0000 |
202 | @@ -15,7 +15,7 @@ |
203 | >>> from canonical.launchpad.interfaces import IBugTrackerSet |
204 | |
205 | >>> from lp.bugs.tests.externalbugtracker import TestIssuezilla |
206 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
207 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
208 | >>> from canonical.testing import LaunchpadZopelessLayer |
209 | >>> txn = LaunchpadZopelessLayer.txn |
210 | >>> mozilla_bugzilla = getUtility(IBugTrackerSet).getByName('mozilla.org') |
211 | @@ -29,7 +29,7 @@ |
212 | 42: FUBAR |
213 | 42: FUBAR |
214 | >>> transaction.commit() |
215 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
216 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
217 | >>> bug_watch_updater.updateBugWatches( |
218 | ... issuezilla, mozilla_bugzilla.watches) |
219 | INFO:...:Updating 4 watches for 3 bugs on https://bugzilla.mozilla.org |
220 | |
221 | === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla.txt' |
222 | --- lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2010-03-26 13:48:53 +0000 |
223 | +++ lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2010-04-21 12:20:54 +0000 |
224 | @@ -312,8 +312,8 @@ |
225 | done through updateBugWatches(), which expects a list of bug watches to |
226 | update: |
227 | |
228 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
229 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
230 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
231 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
232 | >>> for bug_watch in gnome_bugzilla.watches: |
233 | ... print "%s: %s" % (bug_watch.remotebug, bug_watch.remotestatus) |
234 | 304070: None |
235 | |
236 | === modified file 'lib/lp/bugs/doc/externalbugtracker-comment-imports.txt' |
237 | --- lib/lp/bugs/doc/externalbugtracker-comment-imports.txt 2010-03-30 17:25:52 +0000 |
238 | +++ lib/lp/bugs/doc/externalbugtracker-comment-imports.txt 2010-04-21 12:20:54 +0000 |
239 | @@ -79,14 +79,14 @@ |
240 | >>> external_bugtracker = CommentImportingExternalBugTracker( |
241 | ... 'http://example.com/') |
242 | |
243 | -The BugWatchUpdater method importBugComments() is responsible for |
244 | +The CheckwatchesMaster method importBugComments() is responsible for |
245 | calling the three methods of ISupportsCommentImport in turn to import |
246 | comments. Calling importBugComments() and passing it our new |
247 | comment-importing ExternalBugTracker instance will result in the three |
248 | comments in the comment_dict being imported into Launchpad. |
249 | |
250 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
251 | - >>> bugwatch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn) |
252 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
253 | + >>> bugwatch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn) |
254 | >>> transaction.commit() |
255 | >>> bugwatch_updater.importBugComments(external_bugtracker, bug_watch) |
256 | INFO:...:Imported 3 comments for remote bug 123456 on ... |
257 | |
258 | === modified file 'lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt' |
259 | --- lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt 2010-03-25 14:28:33 +0000 |
260 | +++ lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt 2010-04-21 12:20:54 +0000 |
261 | @@ -90,13 +90,13 @@ |
262 | >>> print comments |
263 | [u'Pushing, for the purpose of.'] |
264 | |
265 | -The BugWatchUpdater method pushBugComments() is responsible for |
266 | +The CheckwatchesMaster method pushBugComments() is responsible for |
267 | calling the addRemoteComment() method of ISupportsCommentPushing for |
268 | each Launchpad comment that needs to be pushed to the remote bug |
269 | tracker. |
270 | |
271 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
272 | - >>> bugwatch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn) |
273 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
274 | + >>> bugwatch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn) |
275 | |
276 | >>> transaction.commit() |
277 | |
278 | @@ -305,7 +305,7 @@ |
279 | <BLANKLINE> |
280 | -------------------- |
281 | |
282 | -The BugWatchUpdater class has a method, _formatRemoteComment() which |
283 | +The CheckwatchesMaster class has a method, _formatRemoteComment() which |
284 | will take a Launchpad comment and format it ready for uploading to the |
285 | remote server. This allows us to include salient information, such as |
286 | the comment author, with the pushed comment. |
287 | |
288 | === modified file 'lib/lp/bugs/doc/externalbugtracker-debbugs.txt' |
289 | --- lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2010-04-09 11:07:02 +0000 |
290 | +++ lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2010-04-21 12:20:54 +0000 |
291 | @@ -115,8 +115,8 @@ |
292 | |
293 | >>> transaction.commit() |
294 | |
295 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
296 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
297 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
298 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
299 | >>> external_debbugs.sync_comments = False |
300 | >>> bug_watch_ids = sorted([bug_watch.id for bug_watch in bug_watches]) |
301 | >>> bug_watch_updater.updateBugWatches(external_debbugs, bug_watches) |
302 | @@ -419,7 +419,7 @@ |
303 | The debbugs implementation of fetchComments() doesn't actually do |
304 | anything, since DebBugs comments are stored locally and there is no need |
305 | to pre-fetch them. It exists, nevertheless, so that |
306 | -BugWatchUpdater.importBugComments() can call it. |
307 | +CheckwatchesMaster.importBugComments() can call it. |
308 | |
309 | >>> external_debbugs.fetchComments(bug_watch, comment_ids) |
310 | |
311 | |
312 | === modified file 'lib/lp/bugs/doc/externalbugtracker-linking-back.txt' |
313 | --- lib/lp/bugs/doc/externalbugtracker-linking-back.txt 2010-04-21 12:20:52 +0000 |
314 | +++ lib/lp/bugs/doc/externalbugtracker-linking-back.txt 2010-04-21 12:20:54 +0000 |
315 | @@ -27,7 +27,7 @@ |
316 | ... self.last_launchpad_bug_id = launchpad_bug_id |
317 | ... print "Setting Launchpad id for bug %s" % remote_bug |
318 | |
319 | -The methods are called by the BugWatchUpdater class: |
320 | +The methods are called by the CheckwatchesMaster class: |
321 | |
322 | >>> from canonical.testing import LaunchpadZopelessLayer |
323 | >>> txn = LaunchpadZopelessLayer.txn |
324 | @@ -46,8 +46,8 @@ |
325 | >>> txn.commit() |
326 | >>> LaunchpadZopelessLayer.switchDbUser('checkwatches') |
327 | |
328 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
329 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
330 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
331 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
332 | >>> txn.commit() |
333 | |
334 | >>> external_bugtracker = BackLinkingExternalBugTracker( |
335 | @@ -67,13 +67,13 @@ |
336 | ... external_bugtracker, [bug_watch_without_bugtask]) |
337 | |
338 | |
339 | -== BugWatchUpdater.linkLaunchpadBug() == |
340 | +== CheckwatchesMaster.linkLaunchpadBug() == |
341 | |
342 | -The BugWatchUpdater method that does the work of setting the Launchpad |
343 | +The CheckwatchesMaster method that does the work of setting the Launchpad |
344 | bug link is linkLaunchpadBug(). This method first retrieves the |
345 | current Launchpad bug ID for the remote bug. If the remote bug is |
346 | already linked to a Launchpad bug other than the one that we're trying |
347 | -to link it to, the BugWatchUpdater will check that the bug that is |
348 | +to link it to, the CheckwatchesMaster will check that the bug that is |
349 | already linked has a valid watch on the remote bug in question. If it |
350 | does, the link will remain unchanged. Otherwise it will be updated. |
351 | |
352 | @@ -97,7 +97,7 @@ |
353 | |
354 | However, if we set the current Launchpad bug ID on our |
355 | BackLinkingExternalBugTracker to a Launchpad bug that doesn't link to |
356 | -the remote bug, BugWatchUpdater.linkLaunchpadBug() will call |
357 | +the remote bug, CheckwatchesMaster.linkLaunchpadBug() will call |
358 | getLaunchpadBugId() and then, when it discovers that the current |
359 | Launchpad bug ID isn't valid, setLaunchpadBugId() to correct the error. |
360 | |
361 | |
362 | === modified file 'lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt' |
363 | --- lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-03-26 13:48:53 +0000 |
364 | +++ lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-04-21 12:20:54 +0000 |
365 | @@ -79,8 +79,8 @@ |
366 | |
367 | >>> transaction.commit() |
368 | |
369 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
370 | - >>> bug_watch_updater = BugWatchUpdater(transaction) |
371 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
372 | + >>> bug_watch_updater = CheckwatchesMaster(transaction) |
373 | >>> bug_watch_updater.updateBugWatches( |
374 | ... example_ext_bug_tracker, example_bug_tracker.watches) |
375 | INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where |
376 | |
377 | === modified file 'lib/lp/bugs/doc/externalbugtracker-mantis.txt' |
378 | --- lib/lp/bugs/doc/externalbugtracker-mantis.txt 2010-03-26 13:48:53 +0000 |
379 | +++ lib/lp/bugs/doc/externalbugtracker-mantis.txt 2010-04-21 12:20:54 +0000 |
380 | @@ -79,10 +79,10 @@ |
381 | |
382 | >>> transaction.commit() |
383 | |
384 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
385 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
386 | >>> from canonical.testing import LaunchpadZopelessLayer |
387 | >>> txn = LaunchpadZopelessLayer.txn |
388 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
389 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
390 | >>> bug_watch_updater.updateBugWatches( |
391 | ... example_ext_bug_tracker, example_bug_tracker.watches) |
392 | INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where |
393 | |
394 | === modified file 'lib/lp/bugs/doc/externalbugtracker-roundup.txt' |
395 | --- lib/lp/bugs/doc/externalbugtracker-roundup.txt 2010-03-24 16:59:46 +0000 |
396 | +++ lib/lp/bugs/doc/externalbugtracker-roundup.txt 2010-04-21 12:20:54 +0000 |
397 | @@ -137,10 +137,10 @@ |
398 | |
399 | >>> transaction.commit() |
400 | |
401 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
402 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
403 | >>> from canonical.testing import LaunchpadZopelessLayer |
404 | >>> txn = LaunchpadZopelessLayer.txn |
405 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
406 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
407 | >>> roundup = TestRoundup(example_bug_tracker.baseurl) |
408 | >>> bug_watch_updater.updateBugWatches( |
409 | ... roundup, example_bug_tracker.watches) |
410 | |
411 | === modified file 'lib/lp/bugs/doc/externalbugtracker-rt.txt' |
412 | --- lib/lp/bugs/doc/externalbugtracker-rt.txt 2010-03-24 16:59:46 +0000 |
413 | +++ lib/lp/bugs/doc/externalbugtracker-rt.txt 2010-04-21 12:20:54 +0000 |
414 | @@ -180,10 +180,10 @@ |
415 | |
416 | >>> transaction.commit() |
417 | |
418 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
419 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
420 | >>> from canonical.testing import LaunchpadZopelessLayer |
421 | >>> txn = LaunchpadZopelessLayer.txn |
422 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
423 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
424 | >>> rt = TestRequestTracker(example_bug_tracker.baseurl) |
425 | >>> bug_watch_updater.updateBugWatches(rt, example_bug_tracker.watches) |
426 | INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where |
427 | |
428 | === modified file 'lib/lp/bugs/doc/externalbugtracker-sourceforge.txt' |
429 | --- lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-03-24 16:59:46 +0000 |
430 | +++ lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-04-21 12:20:54 +0000 |
431 | @@ -161,10 +161,10 @@ |
432 | |
433 | >>> transaction.commit() |
434 | |
435 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
436 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
437 | >>> from canonical.testing import LaunchpadZopelessLayer |
438 | >>> txn = LaunchpadZopelessLayer.txn |
439 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
440 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
441 | >>> sourceforge = TestSourceForge(example_bug_tracker.baseurl) |
442 | >>> bug_watch_updater.updateBugWatches( |
443 | ... sourceforge, example_bug_tracker.watches) |
444 | |
445 | === modified file 'lib/lp/bugs/doc/externalbugtracker-trac.txt' |
446 | --- lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-03-26 13:48:53 +0000 |
447 | +++ lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-04-21 12:20:54 +0000 |
448 | @@ -297,10 +297,10 @@ |
449 | |
450 | >>> transaction.commit() |
451 | |
452 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
453 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
454 | >>> from canonical.testing import LaunchpadZopelessLayer |
455 | >>> txn = LaunchpadZopelessLayer.txn |
456 | - >>> bug_watch_updater = BugWatchUpdater(txn) |
457 | + >>> bug_watch_updater = CheckwatchesMaster(txn) |
458 | >>> trac = TestTrac(example_bug_tracker.baseurl) |
459 | >>> bug_watch_updater.updateBugWatches(trac, example_bug_tracker.watches) |
460 | INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where |
461 | |
462 | === modified file 'lib/lp/bugs/doc/externalbugtracker.txt' |
463 | --- lib/lp/bugs/doc/externalbugtracker.txt 2010-04-21 12:20:52 +0000 |
464 | +++ lib/lp/bugs/doc/externalbugtracker.txt 2010-04-21 12:20:54 +0000 |
465 | @@ -8,7 +8,7 @@ |
466 | |
467 | All the ExternalBugTrackers know how to update the status of a bug |
468 | watch. The method that updates the bug watches is |
469 | -BugWatchUpdater.updateBugWatches(), which expects an IExternalBugTracker |
470 | +CheckwatchesMaster.updateBugWatches(), which expects an IExternalBugTracker |
471 | and the bug watches to update. |
472 | |
473 | |
474 | @@ -26,8 +26,8 @@ |
475 | ... print "initializeRemoteBugDB() called: %r" % ( |
476 | ... remote_bug_ids, ) |
477 | |
478 | - >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater |
479 | - >>> bug_watch_updater = BugWatchUpdater(transaction) |
480 | + >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
481 | + >>> bug_watch_updater = CheckwatchesMaster(transaction) |
482 | >>> bug_watch_updater.updateBugWatches( |
483 | ... InitializingExternalBugTracker(), []) |
484 | initializeRemoteBugDB() called: [] |
485 | @@ -49,7 +49,7 @@ |
486 | >>> chosen_bugtracker is external_bugtracker |
487 | True |
488 | |
489 | -BugWatchUpdater calls externalbugtracker.get_external_bugtracker(), |
490 | +CheckwatchesMaster calls externalbugtracker.get_external_bugtracker(), |
491 | follwed by ExternalBugTracker.getExternalBugTrackerToUse() to get the |
492 | correct ExternalBugTracker for a given BugTracker. It does this via the |
493 | private _getExternalBugTrackersAndWatches() method, which returns a set of |
494 | @@ -193,17 +193,17 @@ |
495 | |
496 | The checkwatches module contains a variable, SYNCABLE_GNOME_PRODUCTS, |
497 | which defines the products that we want to sync comments for. |
498 | -BugWatchUpdater keeps a local copy of this variable, which we can |
499 | -override by passing a list of products to the BugWatchUpdater |
500 | +CheckwatchesMaster keeps a local copy of this variable, which we can |
501 | +override by passing a list of products to the CheckwatchesMaster |
502 | constructor. |
503 | |
504 | >>> from lp.bugs.scripts import checkwatches |
505 | >>> (bug_watch_updater._syncable_gnome_products == |
506 | - ... checkwatches.updater.SYNCABLE_GNOME_PRODUCTS) |
507 | + ... checkwatches.core.SYNCABLE_GNOME_PRODUCTS) |
508 | True |
509 | |
510 | >>> syncable_products = ['HeartOfGold'] |
511 | - >>> bug_watch_updater = BugWatchUpdater( |
512 | + >>> bug_watch_updater = CheckwatchesMaster( |
513 | ... transaction, syncable_gnome_products=syncable_products) |
514 | |
515 | >>> bug_watches = [ |
516 | @@ -256,7 +256,7 @@ |
517 | ... 'HeartOfGold', |
518 | ... 'InfiniteImprobabilityDrive', |
519 | ... ] |
520 | - >>> bug_watch_updater = BugWatchUpdater( |
521 | + >>> bug_watch_updater = CheckwatchesMaster( |
522 | ... transaction, syncable_gnome_products=syncable_products) |
523 | |
524 | >>> trackers_and_watches = get_trackers_and_watches( |
525 | @@ -294,7 +294,7 @@ |
526 | If there are no syncable GNOME products, only one batch is returned, |
527 | and the remote system is never asked about product information. |
528 | |
529 | - >>> bug_watch_updater = BugWatchUpdater( |
530 | + >>> bug_watch_updater = CheckwatchesMaster( |
531 | ... transaction, syncable_gnome_products=[]) |
532 | |
533 | >>> trackers_and_watches = get_trackers_and_watches( |
534 | @@ -352,7 +352,7 @@ |
535 | TooMuchTimeSkew: ... |
536 | |
537 | The error is in fact raised by the _getRemoteIdsToCheck() method of |
538 | -BugWatchUpdater, which is passed a server_time variable by |
539 | +CheckwatchesMaster, which is passed a server_time variable by |
540 | updateBugWatches(). updateBugWatches() is responsible for logging the |
541 | error and for setting the last_error_type on all affected BugWatches |
542 | before re-raising the error. |
543 | @@ -641,7 +641,7 @@ |
544 | |
545 | === Converting statuses === |
546 | |
547 | -Once it has retrieved the bugs from the remote server, BugWatchUpdater |
548 | +Once it has retrieved the bugs from the remote server, CheckwatchesMaster |
549 | attempts to convert their statuses into Launchpad BugTaskStatuses by |
550 | calling the convertRemoteStatus() method on the ExternalBugTracker via |
551 | its own _convertRemoteStatus() method. |
552 | @@ -660,7 +660,7 @@ |
553 | ... else: |
554 | ... raise UnknownRemoteStatusError(remote_status) |
555 | |
556 | -BugWatchUpdater._convertRemoteStatus() will handle these errors and will |
557 | +CheckwatchesMaster._convertRemoteStatus() will handle these errors and will |
558 | return BugTaskStatus.UNKNOWN when they occur. It will also log a |
559 | warning. |
560 | |
561 | @@ -710,7 +710,7 @@ |
562 | >>> external_bugtracker = TestBrokenExternalBugTracker( |
563 | ... 'http://example.com') |
564 | >>> from canonical.launchpad.scripts.logger import QuietFakeLogger |
565 | - >>> bug_watch_updater = BugWatchUpdater(transaction, QuietFakeLogger()) |
566 | + >>> bug_watch_updater = CheckwatchesMaster(transaction, QuietFakeLogger()) |
567 | |
568 | We'll create an example bug watch with which to test this. This will |
569 | be passed to external_bugtracker's updateBugWatches() method and should |
570 | @@ -1069,13 +1069,13 @@ |
571 | outside world we'll subclass it to make sure it uses our non-connecting |
572 | external_bugtracker. |
573 | |
574 | - >>> class NonConnectingBugWatchUpdater(BugWatchUpdater): |
575 | + >>> class NonConnectingCheckwatchesMaster(CheckwatchesMaster): |
576 | ... |
577 | ... def _getExternalBugTrackersAndWatches(self, bug_trackers, |
578 | ... bug_watches): |
579 | ... return [(external_bugtracker, bug_watches)] |
580 | |
581 | - >>> bug_watch_updater = NonConnectingBugWatchUpdater( |
582 | + >>> bug_watch_updater = NonConnectingCheckwatchesMaster( |
583 | ... transaction, QuietFakeLogger()) |
584 | >>> transaction.commit() |
585 | >>> bug_watch_updater._updateBugTracker( |
586 | @@ -1084,7 +1084,7 @@ |
587 | getRemoteStatus() called: u'5' |
588 | getRemoteStatus() called: u'6' |
589 | |
590 | -The default entry point into BugWatchUpdater for the checkwatches script is |
591 | +The default entry point into CheckwatchesMaster for the checkwatches script is |
592 | the updateBugTrackers() method. This, too, takes a batch_size parameter, which |
593 | allows it to be passed as a command-line option when the checkwatches script |
594 | is run. |
595 | |
596 | === modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py' |
597 | --- lib/lp/bugs/externalbugtracker/bugzilla.py 2010-04-21 12:20:52 +0000 |
598 | +++ lib/lp/bugs/externalbugtracker/bugzilla.py 2010-04-21 12:20:54 +0000 |
599 | @@ -656,7 +656,7 @@ |
600 | actual_bug_id = self._getActualBugId(remote_bug_id) |
601 | |
602 | # We need to cast comment_ids to integers, since |
603 | - # BugWatchUpdater.importBugComments() will pass us a list of |
604 | + # CheckwatchesMaster.importBugComments() will pass us a list of |
605 | # strings (see bug 248938). |
606 | comment_ids = [int(comment_id) for comment_id in comment_ids] |
607 | |
608 | @@ -682,7 +682,7 @@ |
609 | actual_bug_id = self._getActualBugId(remote_bug_id) |
610 | |
611 | # We need to cast comment_id to integers, since |
612 | - # BugWatchUpdater.importBugComments() will pass us a string (see |
613 | + # CheckwatchesMaster.importBugComments() will pass us a string (see |
614 | # bug 248938). |
615 | comment_id = int(comment_id) |
616 | |
617 | @@ -701,7 +701,7 @@ |
618 | actual_bug_id = self._getActualBugId(remote_bug_id) |
619 | |
620 | # We need to cast comment_id to integers, since |
621 | - # BugWatchUpdater.importBugComments() will pass us a string (see |
622 | + # CheckwatchesMaster.importBugComments() will pass us a string (see |
623 | # bug 248938). |
624 | comment_id = int(comment_id) |
625 | comment = self._bugs[actual_bug_id]['comments'][comment_id] |
626 | @@ -725,7 +725,7 @@ |
627 | return_dict = self.xmlrpc_proxy.Bug.add_comment(request_params) |
628 | |
629 | # We cast the return value to string, since that's what |
630 | - # BugWatchUpdater will expect (see bug 248938). |
631 | + # CheckwatchesMaster will expect (see bug 248938). |
632 | return str(return_dict['id']) |
633 | |
634 | def getLaunchpadBugId(self, remote_bug): |
635 | @@ -874,7 +874,7 @@ |
636 | bug_comments = bug_comments_dict['bugs'][str(actual_bug_id)] |
637 | |
638 | # We also need to convert each comment ID to a string, since |
639 | - # that's what BugWatchUpdater.importBugComments() expects (see |
640 | + # that's what CheckwatchesMaster.importBugComments() expects (see |
641 | # bug 248938). |
642 | return [str(comment['id']) for comment in bug_comments] |
643 | |
644 | @@ -884,7 +884,7 @@ |
645 | actual_bug_id = self._getActualBugId(remote_bug_id) |
646 | |
647 | # We need to cast comment_ids to integers, since |
648 | - # BugWatchUpdater.importBugComments() will pass us a list of |
649 | + # CheckwatchesMaster.importBugComments() will pass us a list of |
650 | # strings (see bug 248938). |
651 | comment_ids = [int(comment_id) for comment_id in comment_ids] |
652 | |
653 | @@ -922,7 +922,7 @@ |
654 | return_dict = self.xmlrpc_proxy.Launchpad.add_comment(request_params) |
655 | |
656 | # We cast the return value to string, since that's what |
657 | - # BugWatchUpdater will expect (see bug 248938). |
658 | + # CheckwatchesMaster will expect (see bug 248938). |
659 | return str(return_dict['comment_id']) |
660 | |
661 | def getLaunchpadBugId(self, remote_bug): |
662 | |
663 | === modified file 'lib/lp/bugs/externalbugtracker/debbugs.py' |
664 | --- lib/lp/bugs/externalbugtracker/debbugs.py 2010-04-09 11:07:02 +0000 |
665 | +++ lib/lp/bugs/externalbugtracker/debbugs.py 2010-04-21 12:20:54 +0000 |
666 | @@ -253,7 +253,7 @@ |
667 | """See `ISupportsCommentImport`.""" |
668 | # This method does nothing since DebBugs bugs are stored locally |
669 | # and their comments don't need to be pre-fetched. It exists |
670 | - # purely to ensure that BugWatchUpdater doesn't choke on it. |
671 | + # purely to ensure that CheckwatchesMaster doesn't choke on it. |
672 | pass |
673 | |
674 | def getPosterForComment(self, remote_bug_id, comment_id): |
675 | |
676 | === modified file 'lib/lp/bugs/scripts/checkwatches/__init__.py' |
677 | --- lib/lp/bugs/scripts/checkwatches/__init__.py 2010-04-21 12:20:52 +0000 |
678 | +++ lib/lp/bugs/scripts/checkwatches/__init__.py 2010-04-21 12:20:54 +0000 |
679 | @@ -3,8 +3,8 @@ |
680 | """Top-level __init__ for the checkwatches package.""" |
681 | |
682 | # We do this to maintain backwards compatibility with tests. |
683 | -from .base import ( |
684 | +from lp.bugs.scripts.checkwatches.base import ( |
685 | WorkingBase, commit_before, with_interaction) |
686 | -from .updater import ( |
687 | - BaseScheduler, BugWatchUpdater, CheckWatchesCronScript, SerialScheduler, |
688 | +from lp.bugs.scripts.checkwatches.core import ( |
689 | + BaseScheduler, CheckwatchesMaster, CheckWatchesCronScript, SerialScheduler, |
690 | TooMuchTimeSkew, TwistedThreadScheduler, externalbugtracker) |
691 | |
692 | === renamed file 'lib/lp/bugs/scripts/checkwatches/updater.py' => 'lib/lp/bugs/scripts/checkwatches/core.py' |
693 | --- lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 12:20:52 +0000 |
694 | +++ lib/lp/bugs/scripts/checkwatches/core.py 2010-04-21 12:20:54 +0000 |
695 | @@ -8,7 +8,7 @@ |
696 | __metaclass__ = type |
697 | __all__ = [ |
698 | 'BaseScheduler', |
699 | - 'BugWatchUpdater', |
700 | + 'CheckwatchesMaster', |
701 | 'CheckWatchesCronScript', |
702 | 'SerialScheduler', |
703 | 'TooMuchTimeSkew', |
704 | @@ -149,12 +149,12 @@ |
705 | ] |
706 | |
707 | |
708 | -class BugWatchUpdater(WorkingBase): |
709 | +class CheckwatchesMaster(WorkingBase): |
710 | """Takes responsibility for updating remote bug watches.""" |
711 | |
712 | def __init__(self, transaction_manager, logger=default_log, |
713 | syncable_gnome_products=None): |
714 | - """Initialize a BugWatchUpdater. |
715 | + """Initialize a CheckwatchesMaster. |
716 | |
717 | :param transaction_manager: A transaction manager on which |
718 | `begin()`, `abort()` and `commit()` can be |
719 | @@ -166,7 +166,7 @@ |
720 | provides a similar interface. |
721 | |
722 | """ |
723 | - super(BugWatchUpdater, self).__init__( |
724 | + super(CheckwatchesMaster, self).__init__( |
725 | LOGIN, transaction_manager, logger) |
726 | |
727 | # Override SYNCABLE_GNOME_PRODUCTS if necessary. |
728 | @@ -1194,7 +1194,7 @@ |
729 | def main(self): |
730 | start_time = time.time() |
731 | |
732 | - updater = BugWatchUpdater(self.txn, self.logger) |
733 | + updater = CheckwatchesMaster(self.txn, self.logger) |
734 | |
735 | if self.options.update_all and len(self.options.bug_trackers) > 0: |
736 | # The user has requested that we update *all* the watches |
737 | @@ -1203,7 +1203,7 @@ |
738 | updater.forceUpdateAll(bug_tracker, self.options.batch_size) |
739 | else: |
740 | # Otherwise we just update those watches that need updating, |
741 | - # and we let the BugWatchUpdater decide which those are. |
742 | + # and we let the CheckwatchesMaster decide which those are. |
743 | if self.options.jobs <= 1: |
744 | # Use the default scheduler. |
745 | scheduler = None |
746 | |
747 | === renamed file 'lib/lp/bugs/scripts/checkwatches/tests/test_updater.py' => 'lib/lp/bugs/scripts/checkwatches/tests/test_core.py' |
748 | --- lib/lp/bugs/scripts/checkwatches/tests/test_updater.py 2010-04-21 12:20:52 +0000 |
749 | +++ lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2010-04-21 12:20:54 +0000 |
750 | @@ -24,8 +24,8 @@ |
751 | from lp.bugs.externalbugtracker.bugzilla import BugzillaAPI |
752 | from lp.bugs.interfaces.bugtracker import IBugTrackerSet |
753 | from lp.bugs.scripts import checkwatches |
754 | -from lp.bugs.scripts.checkwatches.updater import ( |
755 | - BugWatchUpdater, TwistedThreadScheduler) |
756 | +from lp.bugs.scripts.checkwatches.core import ( |
757 | + CheckwatchesMaster, TwistedThreadScheduler) |
758 | from lp.bugs.scripts.checkwatches.base import CheckWatchesErrorUtility |
759 | from lp.bugs.tests.externalbugtracker import ( |
760 | TestBugzillaAPIXMLRPCTransport, TestExternalBugTracker, new_bugtracker) |
761 | @@ -51,8 +51,8 @@ |
762 | return self |
763 | |
764 | |
765 | -class NoBugWatchesByRemoteBugUpdater(checkwatches.BugWatchUpdater): |
766 | - """A subclass of BugWatchUpdater with methods overridden for testing.""" |
767 | +class NoBugWatchesByRemoteBugUpdater(checkwatches.CheckwatchesMaster): |
768 | + """A subclass of CheckwatchesMaster with methods overridden for testing.""" |
769 | |
770 | def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids): |
771 | """Return an empty list. |
772 | @@ -74,13 +74,13 @@ |
773 | # We monkey-patch externalbugtracker.get_external_bugtracker() |
774 | # so that it always returns what we want. |
775 | self.original_get_external_bug_tracker = ( |
776 | - checkwatches.updater.externalbugtracker.get_external_bugtracker) |
777 | - checkwatches.updater.externalbugtracker.get_external_bugtracker = ( |
778 | + checkwatches.core.externalbugtracker.get_external_bugtracker) |
779 | + checkwatches.core.externalbugtracker.get_external_bugtracker = ( |
780 | always_BugzillaAPI_get_external_bugtracker) |
781 | |
782 | # Create an updater with a limited set of syncable gnome |
783 | # products. |
784 | - self.updater = checkwatches.BugWatchUpdater( |
785 | + self.updater = checkwatches.CheckwatchesMaster( |
786 | transaction.manager, QuietFakeLogger(), ['test-product']) |
787 | |
788 | def tearDown(self): |
789 | @@ -130,13 +130,13 @@ |
790 | # We monkey-patch externalbugtracker.get_external_bugtracker() |
791 | # so that it always returns what we want. |
792 | self.original_get_external_bug_tracker = ( |
793 | - checkwatches.updater.externalbugtracker.get_external_bugtracker) |
794 | - checkwatches.updater.externalbugtracker.get_external_bugtracker = ( |
795 | + checkwatches.core.externalbugtracker.get_external_bugtracker) |
796 | + checkwatches.core.externalbugtracker.get_external_bugtracker = ( |
797 | always_BugzillaAPIWithoutProducts_get_external_bugtracker) |
798 | |
799 | # Create an updater with a limited set of syncable gnome |
800 | # products. |
801 | - self.updater = checkwatches.BugWatchUpdater( |
802 | + self.updater = checkwatches.CheckwatchesMaster( |
803 | transaction.manager, QuietFakeLogger(), ['test-product']) |
804 | |
805 | def tearDown(self): |
806 | @@ -175,17 +175,17 @@ |
807 | self.failIf(remote_system.sync_comments) |
808 | |
809 | |
810 | -class TestBugWatchUpdater(TestCaseWithFactory): |
811 | +class TestCheckwatchesMaster(TestCaseWithFactory): |
812 | |
813 | layer = LaunchpadZopelessLayer |
814 | |
815 | def setUp(self): |
816 | - super(TestBugWatchUpdater, self).setUp() |
817 | + super(TestCheckwatchesMaster, self).setUp() |
818 | transaction.abort() |
819 | |
820 | def test_bug_497141(self): |
821 | # Regression test for bug 497141. KeyErrors raised in |
822 | - # BugWatchUpdater.updateBugWatches() shouldn't cause |
823 | + # CheckwatchesMaster.updateBugWatches() shouldn't cause |
824 | # checkwatches to abort. |
825 | updater = NoBugWatchesByRemoteBugUpdater( |
826 | transaction.manager, QuietFakeLogger()) |
827 | @@ -219,13 +219,13 @@ |
828 | # When the batch_size is None, suggest_batch_size() will set |
829 | # it accordingly. |
830 | remote_system.batch_size = None |
831 | - checkwatches.updater.suggest_batch_size(remote_system, 1) |
832 | + checkwatches.core.suggest_batch_size(remote_system, 1) |
833 | self.failUnlessEqual(100, remote_system.batch_size) |
834 | remote_system.batch_size = None |
835 | - checkwatches.updater.suggest_batch_size(remote_system, 12350) |
836 | + checkwatches.core.suggest_batch_size(remote_system, 12350) |
837 | self.failUnlessEqual(247, remote_system.batch_size) |
838 | # If the batch_size is already set, it will not be changed. |
839 | - checkwatches.updater.suggest_batch_size(remote_system, 99999) |
840 | + checkwatches.core.suggest_batch_size(remote_system, 99999) |
841 | self.failUnlessEqual(247, remote_system.batch_size) |
842 | |
843 | |
844 | @@ -394,7 +394,7 @@ |
845 | return None |
846 | |
847 | |
848 | -class BugWatchUpdaterForThreads(BugWatchUpdater): |
849 | +class CheckwatchesMasterForThreads(CheckwatchesMaster): |
850 | """Fake updater. |
851 | |
852 | Plumbs an `ExternalBugTrackerForThreads` into a given output file, |
853 | @@ -404,7 +404,7 @@ |
854 | |
855 | def __init__(self, output_file): |
856 | logger = QuietFakeLogger() |
857 | - super(BugWatchUpdaterForThreads, self).__init__( |
858 | + super(CheckwatchesMasterForThreads, self).__init__( |
859 | transaction.manager, logger) |
860 | self.output_file = output_file |
861 | |
862 | @@ -443,7 +443,7 @@ |
863 | transaction.commit() |
864 | # Prepare the updater with the Twisted scheduler. |
865 | output_file = OutputFileForThreads() |
866 | - threaded_bug_watch_updater = BugWatchUpdaterForThreads(output_file) |
867 | + threaded_bug_watch_updater = CheckwatchesMasterForThreads(output_file) |
868 | threaded_bug_watch_scheduler = TwistedThreadScheduler( |
869 | num_threads=10, install_signal_handlers=False) |
870 | # Run the updater. |
871 | |
872 | === modified file 'lib/lp/bugs/scripts/importdebianbugs.py' |
873 | --- lib/lp/bugs/scripts/importdebianbugs.py 2009-06-25 00:40:31 +0000 |
874 | +++ lib/lp/bugs/scripts/importdebianbugs.py 2010-04-21 12:20:54 +0000 |
875 | @@ -12,7 +12,7 @@ |
876 | from canonical.launchpad.scripts.logger import log |
877 | from lp.bugs.externalbugtracker import get_external_bugtracker |
878 | from lp.bugs.interfaces.bugtask import IBugTaskSet |
879 | -from lp.bugs.scripts.checkwatches import BugWatchUpdater |
880 | +from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
881 | |
882 | |
883 | def import_debian_bugs(bugs_to_import): |
884 | @@ -20,7 +20,7 @@ |
885 | debbugs = getUtility(ILaunchpadCelebrities).debbugs |
886 | txn = ZopelessTransactionManager._installed |
887 | external_debbugs = get_external_bugtracker(debbugs) |
888 | - bug_watch_updater = BugWatchUpdater(txn, log) |
889 | + bug_watch_updater = CheckwatchesMaster(txn, log) |
890 | debian = getUtility(ILaunchpadCelebrities).debian |
891 | for debian_bug in bugs_to_import: |
892 | existing_bug_ids = [ |
893 | |
894 | === modified file 'lib/lp/bugs/scripts/tests/test_bugimport.py' |
895 | --- lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 12:20:52 +0000 |
896 | +++ lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 12:20:54 +0000 |
897 | @@ -27,7 +27,7 @@ |
898 | from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE |
899 | from lp.bugs.scripts import bugimport |
900 | from lp.bugs.scripts.bugimport import ET |
901 | -from lp.bugs.scripts.checkwatches import BugWatchUpdater |
902 | +from lp.bugs.scripts.checkwatches import CheckwatchesMaster |
903 | from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale |
904 | from lp.registry.interfaces.product import IProductSet |
905 | from lp.registry.model.person import generate_nick |
906 | @@ -889,16 +889,16 @@ |
907 | |
908 | |
909 | |
910 | -class TestBugWatchUpdater(BugWatchUpdater): |
911 | - """A mock `BugWatchUpdater` object.""" |
912 | +class TestCheckwatchesMaster(CheckwatchesMaster): |
913 | + """A mock `CheckwatchesMaster` object.""" |
914 | |
915 | def _updateBugTracker(self, bug_tracker): |
916 | # Save the current bug tracker, so _getBugWatch can reference it. |
917 | self.bugtracker = bug_tracker |
918 | - super(TestBugWatchUpdater, self)._updateBugTracker(bug_tracker) |
919 | + super(TestCheckwatchesMaster, self)._updateBugTracker(bug_tracker) |
920 | |
921 | def _getExternalBugTrackersAndWatches(self, bug_tracker, bug_watches): |
922 | - """See `BugWatchUpdater`.""" |
923 | + """See `CheckwatchesMaster`.""" |
924 | return [(TestExternalBugTracker(bug_tracker.baseurl), bug_watches)] |
925 | |
926 | def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids): |
927 | @@ -939,7 +939,7 @@ |
928 | # try and update two bug watches - the first will |
929 | # trigger a DB error, the second updates successfully. |
930 | bug_tracker = TestBugTracker(test_bug_one, test_bug_two) |
931 | - bug_watch_updater = TestBugWatchUpdater(self.layer.txn) |
932 | + bug_watch_updater = TestCheckwatchesMaster(self.layer.txn) |
933 | self.layer.txn.commit() |
934 | bug_watch_updater._updateBugTracker(bug_tracker) |
935 | # We verify that the first bug watch didn't update the status, |
Perhaps BugWatchUpdater Controller ?