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