Merge lp:~gmb/launchpad/cw-refactor-create-rename-bwu-567793 into lp:launchpad

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
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.updater to checkwatches.core.

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.updater to checkwatches.core to avoid confusion with new modules as they're added.

*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 :

Perhaps BugWatchUpdaterController ?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/doc/bug-watch-activity.txt'
--- lib/lp/bugs/doc/bug-watch-activity.txt 2010-03-22 14:28:03 +0000
+++ lib/lp/bugs/doc/bug-watch-activity.txt 2010-04-21 12:20:54 +0000
@@ -68,12 +68,12 @@
68BugWatchActivity entry.68BugWatchActivity entry.
6969
70We can demonstrate this by passing our bug watch to70We can demonstrate this by passing our bug watch to
71BugWatchUpdater.updateBugWatches().71CheckwatchesMaster.updateBugWatches().
7272
73 >>> from canonical.launchpad.scripts.logger import QuietFakeLogger73 >>> from canonical.launchpad.scripts.logger import QuietFakeLogger
74 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater74 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
75 >>> from lp.bugs.tests.externalbugtracker import TestExternalBugTracker75 >>> from lp.bugs.tests.externalbugtracker import TestExternalBugTracker
76 >>> updater = BugWatchUpdater(transaction, QuietFakeLogger())76 >>> updater = CheckwatchesMaster(transaction, QuietFakeLogger())
77 >>> updater.updateBugWatches(77 >>> updater.updateBugWatches(
78 ... TestExternalBugTracker('http://example.com'), [bug_watch])78 ... TestExternalBugTracker('http://example.com'), [bug_watch])
7979
@@ -128,7 +128,7 @@
128 >>> print most_recent_activity.oops_id128 >>> print most_recent_activity.oops_id
129 OOPS...129 OOPS...
130130
131The BugWatchUpdater also adds BugWatchActivity entries when errors occur131The CheckwatchesMaster also adds BugWatchActivity entries when errors occur
132that don't have an entry in the BugWatchActivityStatus DB Enum.132that don't have an entry in the BugWatchActivityStatus DB Enum.
133133
134 >>> broken_bugtracker.get_remote_status_error = Exception134 >>> broken_bugtracker.get_remote_status_error = Exception
135135
=== modified file 'lib/lp/bugs/doc/bugwatch.txt'
--- lib/lp/bugs/doc/bugwatch.txt 2010-03-26 10:39:53 +0000
+++ lib/lp/bugs/doc/bugwatch.txt 2010-04-21 12:20:54 +0000
@@ -462,9 +462,9 @@
462 >>> import transaction462 >>> import transaction
463 >>> from lp.bugs.tests.externalbugtracker import (463 >>> from lp.bugs.tests.externalbugtracker import (
464 ... TestRoundup)464 ... TestRoundup)
465 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater465 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
466 >>> from canonical.launchpad.scripts.logger import FakeLogger466 >>> from canonical.launchpad.scripts.logger import FakeLogger
467 >>> bug_watch_updater = BugWatchUpdater(transaction, FakeLogger())467 >>> bug_watch_updater = CheckwatchesMaster(transaction, FakeLogger())
468 >>> external_bugtracker = TestRoundup(bug_tracker.baseurl)468 >>> external_bugtracker = TestRoundup(bug_tracker.baseurl)
469 >>> bug_watch_updater.updateBugWatches(external_bugtracker, [bug_watch])469 >>> bug_watch_updater.updateBugWatches(external_bugtracker, [bug_watch])
470 INFO Updating 1 watches for 1 bugs on http://some.where470 INFO Updating 1 watches for 1 bugs on http://some.where
471471
=== modified file 'lib/lp/bugs/doc/checkwatches-batching.txt'
--- lib/lp/bugs/doc/checkwatches-batching.txt 2010-03-26 15:24:59 +0000
+++ lib/lp/bugs/doc/checkwatches-batching.txt 2010-04-21 12:20:54 +0000
@@ -6,10 +6,10 @@
6for batching up operations.6for batching up operations.
77
8 >>> import transaction8 >>> import transaction
9 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater9 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
10 >>> from pprint import pprint10 >>> from pprint import pprint
1111
12 >>> updater = BugWatchUpdater(transaction)12 >>> updater = CheckwatchesMaster(transaction)
13 >>> transaction.commit()13 >>> transaction.commit()
1414
1515
1616
=== modified file 'lib/lp/bugs/doc/checkwatches-cli-switches.txt'
--- lib/lp/bugs/doc/checkwatches-cli-switches.txt 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/doc/checkwatches-cli-switches.txt 2010-04-21 12:20:54 +0000
@@ -1,6 +1,6 @@
1= Updating selected bug trackers =1= Updating selected bug trackers =
22
3The BugWatchUpdater class can be instructed to update only a subset of3The CheckwatchesMaster class can be instructed to update only a subset of
4bugtrackers. This is acheived by passing a list of bug tracker names to4bugtrackers. This is acheived by passing a list of bug tracker names to
5the updateBugTrackers() method.5the updateBugTrackers() method.
66
@@ -9,7 +9,7 @@
9 ... cursor, sqlvalues, ZopelessTransactionManager)9 ... cursor, sqlvalues, ZopelessTransactionManager)
10 >>> from canonical.database.constants import UTC_NOW10 >>> from canonical.database.constants import UTC_NOW
11 >>> from canonical.launchpad.scripts import FakeLogger11 >>> from canonical.launchpad.scripts import FakeLogger
12 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater12 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
1313
14We'll update all bugtrackers so that the test doesn't try to make any14We'll update all bugtrackers so that the test doesn't try to make any
15external connections.15external connections.
@@ -20,7 +20,7 @@
20 >>> transaction.commit()20 >>> transaction.commit()
2121
22 >>> transactionmgr = ZopelessTransactionManager._installed22 >>> transactionmgr = ZopelessTransactionManager._installed
23 >>> updater = BugWatchUpdater(transactionmgr, logger=FakeLogger())23 >>> updater = CheckwatchesMaster(transactionmgr, logger=FakeLogger())
2424
25 >>> updater.updateBugTrackers(['debbugs', 'gnome-bugzilla'])25 >>> updater.updateBugTrackers(['debbugs', 'gnome-bugzilla'])
26 DEBUG...No watches to update on http://bugs.debian.org26 DEBUG...No watches to update on http://bugs.debian.org
2727
=== modified file 'lib/lp/bugs/doc/checkwatches.txt'
--- lib/lp/bugs/doc/checkwatches.txt 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/doc/checkwatches.txt 2010-04-21 12:20:54 +0000
@@ -109,7 +109,7 @@
109 >>> from canonical.launchpad.interfaces import (109 >>> from canonical.launchpad.interfaces import (
110 ... BugTrackerType, IBugSet)110 ... BugTrackerType, IBugSet)
111 >>> from lp.bugs.scripts.checkwatches import (111 >>> from lp.bugs.scripts.checkwatches import (
112 ... BugWatchUpdater)112 ... CheckwatchesMaster)
113 >>> from canonical.launchpad.interfaces import (113 >>> from canonical.launchpad.interfaces import (
114 ... IPersonSet)114 ... IPersonSet)
115 >>> sample_person = getUtility(IPersonSet).getByEmail(115 >>> sample_person = getUtility(IPersonSet).getByEmail(
@@ -150,7 +150,7 @@
150 ... raise socket.timeout("Connection timed out.")150 ... raise socket.timeout("Connection timed out.")
151 >>> try:151 >>> try:
152 ... urllib2.urlopen = do_not_urlopen152 ... urllib2.urlopen = do_not_urlopen
153 ... updater = BugWatchUpdater(transaction.manager)153 ... updater = CheckwatchesMaster(transaction.manager)
154 ... updater.updateBugTrackers(154 ... updater.updateBugTrackers(
155 ... bug_tracker_names=[example_bug_tracker_name])155 ... bug_tracker_names=[example_bug_tracker_name])
156 ... finally:156 ... finally:
@@ -212,7 +212,7 @@
212 >>> try:212 >>> try:
213 ... externalbugtracker.get_external_bugtracker = (213 ... externalbugtracker.get_external_bugtracker = (
214 ... broken_get_external_bugtracker)214 ... broken_get_external_bugtracker)
215 ... updater = BugWatchUpdater(transaction.manager)215 ... updater = CheckwatchesMaster(transaction.manager)
216 ... transaction.commit()216 ... transaction.commit()
217 ... updater._updateBugTracker(example_bug_tracker)217 ... updater._updateBugTracker(example_bug_tracker)
218 ... finally:218 ... finally:
@@ -261,7 +261,7 @@
261 >>> from canonical.launchpad.scripts import FakeLogger261 >>> from canonical.launchpad.scripts import FakeLogger
262262
263 >>> transaction.commit()263 >>> transaction.commit()
264 >>> updater = BugWatchUpdater(transaction.manager)264 >>> updater = CheckwatchesMaster(transaction.manager)
265 >>> original_log = updater.logger265 >>> original_log = updater.logger
266 >>> batch_size = externalbugtracker.Roundup.batch_size266 >>> batch_size = externalbugtracker.Roundup.batch_size
267 >>> try:267 >>> try:
@@ -283,7 +283,7 @@
283-----------------------------------------283-----------------------------------------
284284
285It's possible to update all the watches on a bug tracker using285It's possible to update all the watches on a bug tracker using
286checkwatches using BugWatchUpdater's forceUpdateAll() method.286checkwatches using CheckwatchesMaster's forceUpdateAll() method.
287forceUpdateAll() accepts a bug_tracker_name argument because it's287forceUpdateAll() accepts a bug_tracker_name argument because it's
288called by the checkwatches script, which doesn't know or care about288called by the checkwatches script, which doesn't know or care about
289IBugTracker and instances thereof.289IBugTracker and instances thereof.
@@ -310,11 +310,11 @@
310been recently checked or not.310been recently checked or not.
311311
312We'll create a helper method here, because we want to monkey patch the312We'll create a helper method here, because we want to monkey patch the
313BugWatchUpdater's logger.313CheckwatchesMaster's logger.
314314
315 >>> def update_all(bug_tracker_name, batch_size=None):315 >>> def update_all(bug_tracker_name, batch_size=None):
316 ... transaction.commit()316 ... transaction.commit()
317 ... updater = BugWatchUpdater(transaction.manager)317 ... updater = CheckwatchesMaster(transaction.manager)
318 ... updater.logger = FakeLogger()318 ... updater.logger = FakeLogger()
319 ... updater.forceUpdateAll(bug_tracker_name, batch_size)319 ... updater.forceUpdateAll(bug_tracker_name, batch_size)
320320
@@ -367,10 +367,10 @@
367 5367 5
368368
369With a batch_size of 1, only one bug watch will be updated at once.369With a batch_size of 1, only one bug watch will be updated at once.
370We'll use a custom BugWatchUpdater to make sure that no connections are370We'll use a custom CheckwatchesMaster to make sure that no connections are
371made.371made.
372372
373 >>> class NonConnectingUpdater(BugWatchUpdater):373 >>> class NonConnectingUpdater(CheckwatchesMaster):
374 ...374 ...
375 ... def _updateBugTracker(self, bug_tracker, batch_size):375 ... def _updateBugTracker(self, bug_tracker, batch_size):
376 ... # Update as many watches as the batch size says.376 ... # Update as many watches as the batch size says.
@@ -476,7 +476,7 @@
476generated to updateBugWatches we can see that its comments will be476generated to updateBugWatches we can see that its comments will be
477synced and it will be linked to the remote bug.477synced and it will be linked to the remote bug.
478478
479 >>> updater = BugWatchUpdater(transaction.manager)479 >>> updater = CheckwatchesMaster(transaction.manager)
480 >>> transaction.commit()480 >>> transaction.commit()
481481
482 >>> remote_system = UselessExternalBugTracker('http://example.com')482 >>> remote_system = UselessExternalBugTracker('http://example.com')
483483
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bug-imports.txt'
--- lib/lp/bugs/doc/externalbugtracker-bug-imports.txt 2010-03-25 11:44:28 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bug-imports.txt 2010-04-21 12:20:54 +0000
@@ -45,14 +45,14 @@
45imported into, and the remote bug number. At the moment only45imported into, and the remote bug number. At the moment only
46distributions are supported as the bug target.46distributions are supported as the bug target.
4747
48 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater48 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
49 >>> from canonical.testing import LaunchpadZopelessLayer49 >>> from canonical.testing import LaunchpadZopelessLayer
50 >>> debian = getUtility(IDistributionSet).getByName('debian')50 >>> debian = getUtility(IDistributionSet).getByName('debian')
51 >>> external_bugtracker._bugs['3'] = {51 >>> external_bugtracker._bugs['3'] = {
52 ... 'package': 'evolution',52 ... 'package': 'evolution',
53 ... 'reporter': ("Joe Bloggs", "joe.bloggs@example.com")}53 ... 'reporter': ("Joe Bloggs", "joe.bloggs@example.com")}
54 >>> transaction.commit()54 >>> transaction.commit()
55 >>> bug_watch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn)55 >>> bug_watch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn)
56 >>> bug = bug_watch_updater.importBug(56 >>> bug = bug_watch_updater.importBug(
57 ... external_bugtracker, bugtracker, debian, '3')57 ... external_bugtracker, bugtracker, debian, '3')
5858
5959
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-03-25 11:44:28 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla-oddities.txt 2010-04-21 12:20:54 +0000
@@ -15,7 +15,7 @@
15 >>> from canonical.launchpad.interfaces import IBugTrackerSet15 >>> from canonical.launchpad.interfaces import IBugTrackerSet
1616
17 >>> from lp.bugs.tests.externalbugtracker import TestIssuezilla17 >>> from lp.bugs.tests.externalbugtracker import TestIssuezilla
18 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater18 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
19 >>> from canonical.testing import LaunchpadZopelessLayer19 >>> from canonical.testing import LaunchpadZopelessLayer
20 >>> txn = LaunchpadZopelessLayer.txn20 >>> txn = LaunchpadZopelessLayer.txn
21 >>> mozilla_bugzilla = getUtility(IBugTrackerSet).getByName('mozilla.org')21 >>> mozilla_bugzilla = getUtility(IBugTrackerSet).getByName('mozilla.org')
@@ -29,7 +29,7 @@
29 42: FUBAR29 42: FUBAR
30 42: FUBAR30 42: FUBAR
31 >>> transaction.commit()31 >>> transaction.commit()
32 >>> bug_watch_updater = BugWatchUpdater(txn)32 >>> bug_watch_updater = CheckwatchesMaster(txn)
33 >>> bug_watch_updater.updateBugWatches(33 >>> bug_watch_updater.updateBugWatches(
34 ... issuezilla, mozilla_bugzilla.watches)34 ... issuezilla, mozilla_bugzilla.watches)
35 INFO:...:Updating 4 watches for 3 bugs on https://bugzilla.mozilla.org35 INFO:...:Updating 4 watches for 3 bugs on https://bugzilla.mozilla.org
3636
=== modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla.txt'
--- lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2010-03-26 13:48:53 +0000
+++ lib/lp/bugs/doc/externalbugtracker-bugzilla.txt 2010-04-21 12:20:54 +0000
@@ -312,8 +312,8 @@
312done through updateBugWatches(), which expects a list of bug watches to312done through updateBugWatches(), which expects a list of bug watches to
313update:313update:
314314
315 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater315 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
316 >>> bug_watch_updater = BugWatchUpdater(txn)316 >>> bug_watch_updater = CheckwatchesMaster(txn)
317 >>> for bug_watch in gnome_bugzilla.watches:317 >>> for bug_watch in gnome_bugzilla.watches:
318 ... print "%s: %s" % (bug_watch.remotebug, bug_watch.remotestatus)318 ... print "%s: %s" % (bug_watch.remotebug, bug_watch.remotestatus)
319 304070: None319 304070: None
320320
=== modified file 'lib/lp/bugs/doc/externalbugtracker-comment-imports.txt'
--- lib/lp/bugs/doc/externalbugtracker-comment-imports.txt 2010-03-30 17:25:52 +0000
+++ lib/lp/bugs/doc/externalbugtracker-comment-imports.txt 2010-04-21 12:20:54 +0000
@@ -79,14 +79,14 @@
79 >>> external_bugtracker = CommentImportingExternalBugTracker(79 >>> external_bugtracker = CommentImportingExternalBugTracker(
80 ... 'http://example.com/')80 ... 'http://example.com/')
8181
82The BugWatchUpdater method importBugComments() is responsible for82The CheckwatchesMaster method importBugComments() is responsible for
83calling the three methods of ISupportsCommentImport in turn to import83calling the three methods of ISupportsCommentImport in turn to import
84comments. Calling importBugComments() and passing it our new84comments. Calling importBugComments() and passing it our new
85comment-importing ExternalBugTracker instance will result in the three85comment-importing ExternalBugTracker instance will result in the three
86comments in the comment_dict being imported into Launchpad.86comments in the comment_dict being imported into Launchpad.
8787
88 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater88 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
89 >>> bugwatch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn)89 >>> bugwatch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn)
90 >>> transaction.commit()90 >>> transaction.commit()
91 >>> bugwatch_updater.importBugComments(external_bugtracker, bug_watch)91 >>> bugwatch_updater.importBugComments(external_bugtracker, bug_watch)
92 INFO:...:Imported 3 comments for remote bug 123456 on ...92 INFO:...:Imported 3 comments for remote bug 123456 on ...
9393
=== modified file 'lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt'
--- lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt 2010-03-25 14:28:33 +0000
+++ lib/lp/bugs/doc/externalbugtracker-comment-pushing.txt 2010-04-21 12:20:54 +0000
@@ -90,13 +90,13 @@
90 >>> print comments90 >>> print comments
91 [u'Pushing, for the purpose of.']91 [u'Pushing, for the purpose of.']
9292
93The BugWatchUpdater method pushBugComments() is responsible for93The CheckwatchesMaster method pushBugComments() is responsible for
94calling the addRemoteComment() method of ISupportsCommentPushing for94calling the addRemoteComment() method of ISupportsCommentPushing for
95each Launchpad comment that needs to be pushed to the remote bug95each Launchpad comment that needs to be pushed to the remote bug
96tracker.96tracker.
9797
98 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater98 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
99 >>> bugwatch_updater = BugWatchUpdater(LaunchpadZopelessLayer.txn)99 >>> bugwatch_updater = CheckwatchesMaster(LaunchpadZopelessLayer.txn)
100100
101 >>> transaction.commit()101 >>> transaction.commit()
102102
@@ -305,7 +305,7 @@
305 <BLANKLINE>305 <BLANKLINE>
306 --------------------306 --------------------
307307
308The BugWatchUpdater class has a method, _formatRemoteComment() which308The CheckwatchesMaster class has a method, _formatRemoteComment() which
309will take a Launchpad comment and format it ready for uploading to the309will take a Launchpad comment and format it ready for uploading to the
310remote server. This allows us to include salient information, such as310remote server. This allows us to include salient information, such as
311the comment author, with the pushed comment.311the comment author, with the pushed comment.
312312
=== modified file 'lib/lp/bugs/doc/externalbugtracker-debbugs.txt'
--- lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2010-04-09 11:07:02 +0000
+++ lib/lp/bugs/doc/externalbugtracker-debbugs.txt 2010-04-21 12:20:54 +0000
@@ -115,8 +115,8 @@
115115
116 >>> transaction.commit()116 >>> transaction.commit()
117117
118 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater118 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
119 >>> bug_watch_updater = BugWatchUpdater(txn)119 >>> bug_watch_updater = CheckwatchesMaster(txn)
120 >>> external_debbugs.sync_comments = False120 >>> external_debbugs.sync_comments = False
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])
122 >>> bug_watch_updater.updateBugWatches(external_debbugs, bug_watches)122 >>> bug_watch_updater.updateBugWatches(external_debbugs, bug_watches)
@@ -419,7 +419,7 @@
419The debbugs implementation of fetchComments() doesn't actually do419The debbugs implementation of fetchComments() doesn't actually do
420anything, since DebBugs comments are stored locally and there is no need420anything, since DebBugs comments are stored locally and there is no need
421to pre-fetch them. It exists, nevertheless, so that421to pre-fetch them. It exists, nevertheless, so that
422BugWatchUpdater.importBugComments() can call it.422CheckwatchesMaster.importBugComments() can call it.
423423
424 >>> external_debbugs.fetchComments(bug_watch, comment_ids)424 >>> external_debbugs.fetchComments(bug_watch, comment_ids)
425425
426426
=== modified file 'lib/lp/bugs/doc/externalbugtracker-linking-back.txt'
--- lib/lp/bugs/doc/externalbugtracker-linking-back.txt 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/doc/externalbugtracker-linking-back.txt 2010-04-21 12:20:54 +0000
@@ -27,7 +27,7 @@
27 ... self.last_launchpad_bug_id = launchpad_bug_id27 ... self.last_launchpad_bug_id = launchpad_bug_id
28 ... print "Setting Launchpad id for bug %s" % remote_bug28 ... print "Setting Launchpad id for bug %s" % remote_bug
2929
30The methods are called by the BugWatchUpdater class:30The methods are called by the CheckwatchesMaster class:
3131
32 >>> from canonical.testing import LaunchpadZopelessLayer32 >>> from canonical.testing import LaunchpadZopelessLayer
33 >>> txn = LaunchpadZopelessLayer.txn33 >>> txn = LaunchpadZopelessLayer.txn
@@ -46,8 +46,8 @@
46 >>> txn.commit()46 >>> txn.commit()
47 >>> LaunchpadZopelessLayer.switchDbUser('checkwatches')47 >>> LaunchpadZopelessLayer.switchDbUser('checkwatches')
4848
49 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater49 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
50 >>> bug_watch_updater = BugWatchUpdater(txn)50 >>> bug_watch_updater = CheckwatchesMaster(txn)
51 >>> txn.commit()51 >>> txn.commit()
5252
53 >>> external_bugtracker = BackLinkingExternalBugTracker(53 >>> external_bugtracker = BackLinkingExternalBugTracker(
@@ -67,13 +67,13 @@
67 ... external_bugtracker, [bug_watch_without_bugtask])67 ... external_bugtracker, [bug_watch_without_bugtask])
6868
6969
70== BugWatchUpdater.linkLaunchpadBug() ==70== CheckwatchesMaster.linkLaunchpadBug() ==
7171
72The BugWatchUpdater method that does the work of setting the Launchpad72The CheckwatchesMaster method that does the work of setting the Launchpad
73bug link is linkLaunchpadBug(). This method first retrieves the73bug link is linkLaunchpadBug(). This method first retrieves the
74current Launchpad bug ID for the remote bug. If the remote bug is74current Launchpad bug ID for the remote bug. If the remote bug is
75already linked to a Launchpad bug other than the one that we're trying75already linked to a Launchpad bug other than the one that we're trying
76to link it to, the BugWatchUpdater will check that the bug that is76to link it to, the CheckwatchesMaster will check that the bug that is
77already linked has a valid watch on the remote bug in question. If it77already linked has a valid watch on the remote bug in question. If it
78does, the link will remain unchanged. Otherwise it will be updated.78does, the link will remain unchanged. Otherwise it will be updated.
7979
@@ -97,7 +97,7 @@
9797
98However, if we set the current Launchpad bug ID on our98However, if we set the current Launchpad bug ID on our
99BackLinkingExternalBugTracker to a Launchpad bug that doesn't link to99BackLinkingExternalBugTracker to a Launchpad bug that doesn't link to
100the remote bug, BugWatchUpdater.linkLaunchpadBug() will call100the remote bug, CheckwatchesMaster.linkLaunchpadBug() will call
101getLaunchpadBugId() and then, when it discovers that the current101getLaunchpadBugId() and then, when it discovers that the current
102Launchpad bug ID isn't valid, setLaunchpadBugId() to correct the error.102Launchpad bug ID isn't valid, setLaunchpadBugId() to correct the error.
103103
104104
=== modified file 'lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt'
--- lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-03-26 13:48:53 +0000
+++ lib/lp/bugs/doc/externalbugtracker-mantis-csv.txt 2010-04-21 12:20:54 +0000
@@ -79,8 +79,8 @@
7979
80 >>> transaction.commit()80 >>> transaction.commit()
8181
82 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater82 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
83 >>> bug_watch_updater = BugWatchUpdater(transaction)83 >>> bug_watch_updater = CheckwatchesMaster(transaction)
84 >>> bug_watch_updater.updateBugWatches(84 >>> bug_watch_updater.updateBugWatches(
85 ... example_ext_bug_tracker, example_bug_tracker.watches)85 ... example_ext_bug_tracker, example_bug_tracker.watches)
86 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where86 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where
8787
=== modified file 'lib/lp/bugs/doc/externalbugtracker-mantis.txt'
--- lib/lp/bugs/doc/externalbugtracker-mantis.txt 2010-03-26 13:48:53 +0000
+++ lib/lp/bugs/doc/externalbugtracker-mantis.txt 2010-04-21 12:20:54 +0000
@@ -79,10 +79,10 @@
7979
80 >>> transaction.commit()80 >>> transaction.commit()
8181
82 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater82 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
83 >>> from canonical.testing import LaunchpadZopelessLayer83 >>> from canonical.testing import LaunchpadZopelessLayer
84 >>> txn = LaunchpadZopelessLayer.txn84 >>> txn = LaunchpadZopelessLayer.txn
85 >>> bug_watch_updater = BugWatchUpdater(txn)85 >>> bug_watch_updater = CheckwatchesMaster(txn)
86 >>> bug_watch_updater.updateBugWatches(86 >>> bug_watch_updater.updateBugWatches(
87 ... example_ext_bug_tracker, example_bug_tracker.watches)87 ... example_ext_bug_tracker, example_bug_tracker.watches)
88 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where88 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where
8989
=== modified file 'lib/lp/bugs/doc/externalbugtracker-roundup.txt'
--- lib/lp/bugs/doc/externalbugtracker-roundup.txt 2010-03-24 16:59:46 +0000
+++ lib/lp/bugs/doc/externalbugtracker-roundup.txt 2010-04-21 12:20:54 +0000
@@ -137,10 +137,10 @@
137137
138 >>> transaction.commit()138 >>> transaction.commit()
139139
140 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater140 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
141 >>> from canonical.testing import LaunchpadZopelessLayer141 >>> from canonical.testing import LaunchpadZopelessLayer
142 >>> txn = LaunchpadZopelessLayer.txn142 >>> txn = LaunchpadZopelessLayer.txn
143 >>> bug_watch_updater = BugWatchUpdater(txn)143 >>> bug_watch_updater = CheckwatchesMaster(txn)
144 >>> roundup = TestRoundup(example_bug_tracker.baseurl)144 >>> roundup = TestRoundup(example_bug_tracker.baseurl)
145 >>> bug_watch_updater.updateBugWatches(145 >>> bug_watch_updater.updateBugWatches(
146 ... roundup, example_bug_tracker.watches)146 ... roundup, example_bug_tracker.watches)
147147
=== modified file 'lib/lp/bugs/doc/externalbugtracker-rt.txt'
--- lib/lp/bugs/doc/externalbugtracker-rt.txt 2010-03-24 16:59:46 +0000
+++ lib/lp/bugs/doc/externalbugtracker-rt.txt 2010-04-21 12:20:54 +0000
@@ -180,10 +180,10 @@
180180
181 >>> transaction.commit()181 >>> transaction.commit()
182182
183 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater183 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
184 >>> from canonical.testing import LaunchpadZopelessLayer184 >>> from canonical.testing import LaunchpadZopelessLayer
185 >>> txn = LaunchpadZopelessLayer.txn185 >>> txn = LaunchpadZopelessLayer.txn
186 >>> bug_watch_updater = BugWatchUpdater(txn)186 >>> bug_watch_updater = CheckwatchesMaster(txn)
187 >>> rt = TestRequestTracker(example_bug_tracker.baseurl)187 >>> rt = TestRequestTracker(example_bug_tracker.baseurl)
188 >>> bug_watch_updater.updateBugWatches(rt, example_bug_tracker.watches)188 >>> bug_watch_updater.updateBugWatches(rt, example_bug_tracker.watches)
189 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where189 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where
190190
=== modified file 'lib/lp/bugs/doc/externalbugtracker-sourceforge.txt'
--- lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-03-24 16:59:46 +0000
+++ lib/lp/bugs/doc/externalbugtracker-sourceforge.txt 2010-04-21 12:20:54 +0000
@@ -161,10 +161,10 @@
161161
162 >>> transaction.commit()162 >>> transaction.commit()
163163
164 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater164 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
165 >>> from canonical.testing import LaunchpadZopelessLayer165 >>> from canonical.testing import LaunchpadZopelessLayer
166 >>> txn = LaunchpadZopelessLayer.txn166 >>> txn = LaunchpadZopelessLayer.txn
167 >>> bug_watch_updater = BugWatchUpdater(txn)167 >>> bug_watch_updater = CheckwatchesMaster(txn)
168 >>> sourceforge = TestSourceForge(example_bug_tracker.baseurl)168 >>> sourceforge = TestSourceForge(example_bug_tracker.baseurl)
169 >>> bug_watch_updater.updateBugWatches(169 >>> bug_watch_updater.updateBugWatches(
170 ... sourceforge, example_bug_tracker.watches)170 ... sourceforge, example_bug_tracker.watches)
171171
=== modified file 'lib/lp/bugs/doc/externalbugtracker-trac.txt'
--- lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-03-26 13:48:53 +0000
+++ lib/lp/bugs/doc/externalbugtracker-trac.txt 2010-04-21 12:20:54 +0000
@@ -297,10 +297,10 @@
297297
298 >>> transaction.commit()298 >>> transaction.commit()
299299
300 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater300 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
301 >>> from canonical.testing import LaunchpadZopelessLayer301 >>> from canonical.testing import LaunchpadZopelessLayer
302 >>> txn = LaunchpadZopelessLayer.txn302 >>> txn = LaunchpadZopelessLayer.txn
303 >>> bug_watch_updater = BugWatchUpdater(txn)303 >>> bug_watch_updater = CheckwatchesMaster(txn)
304 >>> trac = TestTrac(example_bug_tracker.baseurl)304 >>> trac = TestTrac(example_bug_tracker.baseurl)
305 >>> bug_watch_updater.updateBugWatches(trac, example_bug_tracker.watches)305 >>> bug_watch_updater.updateBugWatches(trac, example_bug_tracker.watches)
306 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where306 INFO:...:Updating 1 watches for 1 bugs on http://bugs.some.where
307307
=== modified file 'lib/lp/bugs/doc/externalbugtracker.txt'
--- lib/lp/bugs/doc/externalbugtracker.txt 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/doc/externalbugtracker.txt 2010-04-21 12:20:54 +0000
@@ -8,7 +8,7 @@
88
9All the ExternalBugTrackers know how to update the status of a bug9All the ExternalBugTrackers know how to update the status of a bug
10watch. The method that updates the bug watches is10watch. The method that updates the bug watches is
11BugWatchUpdater.updateBugWatches(), which expects an IExternalBugTracker11CheckwatchesMaster.updateBugWatches(), which expects an IExternalBugTracker
12and the bug watches to update.12and the bug watches to update.
1313
1414
@@ -26,8 +26,8 @@
26 ... print "initializeRemoteBugDB() called: %r" % (26 ... print "initializeRemoteBugDB() called: %r" % (
27 ... remote_bug_ids, )27 ... remote_bug_ids, )
2828
29 >>> from lp.bugs.scripts.checkwatches import BugWatchUpdater29 >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
30 >>> bug_watch_updater = BugWatchUpdater(transaction)30 >>> bug_watch_updater = CheckwatchesMaster(transaction)
31 >>> bug_watch_updater.updateBugWatches(31 >>> bug_watch_updater.updateBugWatches(
32 ... InitializingExternalBugTracker(), [])32 ... InitializingExternalBugTracker(), [])
33 initializeRemoteBugDB() called: []33 initializeRemoteBugDB() called: []
@@ -49,7 +49,7 @@
49 >>> chosen_bugtracker is external_bugtracker49 >>> chosen_bugtracker is external_bugtracker
50 True50 True
5151
52BugWatchUpdater calls externalbugtracker.get_external_bugtracker(),52CheckwatchesMaster calls externalbugtracker.get_external_bugtracker(),
53follwed by ExternalBugTracker.getExternalBugTrackerToUse() to get the53follwed by ExternalBugTracker.getExternalBugTrackerToUse() to get the
54correct ExternalBugTracker for a given BugTracker. It does this via the54correct ExternalBugTracker for a given BugTracker. It does this via the
55private _getExternalBugTrackersAndWatches() method, which returns a set of55private _getExternalBugTrackersAndWatches() method, which returns a set of
@@ -193,17 +193,17 @@
193193
194The checkwatches module contains a variable, SYNCABLE_GNOME_PRODUCTS,194The checkwatches module contains a variable, SYNCABLE_GNOME_PRODUCTS,
195which defines the products that we want to sync comments for.195which defines the products that we want to sync comments for.
196BugWatchUpdater keeps a local copy of this variable, which we can196CheckwatchesMaster keeps a local copy of this variable, which we can
197override by passing a list of products to the BugWatchUpdater197override by passing a list of products to the CheckwatchesMaster
198constructor.198constructor.
199199
200 >>> from lp.bugs.scripts import checkwatches200 >>> from lp.bugs.scripts import checkwatches
201 >>> (bug_watch_updater._syncable_gnome_products ==201 >>> (bug_watch_updater._syncable_gnome_products ==
202 ... checkwatches.updater.SYNCABLE_GNOME_PRODUCTS)202 ... checkwatches.core.SYNCABLE_GNOME_PRODUCTS)
203 True203 True
204204
205 >>> syncable_products = ['HeartOfGold']205 >>> syncable_products = ['HeartOfGold']
206 >>> bug_watch_updater = BugWatchUpdater(206 >>> bug_watch_updater = CheckwatchesMaster(
207 ... transaction, syncable_gnome_products=syncable_products)207 ... transaction, syncable_gnome_products=syncable_products)
208208
209 >>> bug_watches = [209 >>> bug_watches = [
@@ -256,7 +256,7 @@
256 ... 'HeartOfGold',256 ... 'HeartOfGold',
257 ... 'InfiniteImprobabilityDrive',257 ... 'InfiniteImprobabilityDrive',
258 ... ]258 ... ]
259 >>> bug_watch_updater = BugWatchUpdater(259 >>> bug_watch_updater = CheckwatchesMaster(
260 ... transaction, syncable_gnome_products=syncable_products)260 ... transaction, syncable_gnome_products=syncable_products)
261261
262 >>> trackers_and_watches = get_trackers_and_watches(262 >>> trackers_and_watches = get_trackers_and_watches(
@@ -294,7 +294,7 @@
294If there are no syncable GNOME products, only one batch is returned,294If there are no syncable GNOME products, only one batch is returned,
295and the remote system is never asked about product information.295and the remote system is never asked about product information.
296296
297 >>> bug_watch_updater = BugWatchUpdater(297 >>> bug_watch_updater = CheckwatchesMaster(
298 ... transaction, syncable_gnome_products=[])298 ... transaction, syncable_gnome_products=[])
299299
300 >>> trackers_and_watches = get_trackers_and_watches(300 >>> trackers_and_watches = get_trackers_and_watches(
@@ -352,7 +352,7 @@
352 TooMuchTimeSkew: ...352 TooMuchTimeSkew: ...
353353
354The error is in fact raised by the _getRemoteIdsToCheck() method of354The error is in fact raised by the _getRemoteIdsToCheck() method of
355BugWatchUpdater, which is passed a server_time variable by355CheckwatchesMaster, which is passed a server_time variable by
356updateBugWatches(). updateBugWatches() is responsible for logging the356updateBugWatches(). updateBugWatches() is responsible for logging the
357error and for setting the last_error_type on all affected BugWatches357error and for setting the last_error_type on all affected BugWatches
358before re-raising the error.358before re-raising the error.
@@ -641,7 +641,7 @@
641641
642=== Converting statuses ===642=== Converting statuses ===
643643
644Once it has retrieved the bugs from the remote server, BugWatchUpdater644Once it has retrieved the bugs from the remote server, CheckwatchesMaster
645attempts to convert their statuses into Launchpad BugTaskStatuses by645attempts to convert their statuses into Launchpad BugTaskStatuses by
646calling the convertRemoteStatus() method on the ExternalBugTracker via646calling the convertRemoteStatus() method on the ExternalBugTracker via
647its own _convertRemoteStatus() method.647its own _convertRemoteStatus() method.
@@ -660,7 +660,7 @@
660 ... else:660 ... else:
661 ... raise UnknownRemoteStatusError(remote_status)661 ... raise UnknownRemoteStatusError(remote_status)
662662
663BugWatchUpdater._convertRemoteStatus() will handle these errors and will663CheckwatchesMaster._convertRemoteStatus() will handle these errors and will
664return BugTaskStatus.UNKNOWN when they occur. It will also log a664return BugTaskStatus.UNKNOWN when they occur. It will also log a
665warning.665warning.
666666
@@ -710,7 +710,7 @@
710 >>> external_bugtracker = TestBrokenExternalBugTracker(710 >>> external_bugtracker = TestBrokenExternalBugTracker(
711 ... 'http://example.com')711 ... 'http://example.com')
712 >>> from canonical.launchpad.scripts.logger import QuietFakeLogger712 >>> from canonical.launchpad.scripts.logger import QuietFakeLogger
713 >>> bug_watch_updater = BugWatchUpdater(transaction, QuietFakeLogger())713 >>> bug_watch_updater = CheckwatchesMaster(transaction, QuietFakeLogger())
714714
715We'll create an example bug watch with which to test this. This will715We'll create an example bug watch with which to test this. This will
716be passed to external_bugtracker's updateBugWatches() method and should716be passed to external_bugtracker's updateBugWatches() method and should
@@ -1069,13 +1069,13 @@
1069outside world we'll subclass it to make sure it uses our non-connecting1069outside world we'll subclass it to make sure it uses our non-connecting
1070external_bugtracker.1070external_bugtracker.
10711071
1072 >>> class NonConnectingBugWatchUpdater(BugWatchUpdater):1072 >>> class NonConnectingCheckwatchesMaster(CheckwatchesMaster):
1073 ...1073 ...
1074 ... def _getExternalBugTrackersAndWatches(self, bug_trackers,1074 ... def _getExternalBugTrackersAndWatches(self, bug_trackers,
1075 ... bug_watches):1075 ... bug_watches):
1076 ... return [(external_bugtracker, bug_watches)]1076 ... return [(external_bugtracker, bug_watches)]
10771077
1078 >>> bug_watch_updater = NonConnectingBugWatchUpdater(1078 >>> bug_watch_updater = NonConnectingCheckwatchesMaster(
1079 ... transaction, QuietFakeLogger())1079 ... transaction, QuietFakeLogger())
1080 >>> transaction.commit()1080 >>> transaction.commit()
1081 >>> bug_watch_updater._updateBugTracker(1081 >>> bug_watch_updater._updateBugTracker(
@@ -1084,7 +1084,7 @@
1084 getRemoteStatus() called: u'5'1084 getRemoteStatus() called: u'5'
1085 getRemoteStatus() called: u'6'1085 getRemoteStatus() called: u'6'
10861086
1087The default entry point into BugWatchUpdater for the checkwatches script is1087The default entry point into CheckwatchesMaster for the checkwatches script is
1088the updateBugTrackers() method. This, too, takes a batch_size parameter, which1088the updateBugTrackers() method. This, too, takes a batch_size parameter, which
1089allows it to be passed as a command-line option when the checkwatches script1089allows it to be passed as a command-line option when the checkwatches script
1090is run.1090is run.
10911091
=== modified file 'lib/lp/bugs/externalbugtracker/bugzilla.py'
--- lib/lp/bugs/externalbugtracker/bugzilla.py 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/externalbugtracker/bugzilla.py 2010-04-21 12:20:54 +0000
@@ -656,7 +656,7 @@
656 actual_bug_id = self._getActualBugId(remote_bug_id)656 actual_bug_id = self._getActualBugId(remote_bug_id)
657657
658 # We need to cast comment_ids to integers, since658 # We need to cast comment_ids to integers, since
659 # BugWatchUpdater.importBugComments() will pass us a list of659 # CheckwatchesMaster.importBugComments() will pass us a list of
660 # strings (see bug 248938).660 # strings (see bug 248938).
661 comment_ids = [int(comment_id) for comment_id in comment_ids]661 comment_ids = [int(comment_id) for comment_id in comment_ids]
662662
@@ -682,7 +682,7 @@
682 actual_bug_id = self._getActualBugId(remote_bug_id)682 actual_bug_id = self._getActualBugId(remote_bug_id)
683683
684 # We need to cast comment_id to integers, since684 # We need to cast comment_id to integers, since
685 # BugWatchUpdater.importBugComments() will pass us a string (see685 # CheckwatchesMaster.importBugComments() will pass us a string (see
686 # bug 248938).686 # bug 248938).
687 comment_id = int(comment_id)687 comment_id = int(comment_id)
688688
@@ -701,7 +701,7 @@
701 actual_bug_id = self._getActualBugId(remote_bug_id)701 actual_bug_id = self._getActualBugId(remote_bug_id)
702702
703 # We need to cast comment_id to integers, since703 # We need to cast comment_id to integers, since
704 # BugWatchUpdater.importBugComments() will pass us a string (see704 # CheckwatchesMaster.importBugComments() will pass us a string (see
705 # bug 248938).705 # bug 248938).
706 comment_id = int(comment_id)706 comment_id = int(comment_id)
707 comment = self._bugs[actual_bug_id]['comments'][comment_id]707 comment = self._bugs[actual_bug_id]['comments'][comment_id]
@@ -725,7 +725,7 @@
725 return_dict = self.xmlrpc_proxy.Bug.add_comment(request_params)725 return_dict = self.xmlrpc_proxy.Bug.add_comment(request_params)
726726
727 # We cast the return value to string, since that's what727 # We cast the return value to string, since that's what
728 # BugWatchUpdater will expect (see bug 248938).728 # CheckwatchesMaster will expect (see bug 248938).
729 return str(return_dict['id'])729 return str(return_dict['id'])
730730
731 def getLaunchpadBugId(self, remote_bug):731 def getLaunchpadBugId(self, remote_bug):
@@ -874,7 +874,7 @@
874 bug_comments = bug_comments_dict['bugs'][str(actual_bug_id)]874 bug_comments = bug_comments_dict['bugs'][str(actual_bug_id)]
875875
876 # We also need to convert each comment ID to a string, since876 # We also need to convert each comment ID to a string, since
877 # that's what BugWatchUpdater.importBugComments() expects (see877 # that's what CheckwatchesMaster.importBugComments() expects (see
878 # bug 248938).878 # bug 248938).
879 return [str(comment['id']) for comment in bug_comments]879 return [str(comment['id']) for comment in bug_comments]
880880
@@ -884,7 +884,7 @@
884 actual_bug_id = self._getActualBugId(remote_bug_id)884 actual_bug_id = self._getActualBugId(remote_bug_id)
885885
886 # We need to cast comment_ids to integers, since886 # We need to cast comment_ids to integers, since
887 # BugWatchUpdater.importBugComments() will pass us a list of887 # CheckwatchesMaster.importBugComments() will pass us a list of
888 # strings (see bug 248938).888 # strings (see bug 248938).
889 comment_ids = [int(comment_id) for comment_id in comment_ids]889 comment_ids = [int(comment_id) for comment_id in comment_ids]
890890
@@ -922,7 +922,7 @@
922 return_dict = self.xmlrpc_proxy.Launchpad.add_comment(request_params)922 return_dict = self.xmlrpc_proxy.Launchpad.add_comment(request_params)
923923
924 # We cast the return value to string, since that's what924 # We cast the return value to string, since that's what
925 # BugWatchUpdater will expect (see bug 248938).925 # CheckwatchesMaster will expect (see bug 248938).
926 return str(return_dict['comment_id'])926 return str(return_dict['comment_id'])
927927
928 def getLaunchpadBugId(self, remote_bug):928 def getLaunchpadBugId(self, remote_bug):
929929
=== modified file 'lib/lp/bugs/externalbugtracker/debbugs.py'
--- lib/lp/bugs/externalbugtracker/debbugs.py 2010-04-09 11:07:02 +0000
+++ lib/lp/bugs/externalbugtracker/debbugs.py 2010-04-21 12:20:54 +0000
@@ -253,7 +253,7 @@
253 """See `ISupportsCommentImport`."""253 """See `ISupportsCommentImport`."""
254 # This method does nothing since DebBugs bugs are stored locally254 # This method does nothing since DebBugs bugs are stored locally
255 # and their comments don't need to be pre-fetched. It exists255 # and their comments don't need to be pre-fetched. It exists
256 # purely to ensure that BugWatchUpdater doesn't choke on it.256 # purely to ensure that CheckwatchesMaster doesn't choke on it.
257 pass257 pass
258258
259 def getPosterForComment(self, remote_bug_id, comment_id):259 def getPosterForComment(self, remote_bug_id, comment_id):
260260
=== modified file 'lib/lp/bugs/scripts/checkwatches/__init__.py'
--- lib/lp/bugs/scripts/checkwatches/__init__.py 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/scripts/checkwatches/__init__.py 2010-04-21 12:20:54 +0000
@@ -3,8 +3,8 @@
3"""Top-level __init__ for the checkwatches package."""3"""Top-level __init__ for the checkwatches package."""
44
5# We do this to maintain backwards compatibility with tests.5# We do this to maintain backwards compatibility with tests.
6from .base import (6from lp.bugs.scripts.checkwatches.base import (
7 WorkingBase, commit_before, with_interaction)7 WorkingBase, commit_before, with_interaction)
8from .updater import (8from lp.bugs.scripts.checkwatches.core import (
9 BaseScheduler, BugWatchUpdater, CheckWatchesCronScript, SerialScheduler,9 BaseScheduler, CheckwatchesMaster, CheckWatchesCronScript, SerialScheduler,
10 TooMuchTimeSkew, TwistedThreadScheduler, externalbugtracker)10 TooMuchTimeSkew, TwistedThreadScheduler, externalbugtracker)
1111
=== renamed file 'lib/lp/bugs/scripts/checkwatches/updater.py' => 'lib/lp/bugs/scripts/checkwatches/core.py'
--- lib/lp/bugs/scripts/checkwatches/updater.py 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/scripts/checkwatches/core.py 2010-04-21 12:20:54 +0000
@@ -8,7 +8,7 @@
8__metaclass__ = type8__metaclass__ = type
9__all__ = [9__all__ = [
10 'BaseScheduler',10 'BaseScheduler',
11 'BugWatchUpdater',11 'CheckwatchesMaster',
12 'CheckWatchesCronScript',12 'CheckWatchesCronScript',
13 'SerialScheduler',13 'SerialScheduler',
14 'TooMuchTimeSkew',14 'TooMuchTimeSkew',
@@ -149,12 +149,12 @@
149 ]149 ]
150150
151151
152class BugWatchUpdater(WorkingBase):152class CheckwatchesMaster(WorkingBase):
153 """Takes responsibility for updating remote bug watches."""153 """Takes responsibility for updating remote bug watches."""
154154
155 def __init__(self, transaction_manager, logger=default_log,155 def __init__(self, transaction_manager, logger=default_log,
156 syncable_gnome_products=None):156 syncable_gnome_products=None):
157 """Initialize a BugWatchUpdater.157 """Initialize a CheckwatchesMaster.
158158
159 :param transaction_manager: A transaction manager on which159 :param transaction_manager: A transaction manager on which
160 `begin()`, `abort()` and `commit()` can be160 `begin()`, `abort()` and `commit()` can be
@@ -166,7 +166,7 @@
166 provides a similar interface.166 provides a similar interface.
167167
168 """168 """
169 super(BugWatchUpdater, self).__init__(169 super(CheckwatchesMaster, self).__init__(
170 LOGIN, transaction_manager, logger)170 LOGIN, transaction_manager, logger)
171171
172 # Override SYNCABLE_GNOME_PRODUCTS if necessary.172 # Override SYNCABLE_GNOME_PRODUCTS if necessary.
@@ -1194,7 +1194,7 @@
1194 def main(self):1194 def main(self):
1195 start_time = time.time()1195 start_time = time.time()
11961196
1197 updater = BugWatchUpdater(self.txn, self.logger)1197 updater = CheckwatchesMaster(self.txn, self.logger)
11981198
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:
1200 # The user has requested that we update *all* the watches1200 # The user has requested that we update *all* the watches
@@ -1203,7 +1203,7 @@
1203 updater.forceUpdateAll(bug_tracker, self.options.batch_size)1203 updater.forceUpdateAll(bug_tracker, self.options.batch_size)
1204 else:1204 else:
1205 # Otherwise we just update those watches that need updating,1205 # Otherwise we just update those watches that need updating,
1206 # and we let the BugWatchUpdater decide which those are.1206 # and we let the CheckwatchesMaster decide which those are.
1207 if self.options.jobs <= 1:1207 if self.options.jobs <= 1:
1208 # Use the default scheduler.1208 # Use the default scheduler.
1209 scheduler = None1209 scheduler = None
12101210
=== renamed file 'lib/lp/bugs/scripts/checkwatches/tests/test_updater.py' => 'lib/lp/bugs/scripts/checkwatches/tests/test_core.py'
--- lib/lp/bugs/scripts/checkwatches/tests/test_updater.py 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2010-04-21 12:20:54 +0000
@@ -24,8 +24,8 @@
24from lp.bugs.externalbugtracker.bugzilla import BugzillaAPI24from lp.bugs.externalbugtracker.bugzilla import BugzillaAPI
25from lp.bugs.interfaces.bugtracker import IBugTrackerSet25from lp.bugs.interfaces.bugtracker import IBugTrackerSet
26from lp.bugs.scripts import checkwatches26from lp.bugs.scripts import checkwatches
27from lp.bugs.scripts.checkwatches.updater import (27from lp.bugs.scripts.checkwatches.core import (
28 BugWatchUpdater, TwistedThreadScheduler)28 CheckwatchesMaster, TwistedThreadScheduler)
29from lp.bugs.scripts.checkwatches.base import CheckWatchesErrorUtility29from lp.bugs.scripts.checkwatches.base import CheckWatchesErrorUtility
30from lp.bugs.tests.externalbugtracker import (30from lp.bugs.tests.externalbugtracker import (
31 TestBugzillaAPIXMLRPCTransport, TestExternalBugTracker, new_bugtracker)31 TestBugzillaAPIXMLRPCTransport, TestExternalBugTracker, new_bugtracker)
@@ -51,8 +51,8 @@
51 return self51 return self
5252
5353
54class NoBugWatchesByRemoteBugUpdater(checkwatches.BugWatchUpdater):54class NoBugWatchesByRemoteBugUpdater(checkwatches.CheckwatchesMaster):
55 """A subclass of BugWatchUpdater with methods overridden for testing."""55 """A subclass of CheckwatchesMaster with methods overridden for testing."""
5656
57 def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids):57 def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids):
58 """Return an empty list.58 """Return an empty list.
@@ -74,13 +74,13 @@
74 # We monkey-patch externalbugtracker.get_external_bugtracker()74 # We monkey-patch externalbugtracker.get_external_bugtracker()
75 # so that it always returns what we want.75 # so that it always returns what we want.
76 self.original_get_external_bug_tracker = (76 self.original_get_external_bug_tracker = (
77 checkwatches.updater.externalbugtracker.get_external_bugtracker)77 checkwatches.core.externalbugtracker.get_external_bugtracker)
78 checkwatches.updater.externalbugtracker.get_external_bugtracker = (78 checkwatches.core.externalbugtracker.get_external_bugtracker = (
79 always_BugzillaAPI_get_external_bugtracker)79 always_BugzillaAPI_get_external_bugtracker)
8080
81 # Create an updater with a limited set of syncable gnome81 # Create an updater with a limited set of syncable gnome
82 # products.82 # products.
83 self.updater = checkwatches.BugWatchUpdater(83 self.updater = checkwatches.CheckwatchesMaster(
84 transaction.manager, QuietFakeLogger(), ['test-product'])84 transaction.manager, QuietFakeLogger(), ['test-product'])
8585
86 def tearDown(self):86 def tearDown(self):
@@ -130,13 +130,13 @@
130 # We monkey-patch externalbugtracker.get_external_bugtracker()130 # We monkey-patch externalbugtracker.get_external_bugtracker()
131 # so that it always returns what we want.131 # so that it always returns what we want.
132 self.original_get_external_bug_tracker = (132 self.original_get_external_bug_tracker = (
133 checkwatches.updater.externalbugtracker.get_external_bugtracker)133 checkwatches.core.externalbugtracker.get_external_bugtracker)
134 checkwatches.updater.externalbugtracker.get_external_bugtracker = (134 checkwatches.core.externalbugtracker.get_external_bugtracker = (
135 always_BugzillaAPIWithoutProducts_get_external_bugtracker)135 always_BugzillaAPIWithoutProducts_get_external_bugtracker)
136136
137 # Create an updater with a limited set of syncable gnome137 # Create an updater with a limited set of syncable gnome
138 # products.138 # products.
139 self.updater = checkwatches.BugWatchUpdater(139 self.updater = checkwatches.CheckwatchesMaster(
140 transaction.manager, QuietFakeLogger(), ['test-product'])140 transaction.manager, QuietFakeLogger(), ['test-product'])
141141
142 def tearDown(self):142 def tearDown(self):
@@ -175,17 +175,17 @@
175 self.failIf(remote_system.sync_comments)175 self.failIf(remote_system.sync_comments)
176176
177177
178class TestBugWatchUpdater(TestCaseWithFactory):178class TestCheckwatchesMaster(TestCaseWithFactory):
179179
180 layer = LaunchpadZopelessLayer180 layer = LaunchpadZopelessLayer
181181
182 def setUp(self):182 def setUp(self):
183 super(TestBugWatchUpdater, self).setUp()183 super(TestCheckwatchesMaster, self).setUp()
184 transaction.abort()184 transaction.abort()
185185
186 def test_bug_497141(self):186 def test_bug_497141(self):
187 # Regression test for bug 497141. KeyErrors raised in187 # Regression test for bug 497141. KeyErrors raised in
188 # BugWatchUpdater.updateBugWatches() shouldn't cause188 # CheckwatchesMaster.updateBugWatches() shouldn't cause
189 # checkwatches to abort.189 # checkwatches to abort.
190 updater = NoBugWatchesByRemoteBugUpdater(190 updater = NoBugWatchesByRemoteBugUpdater(
191 transaction.manager, QuietFakeLogger())191 transaction.manager, QuietFakeLogger())
@@ -219,13 +219,13 @@
219 # When the batch_size is None, suggest_batch_size() will set219 # When the batch_size is None, suggest_batch_size() will set
220 # it accordingly.220 # it accordingly.
221 remote_system.batch_size = None221 remote_system.batch_size = None
222 checkwatches.updater.suggest_batch_size(remote_system, 1)222 checkwatches.core.suggest_batch_size(remote_system, 1)
223 self.failUnlessEqual(100, remote_system.batch_size)223 self.failUnlessEqual(100, remote_system.batch_size)
224 remote_system.batch_size = None224 remote_system.batch_size = None
225 checkwatches.updater.suggest_batch_size(remote_system, 12350)225 checkwatches.core.suggest_batch_size(remote_system, 12350)
226 self.failUnlessEqual(247, remote_system.batch_size)226 self.failUnlessEqual(247, remote_system.batch_size)
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.
228 checkwatches.updater.suggest_batch_size(remote_system, 99999)228 checkwatches.core.suggest_batch_size(remote_system, 99999)
229 self.failUnlessEqual(247, remote_system.batch_size)229 self.failUnlessEqual(247, remote_system.batch_size)
230230
231231
@@ -394,7 +394,7 @@
394 return None394 return None
395395
396396
397class BugWatchUpdaterForThreads(BugWatchUpdater):397class CheckwatchesMasterForThreads(CheckwatchesMaster):
398 """Fake updater.398 """Fake updater.
399399
400 Plumbs an `ExternalBugTrackerForThreads` into a given output file,400 Plumbs an `ExternalBugTrackerForThreads` into a given output file,
@@ -404,7 +404,7 @@
404404
405 def __init__(self, output_file):405 def __init__(self, output_file):
406 logger = QuietFakeLogger()406 logger = QuietFakeLogger()
407 super(BugWatchUpdaterForThreads, self).__init__(407 super(CheckwatchesMasterForThreads, self).__init__(
408 transaction.manager, logger)408 transaction.manager, logger)
409 self.output_file = output_file409 self.output_file = output_file
410410
@@ -443,7 +443,7 @@
443 transaction.commit()443 transaction.commit()
444 # Prepare the updater with the Twisted scheduler.444 # Prepare the updater with the Twisted scheduler.
445 output_file = OutputFileForThreads()445 output_file = OutputFileForThreads()
446 threaded_bug_watch_updater = BugWatchUpdaterForThreads(output_file)446 threaded_bug_watch_updater = CheckwatchesMasterForThreads(output_file)
447 threaded_bug_watch_scheduler = TwistedThreadScheduler(447 threaded_bug_watch_scheduler = TwistedThreadScheduler(
448 num_threads=10, install_signal_handlers=False)448 num_threads=10, install_signal_handlers=False)
449 # Run the updater.449 # Run the updater.
450450
=== modified file 'lib/lp/bugs/scripts/importdebianbugs.py'
--- lib/lp/bugs/scripts/importdebianbugs.py 2009-06-25 00:40:31 +0000
+++ lib/lp/bugs/scripts/importdebianbugs.py 2010-04-21 12:20:54 +0000
@@ -12,7 +12,7 @@
12from canonical.launchpad.scripts.logger import log12from canonical.launchpad.scripts.logger import log
13from lp.bugs.externalbugtracker import get_external_bugtracker13from lp.bugs.externalbugtracker import get_external_bugtracker
14from lp.bugs.interfaces.bugtask import IBugTaskSet14from lp.bugs.interfaces.bugtask import IBugTaskSet
15from lp.bugs.scripts.checkwatches import BugWatchUpdater15from lp.bugs.scripts.checkwatches import CheckwatchesMaster
1616
1717
18def import_debian_bugs(bugs_to_import):18def import_debian_bugs(bugs_to_import):
@@ -20,7 +20,7 @@
20 debbugs = getUtility(ILaunchpadCelebrities).debbugs20 debbugs = getUtility(ILaunchpadCelebrities).debbugs
21 txn = ZopelessTransactionManager._installed21 txn = ZopelessTransactionManager._installed
22 external_debbugs = get_external_bugtracker(debbugs)22 external_debbugs = get_external_bugtracker(debbugs)
23 bug_watch_updater = BugWatchUpdater(txn, log)23 bug_watch_updater = CheckwatchesMaster(txn, log)
24 debian = getUtility(ILaunchpadCelebrities).debian24 debian = getUtility(ILaunchpadCelebrities).debian
25 for debian_bug in bugs_to_import:25 for debian_bug in bugs_to_import:
26 existing_bug_ids = [26 existing_bug_ids = [
2727
=== modified file 'lib/lp/bugs/scripts/tests/test_bugimport.py'
--- lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 12:20:52 +0000
+++ lib/lp/bugs/scripts/tests/test_bugimport.py 2010-04-21 12:20:54 +0000
@@ -27,7 +27,7 @@
27from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE27from lp.bugs.interfaces.externalbugtracker import UNKNOWN_REMOTE_IMPORTANCE
28from lp.bugs.scripts import bugimport28from lp.bugs.scripts import bugimport
29from lp.bugs.scripts.bugimport import ET29from lp.bugs.scripts.bugimport import ET
30from lp.bugs.scripts.checkwatches import BugWatchUpdater30from lp.bugs.scripts.checkwatches import CheckwatchesMaster
31from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale31from lp.registry.interfaces.person import IPersonSet, PersonCreationRationale
32from lp.registry.interfaces.product import IProductSet32from lp.registry.interfaces.product import IProductSet
33from lp.registry.model.person import generate_nick33from lp.registry.model.person import generate_nick
@@ -889,16 +889,16 @@
889889
890890
891891
892class TestBugWatchUpdater(BugWatchUpdater):892class TestCheckwatchesMaster(CheckwatchesMaster):
893 """A mock `BugWatchUpdater` object."""893 """A mock `CheckwatchesMaster` object."""
894894
895 def _updateBugTracker(self, bug_tracker):895 def _updateBugTracker(self, bug_tracker):
896 # Save the current bug tracker, so _getBugWatch can reference it.896 # Save the current bug tracker, so _getBugWatch can reference it.
897 self.bugtracker = bug_tracker897 self.bugtracker = bug_tracker
898 super(TestBugWatchUpdater, self)._updateBugTracker(bug_tracker)898 super(TestCheckwatchesMaster, self)._updateBugTracker(bug_tracker)
899899
900 def _getExternalBugTrackersAndWatches(self, bug_tracker, bug_watches):900 def _getExternalBugTrackersAndWatches(self, bug_tracker, bug_watches):
901 """See `BugWatchUpdater`."""901 """See `CheckwatchesMaster`."""
902 return [(TestExternalBugTracker(bug_tracker.baseurl), bug_watches)]902 return [(TestExternalBugTracker(bug_tracker.baseurl), bug_watches)]
903903
904 def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids):904 def _getBugWatchesForRemoteBug(self, remote_bug_id, bug_watch_ids):
@@ -939,7 +939,7 @@
939 # try and update two bug watches - the first will939 # try and update two bug watches - the first will
940 # trigger a DB error, the second updates successfully.940 # trigger a DB error, the second updates successfully.
941 bug_tracker = TestBugTracker(test_bug_one, test_bug_two)941 bug_tracker = TestBugTracker(test_bug_one, test_bug_two)
942 bug_watch_updater = TestBugWatchUpdater(self.layer.txn)942 bug_watch_updater = TestCheckwatchesMaster(self.layer.txn)
943 self.layer.txn.commit()943 self.layer.txn.commit()
944 bug_watch_updater._updateBugTracker(bug_tracker)944 bug_watch_updater._updateBugTracker(bug_tracker)
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,