Merge lp:~jml/launchpad/old-twisted-bugs into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 12706
Proposed branch: lp:~jml/launchpad/old-twisted-bugs
Merge into: lp:launchpad
Diff against target: 156 lines (+14/-42)
6 files modified
lib/lp/buildmaster/tests/mock_slaves.py (+0/-3)
lib/lp/codehosting/__init__.py (+3/-12)
lib/lp/codehosting/codeimport/tests/test_workermonitor.py (+0/-4)
lib/lp/codehosting/scanner/bzrsync.py (+1/-1)
lib/lp/services/twistedsupport/xmlrpc.py (+0/-22)
lib/lp/services/utils.py (+10/-0)
To merge this branch: bzr merge lp:~jml/launchpad/old-twisted-bugs
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+55569@code.launchpad.net

Commit message

[r=abentley][no-qa] Remove workaround for Twisted bug that has since been fixed upstream.

Description of the change

This branch cleans up a work-around for a problem that has been fixed upstream, http://tm.tl/2518. In the branch I had also tried to remove what looked like an old work-around from a Bazaar upgrade, but that didn't work out. You can see the legacy of that attempt in the moved helper method and the updated comment.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/buildmaster/tests/mock_slaves.py'
--- lib/lp/buildmaster/tests/mock_slaves.py 2011-02-01 18:14:57 +0000
+++ lib/lp/buildmaster/tests/mock_slaves.py 2011-03-30 15:20:46 +0000
@@ -25,7 +25,6 @@
25import os25import os
26import types26import types
2727
28from StringIO import StringIO
29import xmlrpclib28import xmlrpclib
3029
31from testtools.content import Content30from testtools.content import Content
@@ -48,10 +47,8 @@
48from lp.soyuz.model.binarypackagebuildbehavior import (47from lp.soyuz.model.binarypackagebuildbehavior import (
49 BinaryPackageBuildBehavior,48 BinaryPackageBuildBehavior,
50 )49 )
51from lp.services.twistedsupport.xmlrpc import fix_bug_2518
52from lp.testing.sampledata import I386_ARCHITECTURE_NAME50from lp.testing.sampledata import I386_ARCHITECTURE_NAME
5351
54fix_bug_2518()
5552
56def make_publisher():53def make_publisher():
57 """Make a Soyuz test publisher."""54 """Make a Soyuz test publisher."""
5855
=== modified file 'lib/lp/codehosting/__init__.py'
--- lib/lp/codehosting/__init__.py 2011-02-18 18:43:16 +0000
+++ lib/lp/codehosting/__init__.py 2011-03-30 15:20:46 +0000
@@ -11,7 +11,6 @@
11__all__ = [11__all__ = [
12 'get_bzr_path',12 'get_bzr_path',
13 'get_BZR_PLUGIN_PATH_for_subprocess',13 'get_BZR_PLUGIN_PATH_for_subprocess',
14 'iter_list_chunks',
15 'load_optional_plugin',14 'load_optional_plugin',
16 ]15 ]
1716
@@ -25,15 +24,6 @@
25from canonical.config import config24from canonical.config import config
2625
2726
28def iter_list_chunks(a_list, size):
29 """Iterate over `a_list` in chunks of size `size`.
30
31 I'm amazed this isn't in itertools (mwhudson).
32 """
33 for i in range(0, len(a_list), size):
34 yield a_list[i:i+size]
35
36
37def get_bzr_path():27def get_bzr_path():
38 """Find the path to the copy of Bazaar for this rocketfuel instance"""28 """Find the path to the copy of Bazaar for this rocketfuel instance"""
39 bzr_in_egg_path = os.path.join(29 bzr_in_egg_path = os.path.join(
@@ -88,6 +78,7 @@
88 del self._callback_names[name]78 del self._callback_names[name]
8979
9080
91# Monkeypatch: Branch.hooks is a list in bzr 1.13, so it supports remove.81# XXX: JonathanLange 2011-03-30 bug=301472: Monkeypatch: Branch.hooks is a
92# It is a HookPoint in bzr 1.14, so add HookPoint.remove.82# list in bzr 1.13, so it supports remove. It is a HookPoint in bzr 1.14, so
83# add HookPoint.remove.
93hooks.HookPoint.remove = remove_hook84hooks.HookPoint.remove = remove_hook
9485
=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2010-12-20 03:21:03 +0000
+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2011-03-30 15:20:46 +0000
@@ -74,7 +74,6 @@
74 makeFailure,74 makeFailure,
75 ProcessTestsMixin,75 ProcessTestsMixin,
76 )76 )
77from lp.services.twistedsupport.xmlrpc import fix_bug_2518
78from lp.testing import (77from lp.testing import (
79 login,78 login,
80 logout,79 logout,
@@ -83,9 +82,6 @@
83from lp.testing.factory import LaunchpadObjectFactory82from lp.testing.factory import LaunchpadObjectFactory
8483
8584
86fix_bug_2518()
87
88
89class TestWorkerMonitorProtocol(ProcessTestsMixin, TestCase):85class TestWorkerMonitorProtocol(ProcessTestsMixin, TestCase):
9086
91 class StubWorkerMonitor:87 class StubWorkerMonitor:
9288
=== modified file 'lib/lp/codehosting/scanner/bzrsync.py'
--- lib/lp/codehosting/scanner/bzrsync.py 2011-02-23 01:24:09 +0000
+++ lib/lp/codehosting/scanner/bzrsync.py 2011-03-30 15:20:46 +0000
@@ -30,8 +30,8 @@
30from lp.code.interfaces.revision import IRevisionSet30from lp.code.interfaces.revision import IRevisionSet
31from lp.code.model.branchrevision import (BranchRevision)31from lp.code.model.branchrevision import (BranchRevision)
32from lp.code.model.revision import Revision32from lp.code.model.revision import Revision
33from lp.codehosting import iter_list_chunks
34from lp.codehosting.scanner import events33from lp.codehosting.scanner import events
34from lp.services.utils import iter_list_chunks
35from lp.translations.interfaces.translationtemplatesbuildjob import (35from lp.translations.interfaces.translationtemplatesbuildjob import (
36 ITranslationTemplatesBuildJobSource,36 ITranslationTemplatesBuildJobSource,
37 )37 )
3838
=== modified file 'lib/lp/services/twistedsupport/xmlrpc.py'
--- lib/lp/services/twistedsupport/xmlrpc.py 2010-11-21 14:18:50 +0000
+++ lib/lp/services/twistedsupport/xmlrpc.py 2011-03-30 15:20:46 +0000
@@ -50,28 +50,6 @@
50 method_name, *args, **kwargs)50 method_name, *args, **kwargs)
5151
5252
53class DisconnectingQueryProtocol(xmlrpc.QueryProtocol):
54
55 def connectionMade(self):
56 self._response = None
57 xmlrpc.QueryProtocol.connectionMade(self)
58
59 def handleResponse(self, contents):
60 self.transport.loseConnection()
61 self._response = contents
62
63 def connectionLost(self, reason):
64 xmlrpc.QueryProtocol.connectionLost(self, reason)
65 if self._response is not None:
66 response, self._response = self._response, None
67 self.factory.parseResponse(response)
68
69
70def fix_bug_2518():
71 # XXX: See http://twistedmatrix.com/trac/ticket/2518.
72 xmlrpc._QueryFactory.protocol = DisconnectingQueryProtocol
73
74
75def trap_fault(failure, *fault_classes):53def trap_fault(failure, *fault_classes):
76 """Trap a fault, based on fault code.54 """Trap a fault, based on fault code.
7755
7856
=== modified file 'lib/lp/services/utils.py'
--- lib/lp/services/utils.py 2011-02-20 13:26:48 +0000
+++ lib/lp/services/utils.py 2011-03-30 15:20:46 +0000
@@ -15,6 +15,7 @@
15 'compress_hash',15 'compress_hash',
16 'decorate_with',16 'decorate_with',
17 'docstring_dedent',17 'docstring_dedent',
18 'iter_list_chunks',
18 'iter_split',19 'iter_split',
19 'run_capturing_output',20 'run_capturing_output',
20 'synchronize',21 'synchronize',
@@ -119,6 +120,15 @@
119 yield splitter.join(tokens[:i]), splitter.join(tokens[i:])120 yield splitter.join(tokens[:i]), splitter.join(tokens[i:])
120121
121122
123def iter_list_chunks(a_list, size):
124 """Iterate over `a_list` in chunks of size `size`.
125
126 I'm amazed this isn't in itertools (mwhudson).
127 """
128 for i in range(0, len(a_list), size):
129 yield a_list[i:i+size]
130
131
122def synchronize(source, target, add, remove):132def synchronize(source, target, add, remove):
123 """Update 'source' to match 'target' using 'add' and 'remove'.133 """Update 'source' to match 'target' using 'add' and 'remove'.
124134