Merge ~cjwatson/launchpad:codehosting-breezy into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 932b8ea2913fc50e322b3e6ce1a05432e92bdc1b
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:codehosting-breezy
Merge into: launchpad:master
Diff against target: 4255 lines (+704/-661)
103 files modified
Makefile (+2/-2)
brzplugins/builder (+1/-0)
brzplugins/difftacular (+1/-0)
brzplugins/loom (+1/-0)
brzplugins/lpserve/__init__.py (+20/-20)
brzplugins/lpserve/test_lpserve.py (+26/-26)
constraints.txt (+5/-0)
dev/null (+0/-1)
lib/launchpad_loggerhead/app.py (+3/-3)
lib/launchpad_loggerhead/wsgi.py (+5/-5)
lib/lp/app/browser/stringformatter.py (+1/-1)
lib/lp/code/browser/bazaar.py (+3/-3)
lib/lp/code/browser/sourcepackagerecipe.py (+1/-1)
lib/lp/code/bzr.py (+23/-23)
lib/lp/code/configure.zcml (+4/-4)
lib/lp/code/errors.py (+1/-1)
lib/lp/code/interfaces/branch.py (+4/-4)
lib/lp/code/interfaces/tests/test_branch.py (+10/-10)
lib/lp/code/mail/codereviewcomment.py (+10/-13)
lib/lp/code/mail/patches.py (+15/-16)
lib/lp/code/model/branch.py (+3/-3)
lib/lp/code/model/branchjob.py (+11/-11)
lib/lp/code/model/branchlookup.py (+1/-1)
lib/lp/code/model/diff.py (+5/-5)
lib/lp/code/model/directbranchcommit.py (+5/-4)
lib/lp/code/model/gitrepository.py (+1/-1)
lib/lp/code/model/revision.py (+2/-2)
lib/lp/code/model/sourcepackagerecipedata.py (+1/-1)
lib/lp/code/model/tests/test_branch.py (+6/-6)
lib/lp/code/model/tests/test_branchjob.py (+26/-25)
lib/lp/code/model/tests/test_branchmergeproposaljobs.py (+2/-2)
lib/lp/code/model/tests/test_diff.py (+3/-3)
lib/lp/code/model/tests/test_gitref.py (+1/-1)
lib/lp/code/model/tests/test_gitrepository.py (+1/-1)
lib/lp/code/model/tests/test_sourcepackagerecipe.py (+1/-1)
lib/lp/code/scripts/tests/test_scan_branches.py (+1/-1)
lib/lp/code/scripts/tests/test_sendbranchmail.py (+5/-5)
lib/lp/code/scripts/tests/test_upgrade_branches.py (+1/-1)
lib/lp/code/stories/branches/xx-bazaar-home.txt (+9/-9)
lib/lp/code/stories/webservice/xx-branch.txt (+1/-1)
lib/lp/code/templates/bazaar-index.pt (+2/-2)
lib/lp/code/tests/helpers.py (+1/-1)
lib/lp/code/tests/test_bzr.py (+11/-10)
lib/lp/code/xmlrpc/branch.py (+1/-1)
lib/lp/code/xmlrpc/codehosting.py (+1/-1)
lib/lp/code/xmlrpc/tests/test_branch.py (+1/-1)
lib/lp/code/xmlrpc/tests/test_codehosting.py (+3/-3)
lib/lp/codehosting/__init__.py (+53/-21)
lib/lp/codehosting/bzrutils.py (+15/-15)
lib/lp/codehosting/codeimport/tests/test_worker.py (+2/-2)
lib/lp/codehosting/inmemory.py (+1/-1)
lib/lp/codehosting/puller/scheduler.py (+1/-1)
lib/lp/codehosting/puller/tests/__init__.py (+3/-3)
lib/lp/codehosting/puller/tests/test_acceptance.py (+7/-7)
lib/lp/codehosting/puller/tests/test_errors.py (+2/-2)
lib/lp/codehosting/puller/tests/test_scheduler.py (+6/-8)
lib/lp/codehosting/puller/tests/test_worker.py (+21/-21)
lib/lp/codehosting/puller/tests/test_worker_formats.py (+16/-16)
lib/lp/codehosting/puller/worker.py (+21/-16)
lib/lp/codehosting/rewrite.py (+1/-1)
lib/lp/codehosting/scanner/buglinks.py (+1/-1)
lib/lp/codehosting/scanner/bzrsync.py (+7/-7)
lib/lp/codehosting/scanner/mergedetection.py (+1/-1)
lib/lp/codehosting/scanner/tests/test_buglinks.py (+4/-4)
lib/lp/codehosting/scanner/tests/test_bzrsync.py (+8/-7)
lib/lp/codehosting/scanner/tests/test_email.py (+1/-1)
lib/lp/codehosting/scanner/tests/test_mergedetection.py (+3/-3)
lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py (+1/-1)
lib/lp/codehosting/sftp.py (+4/-4)
lib/lp/codehosting/sshserver/session.py (+20/-17)
lib/lp/codehosting/sshserver/tests/test_session.py (+16/-9)
lib/lp/codehosting/tests/helpers.py (+9/-7)
lib/lp/codehosting/tests/servers.py (+1/-1)
lib/lp/codehosting/tests/test_acceptance.py (+35/-35)
lib/lp/codehosting/tests/test_breezy.py (+5/-5)
lib/lp/codehosting/tests/test_bzrutils.py (+18/-15)
lib/lp/codehosting/tests/test_format_comparison.py (+1/-1)
lib/lp/codehosting/tests/test_lpserve.py (+6/-6)
lib/lp/codehosting/tests/test_sftp.py (+6/-6)
lib/lp/codehosting/tests/test_upgrade.py (+16/-18)
lib/lp/codehosting/upgrade.py (+9/-11)
lib/lp/codehosting/vfs/branchfs.py (+11/-13)
lib/lp/codehosting/vfs/tests/test_branchfs.py (+20/-22)
lib/lp/codehosting/vfs/tests/test_filesystem.py (+8/-8)
lib/lp/codehosting/vfs/tests/test_transport.py (+4/-4)
lib/lp/codehosting/vfs/tests/test_transport_extensions.py (+1/-1)
lib/lp/codehosting/vfs/transport.py (+29/-29)
lib/lp/scripts/runlaunchpad.py (+4/-4)
lib/lp/testing/__init__.py (+13/-11)
lib/lp/testing/factory.py (+3/-3)
lib/lp/translations/browser/productseries.py (+1/-1)
lib/lp/translations/pottery/detect_intltool.py (+1/-1)
lib/lp/translations/pottery/tests/test_detect_intltool.py (+2/-2)
lib/lp/translations/scripts/tests/test_translations_to_branch.py (+2/-2)
lib/lp/translations/scripts/translations_to_branch.py (+2/-2)
lib/lp/translations/tests/test_rosetta_branches_script.py (+3/-3)
lib/lp_sitecustomize.py (+13/-6)
scripts/mirror-branch.py (+2/-20)
scripts/update-stacked-on.py (+5/-4)
setup.py (+2/-0)
utilities/create-lp-wadl-and-apidoc.py (+3/-3)
utilities/sourcedeps.cache (+9/-9)
utilities/sourcedeps.conf (+3/-3)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+373805@code.launchpad.net

Commit message

Port codehosting to Breezy

Description of the change

Most of this is relatively mechanical: bzrlib imports become breezy imports, some things move around a little more (mainly to breezy.bzr), bzrdir becomes controldir in many cases, I tightened up some bytes/text handling, and there were a couple of other minor API changes.

Due to problems with subvertpy, codeimport remains on Bazaar for now. This entails some fiddly code to allow Bazaar and Breezy to coexist in the same codebase.

DirectBranchCommit.commit needs a new call to self.transform_preview.fixup_new_roots. I think this may technically have been needed by Bazaar too, since bzrlib.transform._alter_files calls it, but it no longer seems to be possible to get away without it.

We have to explicitly initialize Breezy in lib/lp/codehosting/__init__.py, as otherwise it initializes itself with a terminal-oriented UI, causing some unexpected output to appear in logs.

We have to disable some plugins that are now built into Breezy and likely to cause trouble if invoked, although unfortunately we have no very elegant way to do that. cvs, darcs, email, and mtn are disabled using BRZ_DISABLE_PLUGINS. git requires more work: we can't allow Breezy to even import this until codeimport is also ported, since it requires a newer version of dulwich which is incompatible with bzr-git (and that isn't particularly straightforward to fix), so I ended up stubbing it in sys.modules so that importing it has no effect. Fortunately Breezy currently only imports breezy.git and relies on it to register its own formats, so this crude strategy works.

The hack in scripts/mirror-branch.py to force bzr to use urllib is no longer required: Breezy removed pycurl support.

This is essentially the same as https://code.launchpad.net/~cjwatson/launchpad/codehosting-breezy/+merge/373020, converted to git and rebased on master.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) wrote :

looks good.

review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 62d59e2..0fc97c2 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -306,10 +306,10 @@ run_all: build inplace stop
6 memcached,rabbitmq -i $(LPCONFIG)
7
8 run_codebrowse: compile
9- BZR_PLUGIN_PATH=bzrplugins $(PY) scripts/start-loggerhead.py
10+ BRZ_PLUGIN_PATH=brzplugins $(PY) scripts/start-loggerhead.py
11
12 start_codebrowse: compile
13- BZR_PLUGIN_PATH=$(shell pwd)/bzrplugins $(PY) scripts/start-loggerhead.py --daemon
14+ BRZ_PLUGIN_PATH=$(shell pwd)/brzplugins $(PY) scripts/start-loggerhead.py --daemon
15
16 stop_codebrowse:
17 $(PY) scripts/stop-loggerhead.py
18diff --git a/brzplugins/builder b/brzplugins/builder
19new file mode 120000
20index 0000000..2877987
21--- /dev/null
22+++ b/brzplugins/builder
23@@ -0,0 +1 @@
24+../sourcecode/brz-builder/brzbuildrecipe
25\ No newline at end of file
26diff --git a/brzplugins/difftacular b/brzplugins/difftacular
27new file mode 120000
28index 0000000..e34dfd2
29--- /dev/null
30+++ b/brzplugins/difftacular
31@@ -0,0 +1 @@
32+../sourcecode/difftacular
33\ No newline at end of file
34diff --git a/brzplugins/loom b/brzplugins/loom
35new file mode 120000
36index 0000000..ed0b36f
37--- /dev/null
38+++ b/brzplugins/loom
39@@ -0,0 +1 @@
40+../sourcecode/brz-loom
41\ No newline at end of file
42diff --git a/bzrplugins/lpserve/__init__.py b/brzplugins/lpserve/__init__.py
43similarity index 97%
44rename from bzrplugins/lpserve/__init__.py
45rename to brzplugins/lpserve/__init__.py
46index 1db2554..b956568 100644
47--- a/bzrplugins/lpserve/__init__.py
48+++ b/brzplugins/lpserve/__init__.py
49@@ -28,7 +28,7 @@ import tempfile
50 import threading
51 import time
52
53-from bzrlib import (
54+from breezy import (
55 commands,
56 errors,
57 lockdir,
58@@ -36,15 +36,15 @@ from bzrlib import (
59 trace,
60 ui,
61 )
62-from bzrlib.commands import (
63+from breezy.commands import (
64 Command,
65 register_command,
66 )
67-from bzrlib.option import (
68+from breezy.option import (
69 Option,
70 RegistryOption,
71 )
72-from bzrlib.transport import (
73+from breezy.transport import (
74 get_transport,
75 transport_server_registry,
76 )
77@@ -88,7 +88,7 @@ class cmd_launchpad_server(Command):
78 type=unicode),
79 RegistryOption(
80 'protocol', help="Protocol to serve.",
81- lazy_registry=('bzrlib.transport', 'transport_server_registry'),
82+ lazy_registry=('breezy.transport', 'transport_server_registry'),
83 value_switches=True),
84 ]
85
86@@ -192,7 +192,7 @@ class LPForkingService(object):
87 that should be reset.
88
89 fork-env allows you to supply environment variables such as
90- "BZR_EMAIL: joe@foo.com" which will be set in os.environ before
91+ "BRZ_EMAIL: joe@foo.com" which will be set in os.environ before
92 the command is run.
93 """
94
95@@ -301,9 +301,9 @@ class LPForkingService(object):
96 # don't know any way to *remove* a function registered via
97 # 'atexit()' so if the forking service has some state, we my try to
98 # clean it up incorrectly.
99- # Note that the bzr script itself uses sys.exitfunc(); os._exit() in
100- # the 'bzr' main script, as the teardown time of all the python
101- # state was quite noticeable in real-world runtime. As such, bzrlib
102+ # Note that the brz script itself uses sys.exitfunc(); os._exit() in
103+ # the 'brz' main script, as the teardown time of all the python
104+ # state was quite noticeable in real-world runtime. As such, breezy
105 # should be pretty safe, or it would have been failing for people
106 # already.
107 # [Decision #7]
108@@ -483,7 +483,7 @@ class LPForkingService(object):
109 os.rmdir(base_path)
110
111 def _bind_child_file_descriptors(self, base_path):
112- # Note: by this point bzrlib has opened stderr for logging
113+ # Note: by this point breezy has opened stderr for logging
114 # (as part of starting the service process in the first place).
115 # As such, it has a stream handler that writes to stderr.
116 # logging tries to flush and close that, but the file is already
117@@ -975,16 +975,16 @@ register_command(cmd_launchpad_replay)
118 # manually, and observe what was expensive to import. It doesn't seem
119 # very easy to get this right automatically.
120 libraries_to_preload = [
121- 'bzrlib.errors',
122- 'bzrlib.repofmt.groupcompress_repo',
123- 'bzrlib.repository',
124- 'bzrlib.smart',
125- 'bzrlib.smart.protocol',
126- 'bzrlib.smart.request',
127- 'bzrlib.smart.server',
128- 'bzrlib.smart.vfs',
129- 'bzrlib.transport.local',
130- 'bzrlib.transport.readonly',
131+ 'breezy.bzr.groupcompress_repo',
132+ 'breezy.bzr.smart',
133+ 'breezy.bzr.smart.protocol',
134+ 'breezy.bzr.smart.request',
135+ 'breezy.bzr.smart.server',
136+ 'breezy.bzr.smart.vfs',
137+ 'breezy.errors',
138+ 'breezy.repository',
139+ 'breezy.transport.local',
140+ 'breezy.transport.readonly',
141 'lp.codehosting.bzrutils',
142 'lp.codehosting.vfs',
143 'lp.codehosting.vfs.branchfs',
144diff --git a/bzrplugins/lpserve/test_lpserve.py b/brzplugins/lpserve/test_lpserve.py
145similarity index 96%
146rename from bzrplugins/lpserve/test_lpserve.py
147rename to brzplugins/lpserve/test_lpserve.py
148index 6879ee6..3801df4 100644
149--- a/bzrplugins/lpserve/test_lpserve.py
150+++ b/brzplugins/lpserve/test_lpserve.py
151@@ -11,18 +11,18 @@ import tempfile
152 import threading
153 import time
154
155-from bzrlib import (
156+from breezy import (
157 errors,
158 osutils,
159 tests,
160 trace,
161 )
162-from bzrlib.plugins import lpserve
163+from breezy.plugins import lpserve
164 from testtools import content
165
166 from lp.codehosting import (
167- get_bzr_path,
168- get_BZR_PLUGIN_PATH_for_subprocess,
169+ get_brz_path,
170+ get_BRZ_PLUGIN_PATH_for_subprocess,
171 )
172 from lp.testing.fakemethod import FakeMethod
173
174@@ -187,13 +187,13 @@ class TestLPForkingServiceParseEnv(tests.TestCase):
175 self.assertEnv({}, 'end\n')
176
177 def test_one_entries(self):
178- self.assertEnv({'BZR_EMAIL': 'joe@foo.com'},
179- 'BZR_EMAIL: joe@foo.com\n'
180+ self.assertEnv({'BRZ_EMAIL': 'joe@foo.com'},
181+ 'BRZ_EMAIL: joe@foo.com\n'
182 'end\n')
183
184 def test_two_entries(self):
185- self.assertEnv({'BZR_EMAIL': 'joe@foo.com', 'BAR': 'foo'},
186- 'BZR_EMAIL: joe@foo.com\n'
187+ self.assertEnv({'BRZ_EMAIL': 'joe@foo.com', 'BAR': 'foo'},
188+ 'BRZ_EMAIL: joe@foo.com\n'
189 'BAR: foo\n'
190 'end\n')
191
192@@ -201,10 +201,10 @@ class TestLPForkingServiceParseEnv(tests.TestCase):
193 self.assertInvalid('')
194
195 def test_invalid_end(self):
196- self.assertInvalid("BZR_EMAIL: joe@foo.com\n")
197+ self.assertInvalid("BRZ_EMAIL: joe@foo.com\n")
198
199 def test_invalid_entry(self):
200- self.assertInvalid("BZR_EMAIL joe@foo.com\nend\n")
201+ self.assertInvalid("BRZ_EMAIL joe@foo.com\nend\n")
202
203
204 class TestLPForkingService(TestCaseWithLPForkingService):
205@@ -238,19 +238,19 @@ class TestLPForkingService(TestCaseWithLPForkingService):
206 def test_send_fork_env_with_env(self):
207 response = self.send_message_to_service(
208 'fork-env rocks\n'
209- 'BZR_EMAIL: joe@example.com\n'
210+ 'BRZ_EMAIL: joe@example.com\n'
211 'end\n')
212 self.assertEqual('ok\nfake forking\n', response)
213- self.assertEqual([(['rocks'], {'BZR_EMAIL': 'joe@example.com'})],
214+ self.assertEqual([(['rocks'], {'BRZ_EMAIL': 'joe@example.com'})],
215 self.service.fork_log)
216
217 def test_send_fork_env_slowly(self):
218 response = self.send_message_to_service(
219 'fork-env rocks\n'
220- 'BZR_EMAIL: joe@example.com\n'
221+ 'BRZ_EMAIL: joe@example.com\n'
222 'end\n', one_byte_at_a_time=True)
223 self.assertEqual('ok\nfake forking\n', response)
224- self.assertEqual([(['rocks'], {'BZR_EMAIL': 'joe@example.com'})],
225+ self.assertEqual([(['rocks'], {'BRZ_EMAIL': 'joe@example.com'})],
226 self.service.fork_log)
227
228 def test_send_incomplete_fork_env_timeout(self):
229@@ -258,7 +258,7 @@ class TestLPForkingService(TestCaseWithLPForkingService):
230 # content
231 response = self.send_message_to_service(
232 'fork-env rocks\n'
233- 'BZR_EMAIL: joe@example.com\n',
234+ 'BRZ_EMAIL: joe@example.com\n',
235 one_byte_at_a_time=True)
236 # Note that we *don't* send a final 'end\n'
237 self.assertStartsWith(response, 'FAILURE\n')
238@@ -315,24 +315,24 @@ class TestCaseWithSubprocess(tests.TestCaseWithTransport):
239 The launchpad infrastructure requires a fair amount of configuration to
240 get paths, etc correct. This provides a "start_bzr_subprocess" command
241 that has all of those paths appropriately set, but otherwise functions the
242- same as the bzrlib.tests.TestCase version.
243+ same as the breezy.tests.TestCase version.
244 """
245
246 def start_bzr_subprocess(self, process_args, env_changes=None,
247 working_dir=None):
248 """Start bzr in a subprocess for testing.
249
250- Copied and modified from `bzrlib.tests.TestCase.start_bzr_subprocess`.
251+ Copied and modified from `breezy.tests.TestCase.start_bzr_subprocess`.
252 This version removes some of the skipping stuff, some of the
253 irrelevant comments (e.g. about win32) and uses Launchpad's own
254- mechanisms for getting the path to 'bzr'.
255+ mechanisms for getting the path to 'brz'.
256
257 Comments starting with 'LAUNCHPAD' are comments about our
258 modifications.
259 """
260 if env_changes is None:
261 env_changes = {}
262- env_changes['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()
263+ env_changes['BRZ_PLUGIN_PATH'] = get_BRZ_PLUGIN_PATH_for_subprocess()
264 old_env = {}
265
266 def cleanup_environment():
267@@ -348,12 +348,12 @@ class TestCaseWithSubprocess(tests.TestCaseWithTransport):
268 cwd = osutils.getcwd()
269 os.chdir(working_dir)
270
271- # LAUNCHPAD: We can't use self.get_bzr_path(), since it'll find
272- # lib/bzrlib, rather than the path to bin/bzr.
273- bzr_path = get_bzr_path()
274+ # LAUNCHPAD: We can't use self.get_brz_path(), since it'll find
275+ # lib/breezy, rather than the path to bin/brz.
276+ brz_path = get_brz_path()
277 try:
278 cleanup_environment()
279- command = [bzr_path]
280+ command = [brz_path]
281 command.extend(process_args)
282 process = self._popen(
283 command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
284@@ -464,8 +464,8 @@ class TestCaseWithLPForkingServiceSubprocess(TestCaseWithSubprocess):
285 # The service wants to create this file as a socket.
286 os.remove(path)
287 env_changes = {
288- 'BZR_PLUGIN_PATH': lpserve.__path__[0],
289- 'BZR_LOG': tempname,
290+ 'BRZ_PLUGIN_PATH': lpserve.__path__[0],
291+ 'BRZ_LOG': tempname,
292 }
293 proc = self._start_subprocess(path, env_changes)
294 return proc, path
295@@ -579,7 +579,7 @@ class TestLPServiceInSubprocess(TestCaseWithLPForkingServiceSubprocess):
296
297 def test_fork_respects_env_vars(self):
298 path, pid, sock = self.send_fork_request('whoami',
299- env={'BZR_EMAIL': 'this_test@example.com'})
300+ env={'BRZ_EMAIL': 'this_test@example.com'})
301 stdout_content, stderr_content = self.communicate_with_fork(path)
302 self.assertEqual('', stderr_content)
303 self.assertEqual('this_test@example.com\n', stdout_content)
304diff --git a/bzrplugins/builder b/bzrplugins/builder
305deleted file mode 120000
306index 733b41e..0000000
307--- a/bzrplugins/builder
308+++ /dev/null
309@@ -1 +0,0 @@
310-../sourcecode/bzr-builder/
311\ No newline at end of file
312diff --git a/bzrplugins/difftacular b/bzrplugins/difftacular
313deleted file mode 120000
314index 7129510..0000000
315--- a/bzrplugins/difftacular
316+++ /dev/null
317@@ -1 +0,0 @@
318-../sourcecode/difftacular/
319\ No newline at end of file
320diff --git a/bzrplugins/loom b/bzrplugins/loom
321deleted file mode 120000
322index 68f0573..0000000
323--- a/bzrplugins/loom
324+++ /dev/null
325@@ -1 +0,0 @@
326-../sourcecode/bzr-loom
327\ No newline at end of file
328diff --git a/constraints.txt b/constraints.txt
329index 6a7b6c3..fccf0fa 100644
330--- a/constraints.txt
331+++ b/constraints.txt
332@@ -176,11 +176,14 @@ backports.lzma==0.0.3
333 BeautifulSoup==3.2.1
334 beautifulsoup4[lxml]==4.7.1
335 billiard==3.5.0.5
336+bleach==3.1.0
337+breezy==3.0.1
338 bson==0.3.3
339 # lp:~launchpad/bzr/lp
340 bzr==2.6.0.lp.4
341 celery==4.1.1
342 Chameleon==2.11
343+configobj==5.0.6
344 constantly==15.1.0
345 cookies==2.2.1
346 cryptography==2.7
347@@ -197,6 +200,7 @@ eggtestinfo==0.3
348 elementtree==1.2.6-20050316
349 enum34==1.1.6
350 epydoc==3.0.1
351+fastimport==0.9.8
352 feedparser==5.2.1
353 feedvalidator==0.0.0DEV-r1049
354 FormEncode==1.2.4
355@@ -310,6 +314,7 @@ vine==1.1.4
356 virtualenv-tools3==2.0.0
357 wadllib==1.3.2
358 waitress==1.3.1
359+webencodings==0.5.1
360 WebOb==1.8.5
361 WebTest==2.0.33
362 wheel==0.29.0
363diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py
364index ce24213..cd98725 100644
365--- a/lib/launchpad_loggerhead/app.py
366+++ b/lib/launchpad_loggerhead/app.py
367@@ -8,13 +8,13 @@ import urllib
368 import urlparse
369 import xmlrpclib
370
371-from bzrlib import (
372+from breezy import (
373 errors,
374 lru_cache,
375 urlutils,
376 )
377-from bzrlib.transport import get_transport
378-from bzrlib.url_policy_open import open_only_scheme
379+from breezy.transport import get_transport
380+from breezy.url_policy_open import open_only_scheme
381 from loggerhead.apps import (
382 favicon_app,
383 static_app,
384diff --git a/lib/launchpad_loggerhead/wsgi.py b/lib/launchpad_loggerhead/wsgi.py
385index e8822b1..ca95aef 100644
386--- a/lib/launchpad_loggerhead/wsgi.py
387+++ b/lib/launchpad_loggerhead/wsgi.py
388@@ -153,16 +153,16 @@ class LoggerheadApplication(Application):
389 cfg.update(self.options)
390 return cfg
391
392- def _load_bzr_plugins(self):
393- from bzrlib.plugin import load_plugins
394+ def _load_brz_plugins(self):
395+ from breezy.plugin import load_plugins
396 load_plugins()
397
398- import bzrlib.plugins
399- if getattr(bzrlib.plugins, "loom", None) is None:
400+ import breezy.plugins
401+ if getattr(breezy.plugins, "loom", None) is None:
402 log.error("Loom plugin loading failed.")
403
404 def load(self):
405- self._load_bzr_plugins()
406+ self._load_brz_plugins()
407
408 with open(os.path.join(
409 config.root, config.codebrowse.secret_path)) as secret_file:
410diff --git a/lib/lp/app/browser/stringformatter.py b/lib/lp/app/browser/stringformatter.py
411index 1198a83..57b8eaf 100644
412--- a/lib/lp/app/browser/stringformatter.py
413+++ b/lib/lp/app/browser/stringformatter.py
414@@ -21,7 +21,7 @@ from itertools import izip_longest
415 import re
416 import sys
417
418-from bzrlib.patches import hunk_from_header
419+from breezy.patches import hunk_from_header
420 from lxml import html
421 import markdown
422 from zope.component import getUtility
423diff --git a/lib/lp/code/browser/bazaar.py b/lib/lp/code/browser/bazaar.py
424index 26b34dc..305c740 100644
425--- a/lib/lp/code/browser/bazaar.py
426+++ b/lib/lp/code/browser/bazaar.py
427@@ -12,7 +12,7 @@ __all__ = [
428
429 from datetime import datetime
430
431-import bzrlib
432+import breezy
433 from zope.component import getUtility
434
435 from lp.code.enums import CodeImportReviewStatus
436@@ -51,8 +51,8 @@ class BazaarApplicationView(LaunchpadView):
437 review_status=CodeImportReviewStatus.REVIEWED).count()
438
439 @property
440- def bzr_version(self):
441- return bzrlib.__version__
442+ def brz_version(self):
443+ return breezy.__version__
444
445 def _precacheViewPermissions(self, branches):
446 """Precache the launchpad.View permissions on the branches."""
447diff --git a/lib/lp/code/browser/sourcepackagerecipe.py b/lib/lp/code/browser/sourcepackagerecipe.py
448index a16f29b..d712879 100644
449--- a/lib/lp/code/browser/sourcepackagerecipe.py
450+++ b/lib/lp/code/browser/sourcepackagerecipe.py
451@@ -17,7 +17,7 @@ __all__ = [
452
453 import itertools
454
455-from bzrlib.plugins.builder.recipe import (
456+from breezy.plugins.builder.recipe import (
457 ForbiddenInstructionError,
458 RecipeParseError,
459 )
460diff --git a/lib/lp/code/bzr.py b/lib/lp/code/bzr.py
461index 10683e1..fe1a7d8 100644
462--- a/lib/lp/code/bzr.py
463+++ b/lib/lp/code/bzr.py
464@@ -24,53 +24,53 @@ import lp.codehosting
465 # Silence lint warning.
466 lp.codehosting
467
468-from bzrlib.branch import (
469+from breezy.branch import UnstackableBranchFormat
470+from breezy.bzr.branch import (
471 BranchReferenceFormat,
472 BzrBranchFormat6,
473 BzrBranchFormat7,
474 )
475-from bzrlib.branchfmt.fullhistory import BzrBranchFormat5
476-from bzrlib.bzrdir import (
477+from breezy.bzr.bzrdir import (
478 BzrDirMetaFormat1,
479 BzrDirMetaFormat1Colo,
480 )
481-from bzrlib.errors import (
482+from breezy.bzr.fullhistory import BzrBranchFormat5
483+from breezy.bzr.groupcompress_repo import RepositoryFormat2a
484+from breezy.bzr.knitpack_repo import (
485+ RepositoryFormatKnitPack1,
486+ RepositoryFormatKnitPack3,
487+ RepositoryFormatKnitPack4,
488+ RepositoryFormatKnitPack5,
489+ )
490+from breezy.bzr.knitrepo import (
491+ RepositoryFormatKnit1,
492+ RepositoryFormatKnit3,
493+ RepositoryFormatKnit4,
494+ )
495+from breezy.errors import (
496 NotStacked,
497 NoSuchRevision,
498- UnstackableBranchFormat,
499 )
500-from bzrlib.plugins.loom.branch import (
501+from breezy.plugins.loom.branch import (
502 BzrBranchLoomFormat1,
503 BzrBranchLoomFormat6,
504 )
505-from bzrlib.plugins.weave_fmt.branch import BzrBranchFormat4
506-from bzrlib.plugins.weave_fmt.bzrdir import (
507+from breezy.plugins.weave_fmt.branch import BzrBranchFormat4
508+from breezy.plugins.weave_fmt.bzrdir import (
509 BzrDirFormat4,
510 BzrDirFormat5,
511 BzrDirFormat6,
512 )
513-from bzrlib.plugins.weave_fmt.repository import (
514+from breezy.plugins.weave_fmt.repository import (
515 RepositoryFormat4,
516 RepositoryFormat5,
517 RepositoryFormat6,
518 RepositoryFormat7,
519 )
520-from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
521-from bzrlib.repofmt.knitpack_repo import (
522- RepositoryFormatKnitPack1,
523- RepositoryFormatKnitPack3,
524- RepositoryFormatKnitPack4,
525- RepositoryFormatKnitPack5,
526- )
527-from bzrlib.revision import (
528+from breezy.revision import (
529 is_null,
530 NULL_REVISION,
531 )
532-from bzrlib.repofmt.knitrepo import (
533- RepositoryFormatKnit1,
534- RepositoryFormatKnit3,
535- RepositoryFormatKnit4,
536- )
537 from lazr.enum import (
538 DBEnumeratedType,
539 DBItem,
540@@ -305,7 +305,7 @@ def get_branch_formats(bzr_branch):
541
542 :returns: tuple of (ControlFormat, BranchFormat, RepositoryFormat)
543 """
544- control_string = bzr_branch.bzrdir._format.get_format_string()
545+ control_string = bzr_branch.controldir._format.get_format_string()
546 branch_string = bzr_branch._format.get_format_string()
547 repository_string = bzr_branch.repository._format.get_format_string()
548 return (ControlFormat.get_enum(control_string),
549diff --git a/lib/lp/code/configure.zcml b/lib/lp/code/configure.zcml
550index 0ae4a3c..0a3537e 100644
551--- a/lib/lp/code/configure.zcml
552+++ b/lib/lp/code/configure.zcml
553@@ -1191,19 +1191,19 @@
554 />
555 </class>
556 <class
557- class="bzrlib.plugins.builder.recipe.BaseRecipeBranch">
558+ class="breezy.plugins.builder.recipe.BaseRecipeBranch">
559 <allow attributes="name url revspec revid child_branches deb_version __str__" />
560 </class>
561 <class
562- class="bzrlib.plugins.builder.recipe.RecipeBranch">
563+ class="breezy.plugins.builder.recipe.RecipeBranch">
564 <allow attributes="name url revspec revid child_branches __str__" />
565 </class>
566 <class
567- class="bzrlib.plugins.builder.recipe.MergeInstruction">
568+ class="breezy.plugins.builder.recipe.MergeInstruction">
569 <allow attributes="as_tuple recipe_branch nest_path" />
570 </class>
571 <class
572- class="bzrlib.plugins.builder.recipe.NestInstruction">
573+ class="breezy.plugins.builder.recipe.NestInstruction">
574 <allow attributes="as_tuple recipe_branch nest_path" />
575 </class>
576
577diff --git a/lib/lp/code/errors.py b/lib/lp/code/errors.py
578index 22f6e16..c68da65 100644
579--- a/lib/lp/code/errors.py
580+++ b/lib/lp/code/errors.py
581@@ -66,7 +66,7 @@ __all__ = [
582
583 import httplib
584
585-from bzrlib.plugins.builder.recipe import RecipeParseError
586+from breezy.plugins.builder.recipe import RecipeParseError
587 from lazr.restful.declarations import error_status
588 import six
589
590diff --git a/lib/lp/code/interfaces/branch.py b/lib/lp/code/interfaces/branch.py
591index 2d20376..29d5fdf 100644
592--- a/lib/lp/code/interfaces/branch.py
593+++ b/lib/lp/code/interfaces/branch.py
594@@ -512,7 +512,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
595
596 They are ordered with the most recent revision first, and the list
597 only contains those in the "leftmost tree", or in other words
598- the revisions that match the revision history from bzrlib for this
599+ the revisions that match the revision history from breezy for this
600 branch.
601
602 The revisions are listed as tuples of (`BranchRevision`, `Revision`).
603@@ -719,7 +719,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
604 """Construct a URL for this branch in codebrowse.
605
606 :param extras: Zero or more path segments that will be joined onto the
607- end of the URL (with `bzrlib.urlutils.join`).
608+ end of the URL (with `breezy.urlutils.join`).
609 """
610
611 browse_source_url = Attribute(
612@@ -993,7 +993,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
613 :return: tuple of three items.
614 1. Ancestry set of bzr revision-ids.
615 2. History list of bzr revision-ids. Similar to the result of
616- bzrlib.Branch.revision_history().
617+ breezy.Branch.revision_history().
618 3. Dictionnary mapping bzr bzr revision-ids to the database ids of
619 the corresponding BranchRevision rows for this branch.
620 """
621@@ -1012,7 +1012,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
622 You can only call this if a server returned by `get_ro_server` or
623 `get_rw_server` is running.
624
625- :raise bzrlib.url_policy_open.BadUrl: If the branch is stacked
626+ :raise breezy.url_policy_open.BadUrl: If the branch is stacked
627 on or a reference to an unacceptable URL.
628 """
629
630diff --git a/lib/lp/code/interfaces/tests/test_branch.py b/lib/lp/code/interfaces/tests/test_branch.py
631index af02ded..2eaab2f 100644
632--- a/lib/lp/code/interfaces/tests/test_branch.py
633+++ b/lib/lp/code/interfaces/tests/test_branch.py
634@@ -5,9 +5,9 @@
635
636 __metaclass__ = type
637
638-from bzrlib.branch import format_registry as branch_format_registry
639-from bzrlib.bzrdir import BzrProber
640-from bzrlib.repository import format_registry as repo_format_registry
641+from breezy.branch import format_registry as branch_format_registry
642+from breezy.bzr import BzrProber
643+from breezy.repository import format_registry as repo_format_registry
644
645 from lp.code.bzr import (
646 BranchFormat,
647@@ -27,21 +27,21 @@ class TestFormatSupport(TestCase):
648 """
649
650 def test_control_format_complement(self):
651- self.bzrlib_is_subset(BzrProber.formats.keys(), ControlFormat)
652+ self.breezy_is_subset(BzrProber.formats.keys(), ControlFormat)
653
654 def test_branch_format_complement(self):
655- self.bzrlib_is_subset(branch_format_registry.keys(), BranchFormat)
656+ self.breezy_is_subset(branch_format_registry.keys(), BranchFormat)
657
658 def test_repository_format_complement(self):
659- self.bzrlib_is_subset(repo_format_registry.keys(), RepositoryFormat)
660+ self.breezy_is_subset(repo_format_registry.keys(), RepositoryFormat)
661
662- def bzrlib_is_subset(self, bzrlib_formats, launchpad_enum):
663- """Ensure the bzr format marker list is a subset of launchpad."""
664- bzrlib_format_strings = set(bzrlib_formats)
665+ def breezy_is_subset(self, breezy_formats, launchpad_enum):
666+ """Ensure the Breezy format marker list is a subset of Launchpad."""
667+ breezy_format_strings = set(breezy_formats)
668 launchpad_format_strings = set(format.title for format
669 in launchpad_enum.items)
670 self.assertEqual(
671- set(), bzrlib_format_strings.difference(launchpad_format_strings))
672+ set(), breezy_format_strings.difference(launchpad_format_strings))
673
674 def test_repositoryDescriptions(self):
675 self.checkDescriptions(RepositoryFormat)
676diff --git a/lib/lp/code/mail/codereviewcomment.py b/lib/lp/code/mail/codereviewcomment.py
677index 62706be..760d923 100644
678--- a/lib/lp/code/mail/codereviewcomment.py
679+++ b/lib/lp/code/mail/codereviewcomment.py
680@@ -10,7 +10,7 @@ __all__ = [
681 'CodeReviewCommentMailer',
682 ]
683
684-from bzrlib.patches import BinaryPatch
685+from breezy.patches import BinaryPatch
686 from zope.component import getUtility
687 from zope.security.proxy import removeSecurityProxy
688
689@@ -174,9 +174,9 @@ def format_comment(comment):
690 """Returns a list of correctly formatted comment(s)."""
691 comment_lines = []
692 if comment is not None:
693- comment_lines.append('')
694+ comment_lines.append(b'')
695 comment_lines.extend(comment.splitlines())
696- comment_lines.append('')
697+ comment_lines.append(b'')
698 return comment_lines
699
700
701@@ -201,7 +201,7 @@ def build_inline_comments_section(comments, diff_text):
702
703 if isinstance(patch, dict) and 'dirty_head' in patch:
704 for line in patch['dirty_head']:
705- dirty_head.append(u'> %s' % line.rstrip('\n'))
706+ dirty_head.append(b'> %s' % line.rstrip(b'\n'))
707 line_count += 1 # inc for dirty headers
708 comment = comments.get(str(line_count))
709 if comment:
710@@ -213,7 +213,7 @@ def build_inline_comments_section(comments, diff_text):
711 if type(patch) is BinaryPatch:
712 if dirty_comment:
713 result_lines.extend(dirty_head)
714- result_lines.append(u'> %s' % str(patch).rstrip('\n'))
715+ result_lines.append(b'> %s' % patch.as_bytes().rstrip(b'\n'))
716 line_count += 1
717 comment = comments.get(str(line_count))
718 if comment:
719@@ -224,7 +224,7 @@ def build_inline_comments_section(comments, diff_text):
720 line_count += 1 # inc patch headers
721 comment = comments.get(str(line_count))
722
723- patch_lines.append('> {0}'.format(ph))
724+ patch_lines.append(b'> %s' % ph)
725 if comment:
726 patch_lines.extend(format_comment(comment))
727 patch_comment = True
728@@ -236,8 +236,7 @@ def build_inline_comments_section(comments, diff_text):
729
730 # add context line (hunk header)
731 line_count += 1 # inc hunk context line
732- hunk_lines.append(u'> %s' % hunk.get_header().rstrip('\n').decode(
733- 'utf-8', 'replace'))
734+ hunk_lines.append(b'> %s' % hunk.get_header().rstrip(b'\n'))
735
736 # comment for context line (hunk header)
737 comment = comments.get(str(line_count))
738@@ -248,11 +247,9 @@ def build_inline_comments_section(comments, diff_text):
739 for hunk_line in hunk.lines:
740 # A single HunkLine can actually represent multiple
741 # lines in the "No newline at end of file" case.
742- hunk_line = str(hunk_line)
743- for line in hunk_line.splitlines():
744+ for line in hunk_line.as_bytes().splitlines():
745 line_count += 1 # inc hunk lines
746- hunk_lines.append(u'> %s' % line.rstrip('\n').decode(
747- 'utf-8', 'replace'))
748+ hunk_lines.append(b'> %s' % line.rstrip(b'\n'))
749 comment = comments.get(str(line_count))
750 if comment:
751 hunk_lines.extend(format_comment(comment))
752@@ -270,5 +267,5 @@ def build_inline_comments_section(comments, diff_text):
753 elif dirty_comment:
754 result_lines.extend(dirty_head)
755
756- result_text = '\n'.join(result_lines)
757+ result_text = b'\n'.join(result_lines).decode('UTF-8', errors='replace')
758 return '\n\nDiff comments:\n\n%s\n\n' % result_text
759diff --git a/lib/lp/code/mail/patches.py b/lib/lp/code/mail/patches.py
760index 5b5ccac..11e655d 100644
761--- a/lib/lp/code/mail/patches.py
762+++ b/lib/lp/code/mail/patches.py
763@@ -1,4 +1,4 @@
764-# This file was partially cloned from bzr-2.6.0-lp-3 (bzrlib.patches) and
765+# This file was partially cloned from breezy 3.0.0 (breezy.patches) and
766 # customised for LP.
767 #
768 # Copyright (C) 2005-2010 Aaron Bentley, Canonical Ltd
769@@ -20,7 +20,7 @@
770
771 from __future__ import absolute_import
772
773-from bzrlib.patches import (
774+from breezy.patches import (
775 binary_files_re,
776 hunk_from_header,
777 parse_patch,
778@@ -50,10 +50,10 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
779 beginning = True
780 in_git_patch = False
781
782- dirty_headers = ('=== ', 'diff ', 'index ')
783+ dirty_headers = (b'=== ', b'diff ', b'index ')
784 for line in iter_lines:
785 # preserve bzr modified/added headers and blank lines
786- if line.startswith(dirty_headers) or not line.strip('\n'):
787+ if line.startswith(dirty_headers) or not line.strip(b'\n'):
788 if len(saved_lines) > 0:
789 if keep_dirty and len(dirty_head) > 0:
790 yield {'saved_lines': saved_lines,
791@@ -63,7 +63,7 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
792 yield saved_lines
793 in_git_patch = False
794 saved_lines = []
795- if line.startswith('diff --git'):
796+ if line.startswith(b'diff --git'):
797 in_git_patch = True
798 dirty_head.append(line)
799 continue
800@@ -73,14 +73,14 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
801 # in the patch before the next "diff" header line can do so.
802 dirty_head.append(line)
803 continue
804- if line.startswith('*** '):
805+ if line.startswith(b'*** '):
806 continue
807- if line.startswith('#'):
808+ if line.startswith(b'#'):
809 continue
810 elif orig_range > 0:
811- if line.startswith('-') or line.startswith(' '):
812+ if line.startswith(b'-') or line.startswith(b' '):
813 orig_range -= 1
814- elif line.startswith('--- ') or regex.match(line):
815+ elif line.startswith(b'--- ') or regex.match(line):
816 if allow_dirty and beginning:
817 # Patches can have "junk" at the beginning
818 # Stripping junk from the end of patches is handled when we
819@@ -95,7 +95,7 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
820 yield saved_lines
821 in_git_patch = False
822 saved_lines = []
823- elif line.startswith('@@'):
824+ elif line.startswith(b'@@'):
825 hunk = hunk_from_header(line)
826 orig_range = hunk.orig_range
827 saved_lines.append(line)
828@@ -116,12 +116,11 @@ def parse_patches(iter_lines, allow_dirty=False, keep_dirty=False):
829 :kwarg keep_dirty: If True, returns a dict of patches with dirty headers.
830 Default False.
831 '''
832- patches = []
833 for patch_lines in iter_file_patch(iter_lines, allow_dirty, keep_dirty):
834 if 'dirty_head' in patch_lines:
835- patches.append({'patch': parse_patch(
836- patch_lines['saved_lines'], allow_dirty),
837- 'dirty_head': patch_lines['dirty_head']})
838+ yield {
839+ 'patch': parse_patch(patch_lines['saved_lines'], allow_dirty),
840+ 'dirty_head': patch_lines['dirty_head'],
841+ }
842 else:
843- patches.append(parse_patch(patch_lines, allow_dirty))
844- return patches
845+ yield parse_patch(patch_lines, allow_dirty)
846diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
847index 691b0c9..c95247a 100644
848--- a/lib/lp/code/model/branch.py
849+++ b/lib/lp/code/model/branch.py
850@@ -14,9 +14,9 @@ import json
851 import operator
852 import os.path
853
854-from bzrlib import urlutils
855-from bzrlib.revision import NULL_REVISION
856-from bzrlib.url_policy_open import open_only_scheme
857+from breezy import urlutils
858+from breezy.revision import NULL_REVISION
859+from breezy.url_policy_open import open_only_scheme
860 from lazr.lifecycle.event import ObjectCreatedEvent
861 import pytz
862 import six
863diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
864index 38a961f..8cf99c9 100644
865--- a/lib/lp/code/model/branchjob.py
866+++ b/lib/lp/code/model/branchjob.py
867@@ -19,20 +19,20 @@ import shutil
868 from StringIO import StringIO
869 import tempfile
870
871-from bzrlib.branch import Branch as BzrBranch
872-from bzrlib.diff import show_diff_trees
873-from bzrlib.errors import (
874+from breezy.branch import Branch as BzrBranch
875+from breezy.diff import show_diff_trees
876+from breezy.errors import (
877 NoSuchFile,
878 NotBranchError,
879 )
880-from bzrlib.log import (
881+from breezy.log import (
882 log_formatter,
883 show_log,
884 )
885-from bzrlib.revision import NULL_REVISION
886-from bzrlib.revisionspec import RevisionInfo
887-from bzrlib.transport import get_transport
888-from bzrlib.upgrade import upgrade
889+from breezy.revision import NULL_REVISION
890+from breezy.revisionspec import RevisionInfo
891+from breezy.transport import get_transport
892+from breezy.upgrade import upgrade
893 from lazr.delegates import delegate_to
894 from lazr.enum import (
895 DBEnumeratedType,
896@@ -533,7 +533,7 @@ class RevisionsAddedJob(BranchJobDerived):
897 repository = self.bzr_branch.repository
898 added_revisions = repository.get_graph().find_unique_ancestors(
899 self.last_revision_id, [self.last_scanned_id])
900- # Avoid hitting the database since bzrlib makes it easy to check.
901+ # Avoid hitting the database since breezy makes it easy to check.
902 # There are possibly more efficient ways to get the mainline
903 # revisions, but this is simple and it works.
904 history = branch_revision_history(self.bzr_branch)
905@@ -625,7 +625,7 @@ class RevisionsAddedJob(BranchJobDerived):
906 """Determine which revisions were merged by this revision.
907
908 :param revision_id: ID of the revision to examine.
909- :param graph: a bzrlib.graph.Graph.
910+ :param graph: a breezy.graph.Graph.
911 :return: a set of revision IDs.
912 """
913 parents = graph.get_parent_map([revision_id])[revision_id]
914@@ -901,7 +901,7 @@ class RosettaUploadJob(BranchJobDerived):
915 continue
916 file_id, (from_path, to_path) = changed_file[:2]
917 changed_files.append((
918- to_path, to_tree.get_file_text(file_id)))
919+ to_path, to_tree.get_file_text(to_path)))
920 finally:
921 from_tree.unlock()
922 finally:
923diff --git a/lib/lp/code/model/branchlookup.py b/lib/lp/code/model/branchlookup.py
924index 18d8744..b0012e7 100644
925--- a/lib/lp/code/model/branchlookup.py
926+++ b/lib/lp/code/model/branchlookup.py
927@@ -9,7 +9,7 @@ __metaclass__ = type
928 __all__ = []
929
930
931-from bzrlib.urlutils import escape
932+from breezy.urlutils import escape
933 from lazr.enum import DBItem
934 from lazr.uri import (
935 InvalidURIError,
936diff --git a/lib/lp/code/model/diff.py b/lib/lp/code/model/diff.py
937index ac8d525..500dd5c 100644
938--- a/lib/lp/code/model/diff.py
939+++ b/lib/lp/code/model/diff.py
940@@ -16,14 +16,14 @@ from operator import attrgetter
941 import sys
942 from uuid import uuid1
943
944-from bzrlib import trace
945-from bzrlib.diff import show_diff_trees
946-from bzrlib.merge import Merge3Merger
947-from bzrlib.patches import (
948+from breezy import trace
949+from breezy.diff import show_diff_trees
950+from breezy.merge import Merge3Merger
951+from breezy.patches import (
952 parse_patches,
953 Patch,
954 )
955-from bzrlib.plugins.difftacular.generate_diff import diff_ignore_branches
956+from breezy.plugins.difftacular.generate_diff import diff_ignore_branches
957 from lazr.delegates import delegate_to
958 import simplejson
959 from sqlobject import (
960diff --git a/lib/lp/code/model/directbranchcommit.py b/lib/lp/code/model/directbranchcommit.py
961index 4dd4d46..0b7a902 100644
962--- a/lib/lp/code/model/directbranchcommit.py
963+++ b/lib/lp/code/model/directbranchcommit.py
964@@ -12,9 +12,9 @@ __all__ = [
965
966 import os.path
967
968-from bzrlib.generate_ids import gen_file_id
969-from bzrlib.revision import NULL_REVISION
970-from bzrlib.transform import (
971+from breezy.bzr.generate_ids import gen_file_id
972+from breezy.revision import NULL_REVISION
973+from breezy.transform import (
974 ROOT_PARENT,
975 TransformPreview,
976 )
977@@ -226,10 +226,11 @@ class DirectBranchCommit:
978 if rev_id == NULL_REVISION:
979 if list(self.transform_preview.iter_changes()) == []:
980 return
981+ self.transform_preview.fixup_new_roots()
982 committer_id = self.getBzrCommitterID()
983 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
984 # required to generate the revision-id.
985- with override_environ(BZR_EMAIL=committer_id):
986+ with override_environ(BRZ_EMAIL=committer_id):
987 new_rev_id = self.transform_preview.commit(
988 self.bzrbranch, commit_message, self.merge_parents,
989 committer=committer_id)
990diff --git a/lib/lp/code/model/gitrepository.py b/lib/lp/code/model/gitrepository.py
991index 93a2d16..14c09a4 100644
992--- a/lib/lp/code/model/gitrepository.py
993+++ b/lib/lp/code/model/gitrepository.py
994@@ -27,7 +27,7 @@ from itertools import (
995 from operator import attrgetter
996 from urllib import quote_plus
997
998-from bzrlib import urlutils
999+from breezy import urlutils
1000 from lazr.enum import DBItem
1001 from lazr.lifecycle.event import ObjectModifiedEvent
1002 from lazr.lifecycle.snapshot import Snapshot
1003diff --git a/lib/lp/code/model/revision.py b/lib/lp/code/model/revision.py
1004index 119ac41..4895ebb 100644
1005--- a/lib/lp/code/model/revision.py
1006+++ b/lib/lp/code/model/revision.py
1007@@ -16,7 +16,7 @@ from datetime import (
1008 )
1009 import email
1010
1011-from bzrlib.revision import NULL_REVISION
1012+from breezy.revision import NULL_REVISION
1013 import pytz
1014 from sqlobject import (
1015 BoolCol,
1016@@ -322,7 +322,7 @@ class RevisionSet:
1017 This works around a bug in Python that causes datetime.fromtimestamp
1018 to raise an exception if it is given a negative, fractional timestamp.
1019
1020- :param timestamp: A timestamp from a bzrlib.revision.Revision
1021+ :param timestamp: A timestamp from a breezy.revision.Revision
1022 :type timestamp: float
1023
1024 :return: A datetime corresponding to the given timestamp.
1025diff --git a/lib/lp/code/model/sourcepackagerecipedata.py b/lib/lp/code/model/sourcepackagerecipedata.py
1026index a30b3c2..e0801bf 100644
1027--- a/lib/lp/code/model/sourcepackagerecipedata.py
1028+++ b/lib/lp/code/model/sourcepackagerecipedata.py
1029@@ -13,7 +13,7 @@ __all__ = ['SourcePackageRecipeData']
1030
1031 import re
1032
1033-from bzrlib.plugins.builder.recipe import (
1034+from breezy.plugins.builder.recipe import (
1035 BaseRecipeBranch,
1036 MergeInstruction,
1037 NestInstruction,
1038diff --git a/lib/lp/code/model/tests/test_branch.py b/lib/lp/code/model/tests/test_branch.py
1039index ecad508..2bd0b62 100644
1040--- a/lib/lp/code/model/tests/test_branch.py
1041+++ b/lib/lp/code/model/tests/test_branch.py
1042@@ -13,10 +13,10 @@ from datetime import (
1043 )
1044 import json
1045
1046-from bzrlib.branch import Branch
1047-from bzrlib.bzrdir import BzrDir
1048-from bzrlib.revision import NULL_REVISION
1049-from bzrlib.url_policy_open import BadUrl
1050+from breezy.branch import Branch
1051+from breezy.bzr.bzrdir import BzrDir
1052+from breezy.revision import NULL_REVISION
1053+from breezy.url_policy_open import BadUrl
1054 from pytz import UTC
1055 from sqlobject import SQLObjectNotFound
1056 from storm.exceptions import LostObjectError
1057@@ -2257,7 +2257,7 @@ class TestRevisionHistory(TestCaseWithFactory):
1058 def test_tip_revision_when_no_revisions(self):
1059 # When a branch has no revisions but does have Bazaar data, its tip
1060 # revision is None and its last_scanned_id is
1061- # bzrlib.revision.NULL_REVISION.
1062+ # breezy.revision.NULL_REVISION.
1063 branch = self.factory.makeBranch()
1064 branch.updateScannedDetails(None, 0)
1065 self.assertEqual(NULL_REVISION, branch.last_scanned_id)
1066@@ -3276,7 +3276,7 @@ class TestGetBzrBranch(TestCaseWithFactory):
1067 db_branch, tree = self.create_branch_and_tree()
1068 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1069 # required to generate the revision-id.
1070- with override_environ(BZR_EMAIL='me@example.com'):
1071+ with override_environ(BRZ_EMAIL='me@example.com'):
1072 revid = tree.commit('')
1073 bzr_branch = db_branch.getBzrBranch()
1074 self.assertEqual(revid, bzr_branch.last_revision())
1075diff --git a/lib/lp/code/model/tests/test_branchjob.py b/lib/lp/code/model/tests/test_branchjob.py
1076index 66badbf..0c4a893 100644
1077--- a/lib/lp/code/model/tests/test_branchjob.py
1078+++ b/lib/lp/code/model/tests/test_branchjob.py
1079@@ -11,11 +11,11 @@ import datetime
1080 import os
1081 import shutil
1082
1083-from bzrlib import errors as bzr_errors
1084-from bzrlib.branch import Branch
1085-from bzrlib.bzrdir import BzrDir
1086-from bzrlib.revision import NULL_REVISION
1087-from bzrlib.transport import get_transport
1088+from breezy import errors as bzr_errors
1089+from breezy.branch import Branch
1090+from breezy.bzr.bzrdir import BzrDir
1091+from breezy.revision import NULL_REVISION
1092+from breezy.transport import get_transport
1093 from fixtures import MockPatch
1094 import pytz
1095 from sqlobject import SQLObjectNotFound
1096@@ -149,7 +149,7 @@ class TestBranchScanJob(TestCaseWithFactory):
1097 db_branch, bzr_tree = self.create_branch_and_tree()
1098 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1099 # required to generate the revision-id.
1100- with override_environ(BZR_EMAIL='me@example.com'):
1101+ with override_environ(BRZ_EMAIL='me@example.com'):
1102 bzr_tree.commit('First commit', rev_id=b'rev1')
1103 bzr_tree.commit('Second commit', rev_id=b'rev2')
1104 bzr_tree.commit('Third commit', rev_id=b'rev3')
1105@@ -177,7 +177,7 @@ class TestBranchScanJob(TestCaseWithFactory):
1106 db_branch, bzr_tree = self.create_branch_and_tree()
1107 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1108 # required to generate the revision-id.
1109- with override_environ(BZR_EMAIL='me@example.com'):
1110+ with override_environ(BRZ_EMAIL='me@example.com'):
1111 bzr_tree.commit('First commit', rev_id=b'rev1')
1112 LaunchpadZopelessLayer.commit()
1113
1114@@ -198,7 +198,7 @@ class TestBranchScanJob(TestCaseWithFactory):
1115 private_bug = self.factory.makeBug(
1116 target=product, information_type=InformationType.USERDATA)
1117 bug_line = b'https://launchpad.net/bugs/%s fixed' % private_bug.id
1118- with override_environ(BZR_EMAIL='me@example.com'):
1119+ with override_environ(BRZ_EMAIL='me@example.com'):
1120 bzr_tree.commit(
1121 'First commit', rev_id=b'rev1', revprops={b'bugs': bug_line})
1122 job = BranchScanJob.create(db_branch)
1123@@ -314,7 +314,7 @@ class TestBranchUpgradeJob(TestCaseWithFactory):
1124 db_branch, tree = self.create_branch_and_tree()
1125 branch2 = BzrDir.create_branch_convenience('.')
1126 tree.branch.set_stacked_on_url(branch2.base)
1127- branch2.bzrdir.destroy_branch()
1128+ branch2.controldir.destroy_branch()
1129 # Create BranchUpgradeJob manually, because we're trying to upgrade a
1130 # branch that doesn't need upgrading.
1131 requester = self.factory.makePerson()
1132@@ -463,7 +463,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1133 try:
1134 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1135 # required to generate the revision-id.
1136- with override_environ(BZR_EMAIL='me@example.com'):
1137+ with override_environ(BRZ_EMAIL='me@example.com'):
1138 tree.commit('rev1', rev_id=b'rev1')
1139 tree.commit('rev2', rev_id=b'rev2')
1140 tree.commit('rev3', rev_id=b'rev3')
1141@@ -492,7 +492,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1142 tree.add_parent_tree_id(b'rev3')
1143 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1144 # required to generate the revision-id.
1145- with override_environ(BZR_EMAIL='me@example.com'):
1146+ with override_environ(BRZ_EMAIL='me@example.com'):
1147 tree.commit('rev3a', rev_id=b'rev3a')
1148 self.updateDBRevisions(branch, tree.branch, [b'rev3', b'rev3a'])
1149 job = RevisionsAddedJob.create(branch, 'rev1', 'rev3', '')
1150@@ -533,7 +533,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1151 self.addCleanup(tree.unlock)
1152 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1153 # required to generate the revision-id.
1154- with override_environ(BZR_EMAIL='me@example.com'):
1155+ with override_environ(BRZ_EMAIL='me@example.com'):
1156 tree.commit(
1157 'rev1', rev_id=b'rev1', timestamp=1000, timezone=0,
1158 committer='J. Random Hacker <jrandom@example.org>')
1159@@ -552,14 +552,14 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1160 tree.branch.nick = 'nicholas'
1161 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1162 # required to generate the revision-id.
1163- with override_environ(BZR_EMAIL='me@example.com'):
1164+ with override_environ(BRZ_EMAIL='me@example.com'):
1165 tree.commit('rev1')
1166- tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
1167+ tree2 = tree.controldir.sprout('tree2').open_workingtree()
1168 tree2.commit('rev2a', rev_id=b'rev2a-id', committer='foo@')
1169 tree2.commit('rev3', rev_id=b'rev3-id',
1170 authors=['bar@', 'baz@blaine.com'])
1171 tree.merge_from_branch(tree2.branch)
1172- tree3 = tree.bzrdir.sprout('tree3').open_workingtree()
1173+ tree3 = tree.controldir.sprout('tree3').open_workingtree()
1174 tree3.commit('rev2b', rev_id=b'rev2b-id', committer='qux@')
1175 tree.merge_from_branch(tree3.branch, force=True)
1176 if include_ghost:
1177@@ -808,17 +808,17 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1178 self.useBzrBranches(direct_database=True)
1179 db_branch, tree = self.create_branch_and_tree()
1180 first_revision = b'rev-1'
1181- tree.bzrdir.root_transport.put_bytes('hello.txt', 'Hello World\n')
1182+ tree.controldir.root_transport.put_bytes('hello.txt', b'Hello World\n')
1183 tree.add('hello.txt')
1184 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1185 # required to generate the revision-id.
1186- with override_environ(BZR_EMAIL='me@example.com'):
1187+ with override_environ(BRZ_EMAIL='me@example.com'):
1188 tree.commit(
1189 rev_id=first_revision, message="Log message",
1190 committer="Joe Bloggs <joe@example.com>",
1191 timestamp=1000000000.0, timezone=0)
1192- tree.bzrdir.root_transport.put_bytes(
1193- 'hello.txt', 'Hello World\n\nFoo Bar\n')
1194+ tree.controldir.root_transport.put_bytes(
1195+ 'hello.txt', b'Hello World\n\nFoo Bar\n')
1196 second_revision = b'rev-2'
1197 tree.commit(
1198 rev_id=second_revision, message="Extended contents",
1199@@ -864,7 +864,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
1200 rev_id = b'rev-1'
1201 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1202 # required to generate the revision-id.
1203- with override_environ(BZR_EMAIL='me@example.com'):
1204+ with override_environ(BRZ_EMAIL='me@example.com'):
1205 tree.commit(
1206 rev_id=rev_id, message="Non ASCII: \xe9",
1207 committer="Non ASCII: \xed", timestamp=1000000000.0,
1208@@ -971,8 +971,9 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1209 except IndexError:
1210 file_content = self.factory.getUniqueString()
1211 dname = os.path.dirname(file_name)
1212- self.tree.bzrdir.root_transport.clone(dname).create_prefix()
1213- self.tree.bzrdir.root_transport.put_bytes(file_name, file_content)
1214+ self.tree.controldir.root_transport.clone(dname).create_prefix()
1215+ self.tree.controldir.root_transport.put_bytes(
1216+ file_name, file_content)
1217 if len(files) > 0:
1218 self.tree.smart_add(
1219 [self.tree.abspath(file_pair[0]) for file_pair in files])
1220@@ -980,7 +981,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1221 commit_message = self.factory.getUniqueString('commit')
1222 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1223 # required to generate the revision-id.
1224- with override_environ(BZR_EMAIL='me@example.com'):
1225+ with override_environ(BRZ_EMAIL='me@example.com'):
1226 revision_id = self.tree.commit(commit_message)
1227 self.branch.last_scanned_id = revision_id
1228 self.branch.last_mirrored_id = revision_id
1229@@ -1076,7 +1077,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1230 # An empty POT cannot be uploaded, if if the product series is
1231 # configured for template import.
1232 entries = self._runJobWithFile(
1233- TranslationsBranchImportMode.IMPORT_TEMPLATES, 'empty.pot', '')
1234+ TranslationsBranchImportMode.IMPORT_TEMPLATES, 'empty.pot', b'')
1235 self.assertEqual(entries, [])
1236
1237 def test_upload_hidden_pot(self):
1238@@ -1103,7 +1104,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1239 def test_upload_pot_content(self):
1240 # The content of the uploaded file is stored in the librarian.
1241 # The uploader of a POT is the series owner.
1242- POT_CONTENT = "pot content\n"
1243+ POT_CONTENT = b"pot content\n"
1244 self._runJobWithFile(
1245 TranslationsBranchImportMode.IMPORT_TEMPLATES,
1246 'foo.pot', POT_CONTENT)
1247diff --git a/lib/lp/code/model/tests/test_branchmergeproposaljobs.py b/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
1248index 8f1fcca..9836caf 100644
1249--- a/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
1250+++ b/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
1251@@ -190,7 +190,7 @@ class TestMergeProposalNeedsReviewEmailJobBzr(
1252 target_branch, tree = self.create_branch_and_tree()
1253 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1254 # required to generate the revision-id.
1255- with override_environ(BZR_EMAIL='me@example.com'):
1256+ with override_environ(BRZ_EMAIL='me@example.com'):
1257 tree.commit('test')
1258 source_branch = self.factory.makeProductBranch(
1259 product=target_branch.product)
1260@@ -212,7 +212,7 @@ class TestMergeProposalNeedsReviewEmailJobBzr(
1261 tree = self.create_branch_and_tree(db_branch=bmp.target_branch)[1]
1262 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1263 # required to generate the revision-id.
1264- with override_environ(BZR_EMAIL='me@example.com'):
1265+ with override_environ(BRZ_EMAIL='me@example.com'):
1266 tree.commit('Initial commit')
1267 self.createBzrBranch(bmp.source_branch, tree.branch)
1268 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)
1269diff --git a/lib/lp/code/model/tests/test_diff.py b/lib/lp/code/model/tests/test_diff.py
1270index f082a8e..f4ec2ce 100644
1271--- a/lib/lp/code/model/tests/test_diff.py
1272+++ b/lib/lp/code/model/tests/test_diff.py
1273@@ -12,8 +12,8 @@ from difflib import unified_diff
1274 import logging
1275 from textwrap import dedent
1276
1277-from bzrlib import trace
1278-from bzrlib.patches import (
1279+from breezy import trace
1280+from breezy.patches import (
1281 InsertLine,
1282 parse_patches,
1283 RemoveLine,
1284@@ -565,7 +565,7 @@ class TestPreviewDiff(DiffTestCase):
1285 reload(trace)
1286 bmp, source_rev_id, target_rev_id = self.createExampleBzrMerge()
1287 handler = RecordLister()
1288- logger = logging.getLogger('bzr')
1289+ logger = logging.getLogger('brz')
1290 logger.addHandler(handler)
1291 try:
1292 PreviewDiff.fromBranchMergeProposal(bmp)
1293diff --git a/lib/lp/code/model/tests/test_gitref.py b/lib/lp/code/model/tests/test_gitref.py
1294index 2152b03..9b546fe 100644
1295--- a/lib/lp/code/model/tests/test_gitref.py
1296+++ b/lib/lp/code/model/tests/test_gitref.py
1297@@ -14,7 +14,7 @@ from datetime import (
1298 import hashlib
1299 import json
1300
1301-from bzrlib import urlutils
1302+from breezy import urlutils
1303 import pytz
1304 import responses
1305 from storm.store import Store
1306diff --git a/lib/lp/code/model/tests/test_gitrepository.py b/lib/lp/code/model/tests/test_gitrepository.py
1307index f1a80ed..e7615f3 100644
1308--- a/lib/lp/code/model/tests/test_gitrepository.py
1309+++ b/lib/lp/code/model/tests/test_gitrepository.py
1310@@ -20,7 +20,7 @@ from functools import partial
1311 import hashlib
1312 import json
1313
1314-from bzrlib import urlutils
1315+from breezy import urlutils
1316 from fixtures import MockPatch
1317 from lazr.lifecycle.event import ObjectModifiedEvent
1318 from pymacaroons import Macaroon
1319diff --git a/lib/lp/code/model/tests/test_sourcepackagerecipe.py b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1320index aa950f2..fd47336 100644
1321--- a/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1322+++ b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
1323@@ -13,7 +13,7 @@ from datetime import (
1324 )
1325 import textwrap
1326
1327-from bzrlib.plugins.builder.recipe import ForbiddenInstructionError
1328+from breezy.plugins.builder.recipe import ForbiddenInstructionError
1329 from pytz import UTC
1330 from storm.locals import Store
1331 from testtools.matchers import Equals
1332diff --git a/lib/lp/code/scripts/tests/test_scan_branches.py b/lib/lp/code/scripts/tests/test_scan_branches.py
1333index ddaeea8..4f5783f 100644
1334--- a/lib/lp/code/scripts/tests/test_scan_branches.py
1335+++ b/lib/lp/code/scripts/tests/test_scan_branches.py
1336@@ -39,7 +39,7 @@ class TestScanBranches(TestCaseWithFactory):
1337 target, target_tree = self.create_branch_and_tree(db_branch=db_branch)
1338 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1339 # required to generate the revision-id.
1340- with override_environ(BZR_EMAIL='me@example.com'):
1341+ with override_environ(BRZ_EMAIL='me@example.com'):
1342 target_tree.commit('First commit', rev_id='rev1')
1343 target_tree.commit('Second commit', rev_id='rev2')
1344 target_tree.commit('Third commit', rev_id='rev3')
1345diff --git a/lib/lp/code/scripts/tests/test_sendbranchmail.py b/lib/lp/code/scripts/tests/test_sendbranchmail.py
1346index bee4c9f..e7e983d 100644
1347--- a/lib/lp/code/scripts/tests/test_sendbranchmail.py
1348+++ b/lib/lp/code/scripts/tests/test_sendbranchmail.py
1349@@ -32,12 +32,12 @@ class TestSendbranchmail(TestCaseWithFactory):
1350 BranchSubscriptionDiffSize.WHOLEDIFF,
1351 CodeReviewNotificationLevel.FULL,
1352 branch.registrant)
1353- transport = tree.bzrdir.root_transport
1354- transport.put_bytes('foo', 'bar')
1355+ transport = tree.controldir.root_transport
1356+ transport.put_bytes('foo', b'bar')
1357 tree.add('foo')
1358 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1359 # required to generate the revision-id.
1360- with override_environ(BZR_EMAIL='me@example.com'):
1361+ with override_environ(BRZ_EMAIL='me@example.com'):
1362 tree.commit('Added foo.', rev_id='rev1')
1363 return branch, tree
1364
1365@@ -65,10 +65,10 @@ class TestSendbranchmail(TestCaseWithFactory):
1366 """RevisionsAddedJobs are run by sendbranchmail."""
1367 self.useBzrBranches()
1368 branch, tree = self.createBranch()
1369- tree.bzrdir.root_transport.put_bytes('foo', 'baz')
1370+ tree.controldir.root_transport.put_bytes('foo', b'baz')
1371 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
1372 # required to generate the revision-id.
1373- with override_environ(BZR_EMAIL='me@example.com'):
1374+ with override_environ(BRZ_EMAIL='me@example.com'):
1375 tree.commit('Added foo.', rev_id='rev2')
1376 job = RevisionsAddedJob.create(
1377 branch, 'rev1', 'rev2', 'from@example.org')
1378diff --git a/lib/lp/code/scripts/tests/test_upgrade_branches.py b/lib/lp/code/scripts/tests/test_upgrade_branches.py
1379index a349d90..b95dc8b 100644
1380--- a/lib/lp/code/scripts/tests/test_upgrade_branches.py
1381+++ b/lib/lp/code/scripts/tests/test_upgrade_branches.py
1382@@ -4,7 +4,7 @@
1383 """Test the upgrade_branches script."""
1384
1385
1386-from bzrlib.branch import Branch as BzrBranch
1387+from breezy.branch import Branch as BzrBranch
1388 import transaction
1389
1390 from lp.code.model.branch import (
1391diff --git a/lib/lp/code/stories/branches/xx-bazaar-home.txt b/lib/lp/code/stories/branches/xx-bazaar-home.txt
1392index ec8c20e..5b90cca 100644
1393--- a/lib/lp/code/stories/branches/xx-bazaar-home.txt
1394+++ b/lib/lp/code/stories/branches/xx-bazaar-home.txt
1395@@ -1,15 +1,15 @@
1396 The Launchpad Code front page
1397 =============================
1398
1399-First we manually set the Bazaar version, so that this document will not need
1400-updating when Launchpad upgrades Bazaar.
1401+First we manually set the Breezy version, so that this document will not need
1402+updating when Launchpad upgrades Breezy.
1403
1404- >>> import bzrlib
1405- >>> bzrlib_version = bzrlib.__version__
1406- >>> bzrlib.__version__ = '0.92.0'
1407+ >>> import breezy
1408+ >>> breezy_version = breezy.__version__
1409+ >>> breezy.__version__ = '3.0.0'
1410
1411
1412-Check that the Bazaar home page works.
1413+Check that the Code home page works.
1414
1415 >>> browser.open('http://code.launchpad.test/')
1416 >>> footer = find_tag_by_id(browser.contents, 'application-footer')
1417@@ -18,12 +18,12 @@ Check that the Bazaar home page works.
1418 30 branches registered in
1419 6 projects
1420 1 imported branches
1421- Launchpad uses Bazaar 0.92.0.
1422+ Launchpad uses Breezy 3.0.0.
1423
1424
1425-Restore the original Bazaar version:
1426+Restore the original Breezy version:
1427
1428- >>> bzrlib.__version__ = bzrlib_version
1429+ >>> breezy.__version__ = breezy_version
1430
1431
1432 The main code home page now has a subset of the project tag cloud,
1433diff --git a/lib/lp/code/stories/webservice/xx-branch.txt b/lib/lp/code/stories/webservice/xx-branch.txt
1434index f198608..18c3ea0 100644
1435--- a/lib/lp/code/stories/webservice/xx-branch.txt
1436+++ b/lib/lp/code/stories/webservice/xx-branch.txt
1437@@ -3,7 +3,7 @@ Introduction
1438
1439 Launchpad provides two ways to programmatically interact with your
1440 branches. You can either interact with the branches themselves using
1441-`bzrlib`, or you can use Launchpad's webservice APIs to explore
1442+`breezy`, or you can use Launchpad's webservice APIs to explore
1443 information about the branches and how they relate to the rest of
1444 the things on Launchpad.
1445
1446diff --git a/lib/lp/code/templates/bazaar-index.pt b/lib/lp/code/templates/bazaar-index.pt
1447index cdd9bcd..b3ae707 100644
1448--- a/lib/lp/code/templates/bazaar-index.pt
1449+++ b/lib/lp/code/templates/bazaar-index.pt
1450@@ -128,8 +128,8 @@
1451 </a>
1452 </div>
1453 <div>
1454- Launchpad uses <a href="http://bazaar.canonical.com/">Bazaar</a>
1455- <tal:version tal:content="view/bzr_version">2.0</tal:version>.
1456+ Launchpad uses <a href="https://www.breezy-vcs.org/">Breezy</a>
1457+ <tal:version tal:content="view/brz_version">3.0.0</tal:version>.
1458 </div>
1459 </div>
1460
1461diff --git a/lib/lp/code/tests/helpers.py b/lib/lp/code/tests/helpers.py
1462index 1b9f7d7..2955528 100644
1463--- a/lib/lp/code/tests/helpers.py
1464+++ b/lib/lp/code/tests/helpers.py
1465@@ -26,7 +26,7 @@ from datetime import timedelta
1466 from difflib import unified_diff
1467 from itertools import count
1468
1469-from bzrlib.plugins.builder.recipe import RecipeParser
1470+from breezy.plugins.builder.recipe import RecipeParser
1471 import fixtures
1472 import transaction
1473 from zope.component import getUtility
1474diff --git a/lib/lp/code/tests/test_bzr.py b/lib/lp/code/tests/test_bzr.py
1475index 37afc6c..6a62463 100644
1476--- a/lib/lp/code/tests/test_bzr.py
1477+++ b/lib/lp/code/tests/test_bzr.py
1478@@ -7,12 +7,13 @@ from __future__ import absolute_import, print_function, unicode_literals
1479
1480 __metaclass__ = type
1481
1482-from bzrlib.errors import NoSuchRevision
1483-from bzrlib.revision import NULL_REVISION
1484-from bzrlib.tests import (
1485+from breezy.errors import NoSuchRevision
1486+from breezy.revision import NULL_REVISION
1487+from breezy.tests import (
1488 TestCaseInTempDir,
1489 TestCaseWithTransport,
1490 )
1491+import six
1492
1493 from lp.code.bzr import (
1494 branch_revision_history,
1495@@ -49,7 +50,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
1496
1497 def test_get_branch_format_2a(self):
1498 # Test the 2a branch format.
1499- branch = self.make_branch('test', '2a')
1500+ branch = self.make_branch('test', six.ensure_str('2a'))
1501 formats = get_branch_formats(branch)
1502 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
1503 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])
1504@@ -57,7 +58,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
1505
1506 def test_get_branch_format_1_9(self):
1507 # Test the 1.9 branch format.
1508- branch = self.make_branch('test', '1.9')
1509+ branch = self.make_branch('test', six.ensure_str('1.9'))
1510 formats = get_branch_formats(branch)
1511 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
1512 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])
1513@@ -65,7 +66,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
1514
1515 def test_get_branch_format_packs(self):
1516 # Test the packs branch format.
1517- branch = self.make_branch('test', 'pack-0.92')
1518+ branch = self.make_branch('test', six.ensure_str('pack-0.92'))
1519 formats = get_branch_formats(branch)
1520 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
1521 self.assertEqual(BranchFormat.BZR_BRANCH_6, formats[1])
1522@@ -73,7 +74,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
1523
1524 def test_get_branch_format_knits(self):
1525 # Test the knits branch format.
1526- branch = self.make_branch('test', 'knit')
1527+ branch = self.make_branch('test', six.ensure_str('knit'))
1528 formats = get_branch_formats(branch)
1529 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
1530 self.assertEqual(BranchFormat.BZR_BRANCH_5, formats[1])
1531@@ -89,7 +90,7 @@ class TestBranchRevisionHistory(TestCaseWithTransport):
1532
1533 def test_some_commits(self):
1534 branch = self.make_branch('test')
1535- tree = branch.bzrdir.create_workingtree()
1536+ tree = branch.controldir.create_workingtree()
1537 tree.commit('acommit', rev_id=b'A')
1538 tree.commit('bcommit', rev_id=b'B')
1539 tree.commit('ccommit', rev_id=b'C')
1540@@ -109,7 +110,7 @@ class TestGetAncestry(TestCaseWithTransport):
1541 def test_some(self):
1542 # Verify ancestors are included.
1543 branch = self.make_branch('test')
1544- tree = branch.bzrdir.create_workingtree()
1545+ tree = branch.controldir.create_workingtree()
1546 tree.commit('msg a', rev_id=b'A')
1547 tree.commit('msg b', rev_id=b'B')
1548 tree.commit('msg c', rev_id=b'C')
1549@@ -123,7 +124,7 @@ class TestGetAncestry(TestCaseWithTransport):
1550 def test_children(self):
1551 # Verify non-mainline children are included.
1552 branch = self.make_branch('test')
1553- tree = branch.bzrdir.create_workingtree()
1554+ tree = branch.controldir.create_workingtree()
1555 tree.commit('msg a', rev_id=b'A')
1556 branch.generate_revision_history(NULL_REVISION)
1557 tree.set_parent_ids([])
1558diff --git a/lib/lp/code/xmlrpc/branch.py b/lib/lp/code/xmlrpc/branch.py
1559index ed0ce23..bd45c11 100644
1560--- a/lib/lp/code/xmlrpc/branch.py
1561+++ b/lib/lp/code/xmlrpc/branch.py
1562@@ -12,7 +12,7 @@ __all__ = [
1563
1564 from xmlrpclib import Fault
1565
1566-from bzrlib import urlutils
1567+from breezy import urlutils
1568 from zope.component import getUtility
1569 from zope.interface import (
1570 implementer,
1571diff --git a/lib/lp/code/xmlrpc/codehosting.py b/lib/lp/code/xmlrpc/codehosting.py
1572index 107b1e6..3c09e78 100644
1573--- a/lib/lp/code/xmlrpc/codehosting.py
1574+++ b/lib/lp/code/xmlrpc/codehosting.py
1575@@ -13,7 +13,7 @@ __all__ = [
1576
1577 import datetime
1578
1579-from bzrlib.urlutils import (
1580+from breezy.urlutils import (
1581 escape,
1582 unescape,
1583 )
1584diff --git a/lib/lp/code/xmlrpc/tests/test_branch.py b/lib/lp/code/xmlrpc/tests/test_branch.py
1585index 5b75b28..d035177 100644
1586--- a/lib/lp/code/xmlrpc/tests/test_branch.py
1587+++ b/lib/lp/code/xmlrpc/tests/test_branch.py
1588@@ -8,7 +8,7 @@ __metaclass__ = type
1589 import os
1590 import xmlrpclib
1591
1592-from bzrlib import urlutils
1593+from breezy import urlutils
1594 from lazr.uri import URI
1595 from zope.security.proxy import removeSecurityProxy
1596
1597diff --git a/lib/lp/code/xmlrpc/tests/test_codehosting.py b/lib/lp/code/xmlrpc/tests/test_codehosting.py
1598index 2491adc..c5ec059 100644
1599--- a/lib/lp/code/xmlrpc/tests/test_codehosting.py
1600+++ b/lib/lp/code/xmlrpc/tests/test_codehosting.py
1601@@ -8,8 +8,8 @@ __metaclass__ = type
1602 import datetime
1603 import os
1604
1605-from bzrlib import bzrdir
1606-from bzrlib.urlutils import escape
1607+from breezy import controldir
1608+from breezy.urlutils import escape
1609 import pytz
1610 from testscenarios import (
1611 load_tests_apply_scenarios,
1612@@ -659,7 +659,7 @@ class CodehostingTest(WithScenarios, TestCaseWithFactory):
1613 branch, 'next_mirror_time', UTC_NOW)
1614
1615 def getFormatStringsForFormatName(self, format_name):
1616- default_format = bzrdir.format_registry.get(format_name)()
1617+ default_format = controldir.format_registry.get(format_name)()
1618 control_string = default_format.get_format_string()
1619 branch_string = default_format.get_branch_format().get_format_string()
1620 repository_string = \
1621diff --git a/lib/lp/codehosting/__init__.py b/lib/lp/codehosting/__init__.py
1622index 261a3aa..bd097f9 100644
1623--- a/lib/lp/codehosting/__init__.py
1624+++ b/lib/lp/codehosting/__init__.py
1625@@ -9,16 +9,21 @@ all plugins in the bzrplugins/ directory underneath the rocketfuel checkout.
1626
1627 __metaclass__ = type
1628 __all__ = [
1629- 'get_bzr_path',
1630+ 'get_brz_path',
1631 'get_BZR_PLUGIN_PATH_for_subprocess',
1632 ]
1633
1634
1635 import os
1636
1637-import bzrlib
1638-from bzrlib.branch import Branch
1639-from bzrlib.plugin import load_plugins
1640+import breezy
1641+from breezy import ui as brz_ui
1642+from breezy.branch import Branch
1643+from breezy.library_state import BzrLibraryState as BrzLibraryState
1644+from breezy.plugin import load_plugins as brz_load_plugins
1645+# This import is needed so that brz's logger gets registered.
1646+import breezy.trace
1647+from bzrlib.plugin import load_plugins as bzr_load_plugins
1648 # This import is needed so that bzr's logger gets registered.
1649 import bzrlib.trace
1650 from zope.security import checker
1651@@ -26,9 +31,9 @@ from zope.security import checker
1652 from lp.services.config import config
1653
1654
1655-def get_bzr_path():
1656- """Find the path to the copy of Bazaar for this rocketfuel instance"""
1657- return os.path.join(config.root, 'bin', 'bzr')
1658+def get_brz_path():
1659+ """Find the path to the copy of Breezy for this rocketfuel instance"""
1660+ return os.path.join(config.root, 'bin', 'brz')
1661
1662
1663 def _get_bzr_plugins_path():
1664@@ -48,23 +53,50 @@ def get_BZR_PLUGIN_PATH_for_subprocess():
1665 return ":".join((_get_bzr_plugins_path(), "-site"))
1666
1667
1668-os.environ['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()
1669+def _get_brz_plugins_path():
1670+ """Find the path to the Breezy plugins for this rocketfuel instance."""
1671+ return os.path.join(config.root, 'brzplugins')
1672
1673-# We want to have full access to Launchpad's Bazaar plugins throughout the
1674-# codehosting package.
1675-load_plugins([_get_bzr_plugins_path()])
1676
1677+def get_BRZ_PLUGIN_PATH_for_subprocess():
1678+ """Calculate the appropriate value for the BRZ_PLUGIN_PATH environment.
1679+
1680+ The '-site' token tells breezy not to include the 'site specific plugins
1681+ directory' (which is usually something like
1682+ /usr/lib/pythonX.Y/dist-packages/breezy/plugins/) in the plugin search
1683+ path, which would be inappropriate for Launchpad, which may have an
1684+ incompatible version of breezy in its virtualenv.
1685+ """
1686+ return ":".join((_get_brz_plugins_path(), "-site"))
1687
1688-def load_bundled_plugin(plugin_name):
1689- """Load a plugin bundled with Bazaar."""
1690- from bzrlib.plugin import get_core_plugin_path
1691- from bzrlib import plugins
1692- if get_core_plugin_path() not in plugins.__path__:
1693- plugins.__path__.append(get_core_plugin_path())
1694- __import__("bzrlib.plugins.%s" % plugin_name)
1695
1696+# We must explicitly initialize Breezy, as otherwise it will initialize
1697+# itself with a terminal-oriented UI.
1698+if breezy._global_state is None:
1699+ brz_state = BrzLibraryState(
1700+ ui=brz_ui.SilentUIFactory(), trace=breezy.trace.Config())
1701+ brz_state._start()
1702
1703-load_bundled_plugin("weave_fmt")
1704+
1705+# XXX cjwatson 2019-06-13: Remove BZR_PLUGIN_PATH and supporting code once
1706+# all of Launchpad has been ported to Breezy.
1707+os.environ['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()
1708+os.environ['BRZ_PLUGIN_PATH'] = get_BRZ_PLUGIN_PATH_for_subprocess()
1709+
1710+# Disable some Breezy plugins that are likely to cause trouble if used on
1711+# the server. (Unfortunately there doesn't seem to be a good way to load
1712+# only explicitly-specified plugins at the moment.)
1713+os.environ['BRZ_DISABLE_PLUGINS'] = ':'.join([
1714+ 'cvs',
1715+ 'darcs',
1716+ 'email',
1717+ 'mtn',
1718+ ])
1719+
1720+# We want to have full access to Launchpad's Bazaar plugins throughout the
1721+# codehosting package.
1722+bzr_load_plugins([_get_bzr_plugins_path()])
1723+brz_load_plugins()
1724
1725
1726 def dont_wrap_class_and_subclasses(cls):
1727@@ -75,6 +107,6 @@ def dont_wrap_class_and_subclasses(cls):
1728
1729 # Don't wrap Branch or its subclasses in Zope security proxies. Make sure
1730 # the various LoomBranch classes are present first.
1731-import bzrlib.plugins.loom.branch
1732-bzrlib.plugins.loom.branch
1733+import breezy.plugins.loom.branch
1734+breezy.plugins.loom.branch
1735 dont_wrap_class_and_subclasses(Branch)
1736diff --git a/lib/lp/codehosting/bzrutils.py b/lib/lp/codehosting/bzrutils.py
1737index 52dcd7b..bd1dc4b 100644
1738--- a/lib/lp/codehosting/bzrutils.py
1739+++ b/lib/lp/codehosting/bzrutils.py
1740@@ -1,10 +1,10 @@
1741 # Copyright 2009 Canonical Ltd. This software is licensed under the
1742 # GNU Affero General Public License version 3 (see the file LICENSE).
1743
1744-"""Utilities for dealing with Bazaar.
1745+"""Utilities for dealing with Breezy.
1746
1747 Much of the code in here should be submitted upstream. The rest is code that
1748-integrates between Bazaar's infrastructure and Launchpad's infrastructure.
1749+integrates between Breezy's infrastructure and Launchpad's infrastructure.
1750 """
1751
1752 __metaclass__ = type
1753@@ -28,30 +28,30 @@ from contextlib import contextmanager
1754 import os
1755 import sys
1756
1757-from bzrlib import (
1758+from breezy import (
1759 config,
1760 trace,
1761 )
1762-from bzrlib.errors import (
1763+from breezy.branch import UnstackableBranchFormat
1764+from breezy.bzr.remote import (
1765+ RemoteBranch,
1766+ RemoteBzrDir,
1767+ RemoteRepository,
1768+ )
1769+from breezy.errors import (
1770 AppendRevisionsOnlyViolation,
1771 ConnectionTimeout,
1772 GhostRevisionsHaveNoRevno,
1773 NotStacked,
1774- UnstackableBranchFormat,
1775 UnstackableRepositoryFormat,
1776 UnsupportedProtocol,
1777 )
1778-from bzrlib.remote import (
1779- RemoteBranch,
1780- RemoteBzrDir,
1781- RemoteRepository,
1782- )
1783-from bzrlib.transport import (
1784+from breezy.transport import (
1785 get_transport,
1786 register_transport,
1787 unregister_transport,
1788 )
1789-from bzrlib.transport.local import LocalTransport
1790+from breezy.transport.local import LocalTransport
1791 from lazr.uri import URI
1792
1793 from lp.services.webapp.errorlog import (
1794@@ -221,7 +221,7 @@ class HttpAsLocalTransport(LocalTransport):
1795 """A LocalTransport that works using http URLs.
1796
1797 We have this because the Launchpad database has constraints on URLs for
1798- branches, disallowing file:/// URLs. bzrlib itself disallows
1799+ branches, disallowing file:/// URLs. breezy itself disallows
1800 file://localhost/ URLs.
1801 """
1802
1803@@ -287,7 +287,7 @@ def get_vfs_format_classes(branch):
1804 if isinstance(repository, RemoteRepository):
1805 repository._ensure_real()
1806 repository = repository._real_repository
1807- bzrdir = branch.bzrdir
1808+ bzrdir = branch.controldir
1809 if isinstance(bzrdir, RemoteBzrDir):
1810 bzrdir._ensure_real()
1811 bzrdir = bzrdir._real_bzrdir
1812@@ -325,7 +325,7 @@ def get_branch_info(branch):
1813 # XXX: Aaron Bentley 2008-06-13
1814 # Bazaar does not provide a public API for learning about
1815 # format markers. Fix this in Bazaar, then here.
1816- info['control_string'] = branch.bzrdir._format.get_format_string()
1817+ info['control_string'] = branch.controldir._format.get_format_string()
1818 info['branch_string'] = branch._format.get_format_string()
1819 info['repository_string'] = branch.repository._format.get_format_string()
1820 return info
1821diff --git a/lib/lp/codehosting/codeimport/tests/test_worker.py b/lib/lp/codehosting/codeimport/tests/test_worker.py
1822index 8bb5b7f..b414030 100644
1823--- a/lib/lp/codehosting/codeimport/tests/test_worker.py
1824+++ b/lib/lp/codehosting/codeimport/tests/test_worker.py
1825@@ -438,7 +438,7 @@ class TestImportDataStore(WorkerTest):
1826 remote_name = '%08x.tar.gz' % (source_details.target_id,)
1827 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
1828 transport = self.get_transport()
1829- transport.put_bytes(remote_name, '')
1830+ transport.put_bytes(remote_name, b'')
1831 store = ImportDataStore(transport, source_details)
1832 ret = store.fetch(local_name)
1833 self.assertTrue(ret)
1834@@ -496,7 +496,7 @@ class TestImportDataStore(WorkerTest):
1835 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
1836 subdir_name = self.factory.getUniqueString()
1837 source_details = self.factory.makeCodeImportSourceDetails()
1838- get_transport('.').put_bytes(local_name, '')
1839+ get_transport('.').put_bytes(local_name, b'')
1840 transport = self.get_transport()
1841 store = ImportDataStore(transport.clone(subdir_name), source_details)
1842 store.put(local_name)
1843diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
1844index bab222f..2873314 100644
1845--- a/lib/lp/codehosting/inmemory.py
1846+++ b/lib/lp/codehosting/inmemory.py
1847@@ -12,7 +12,7 @@ __all__ = [
1848 import operator
1849 from xmlrpclib import Fault
1850
1851-from bzrlib.urlutils import (
1852+from breezy.urlutils import (
1853 escape,
1854 unescape,
1855 )
1856diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
1857index acbf014..35dd65b 100644
1858--- a/lib/lp/codehosting/puller/scheduler.py
1859+++ b/lib/lp/codehosting/puller/scheduler.py
1860@@ -320,7 +320,7 @@ class PullerMaster:
1861 self.default_stacked_on_url]
1862 self.logger.debug("executing %s", command)
1863 env = os.environ.copy()
1864- env['BZR_EMAIL'] = get_lock_id_for_branch_id(self.branch_id)
1865+ env['BRZ_EMAIL'] = get_lock_id_for_branch_id(self.branch_id)
1866 reactor.spawnProcess(protocol, interpreter, command, env=env)
1867 return deferred
1868
1869diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
1870index 716e2f5..59223a3 100644
1871--- a/lib/lp/codehosting/puller/tests/__init__.py
1872+++ b/lib/lp/codehosting/puller/tests/__init__.py
1873@@ -10,13 +10,13 @@ import shutil
1874 import socket
1875 from StringIO import StringIO
1876
1877-from bzrlib.tests import TestCaseWithTransport
1878-from bzrlib.tests.http_server import (
1879+from breezy.tests import TestCaseWithTransport
1880+from breezy.tests.http_server import (
1881 HttpServer,
1882 TestingHTTPServer,
1883 TestingThreadingHTTPServer,
1884 )
1885-from bzrlib.url_policy_open import AcceptAnythingPolicy
1886+from breezy.url_policy_open import AcceptAnythingPolicy
1887
1888 from lp.codehosting.puller.worker import (
1889 BranchMirrorer,
1890diff --git a/lib/lp/codehosting/puller/tests/test_acceptance.py b/lib/lp/codehosting/puller/tests/test_acceptance.py
1891index f835b65..305e52b 100644
1892--- a/lib/lp/codehosting/puller/tests/test_acceptance.py
1893+++ b/lib/lp/codehosting/puller/tests/test_acceptance.py
1894@@ -13,15 +13,15 @@ from subprocess import (
1895 Popen,
1896 )
1897
1898-from bzrlib import errors
1899-from bzrlib.branch import Branch
1900-from bzrlib.bzrdir import BzrDir
1901-from bzrlib.upgrade import upgrade
1902-from bzrlib.urlutils import (
1903+from breezy import errors
1904+from breezy.branch import Branch
1905+from breezy.bzr.bzrdir import BzrDir
1906+from breezy.upgrade import upgrade
1907+from breezy.urlutils import (
1908 join as urljoin,
1909 local_path_from_url,
1910 )
1911-from bzrlib.workingtree import WorkingTree
1912+from breezy.workingtree import WorkingTree
1913 from fixtures import TempDir
1914 import transaction
1915 from zope.component import getUtility
1916@@ -284,7 +284,7 @@ class TestBranchPuller(PullerBranchTestCase, LoomTestMixin):
1917 branch_url = urljoin(
1918 config.launchpad.bzr_imports_root_url, '%08x' % db_branch.id)
1919 branch = BzrDir.create_branch_convenience(branch_url)
1920- tree = branch.bzrdir.open_workingtree()
1921+ tree = branch.controldir.open_workingtree()
1922 tree.commit('rev1')
1923
1924 transaction.commit()
1925diff --git a/lib/lp/codehosting/puller/tests/test_errors.py b/lib/lp/codehosting/puller/tests/test_errors.py
1926index 9416799..1819e95 100644
1927--- a/lib/lp/codehosting/puller/tests/test_errors.py
1928+++ b/lib/lp/codehosting/puller/tests/test_errors.py
1929@@ -11,14 +11,14 @@ import socket
1930 import tempfile
1931 import urllib2
1932
1933-from bzrlib.errors import (
1934+from breezy.errors import (
1935 BzrError,
1936 NotBranchError,
1937 ParamikoNotPresent,
1938 UnknownFormatError,
1939 UnsupportedFormatError,
1940 )
1941-from bzrlib.url_policy_open import (
1942+from breezy.url_policy_open import (
1943 BranchLoopError,
1944 BranchReferenceForbidden,
1945 )
1946diff --git a/lib/lp/codehosting/puller/tests/test_scheduler.py b/lib/lp/codehosting/puller/tests/test_scheduler.py
1947index df1d0c9..2b08509 100644
1948--- a/lib/lp/codehosting/puller/tests/test_scheduler.py
1949+++ b/lib/lp/codehosting/puller/tests/test_scheduler.py
1950@@ -7,12 +7,10 @@ import logging
1951 import os
1952 import textwrap
1953
1954-from bzrlib.branch import Branch
1955-from bzrlib.bzrdir import (
1956- BzrDir,
1957- format_registry,
1958- )
1959-from bzrlib.urlutils import join as urljoin
1960+from breezy.branch import Branch
1961+from breezy.bzr.bzrdir import BzrDir
1962+from breezy.controldir import format_registry
1963+from breezy.urlutils import join as urljoin
1964 from testtools.twistedsupport import (
1965 assert_fails_with,
1966 AsynchronousDeferredRunTest,
1967@@ -545,7 +543,7 @@ parser = OptionParser()
1968 (options, arguments) = parser.parse_args()
1969 (source_url, destination_url, branch_id, unique_name,
1970 branch_type_name, default_stacked_on_url) = arguments
1971-from bzrlib import branch
1972+from breezy import branch
1973 branch = branch.Branch.open(destination_url)
1974 protocol = PullerWorkerProtocol(sys.stdout)
1975 """
1976@@ -865,7 +863,7 @@ class TestPullerMasterIntegration(PullerBranchTestCase):
1977 # We have to use a custom worker script to lower the time we wait for
1978 # the lock for (the default is five minutes, too long for a test!)
1979 lower_timeout_script = """
1980- from bzrlib import lockdir
1981+ from breezy import lockdir
1982 lockdir._DEFAULT_TIMEOUT_SECONDS = 2.0
1983 from lp.code.enums import BranchType
1984 from lp.codehosting.puller.worker import (
1985diff --git a/lib/lp/codehosting/puller/tests/test_worker.py b/lib/lp/codehosting/puller/tests/test_worker.py
1986index d6cbaf3..addfcbb 100644
1987--- a/lib/lp/codehosting/puller/tests/test_worker.py
1988+++ b/lib/lp/codehosting/puller/tests/test_worker.py
1989@@ -8,21 +8,21 @@ __metaclass__ = type
1990 import gc
1991 from StringIO import StringIO
1992
1993-import bzrlib.branch
1994-from bzrlib.branch import BranchReferenceFormat
1995-from bzrlib.bzrdir import BzrDir
1996-from bzrlib.errors import (
1997+import breezy.branch
1998+from breezy.bzr.branch import BranchReferenceFormat
1999+from breezy.bzr.bzrdir import BzrDir
2000+from breezy.errors import (
2001 IncompatibleRepositories,
2002 NotBranchError,
2003 NotStacked,
2004 )
2005-from bzrlib.revision import NULL_REVISION
2006-from bzrlib.tests import (
2007+from breezy.revision import NULL_REVISION
2008+from breezy.tests import (
2009 TestCaseInTempDir,
2010 TestCaseWithTransport,
2011 )
2012-from bzrlib.transport import get_transport
2013-from bzrlib.url_policy_open import (
2014+from breezy.transport import get_transport
2015+from breezy.url_policy_open import (
2016 AcceptAnythingPolicy,
2017 BadUrl,
2018 BranchOpener,
2019@@ -124,7 +124,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2020 source_tree.branch.base, self.get_url('dest'))
2021 source_tree.commit('commit message')
2022 to_mirror.mirrorWithoutChecks()
2023- mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)
2024+ mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
2025 self.assertEqual(
2026 source_tree.last_revision(), mirrored_branch.last_revision())
2027
2028@@ -134,7 +134,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2029 to_mirror = self.makePullerWorker(
2030 source_branch.base, self.get_url('dest'))
2031 to_mirror.mirrorWithoutChecks()
2032- mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)
2033+ mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
2034 self.assertEqual(NULL_REVISION, mirrored_branch.last_revision())
2035
2036 def testCanMirrorWhenDestDirExists(self):
2037@@ -150,9 +150,9 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2038 dest.mkdir('.bzr')
2039 # 'dest' is not a branch.
2040 self.assertRaises(
2041- NotBranchError, bzrlib.branch.Branch.open, to_mirror.dest)
2042+ NotBranchError, breezy.branch.Branch.open, to_mirror.dest)
2043 to_mirror.mirrorWithoutChecks()
2044- mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)
2045+ mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
2046 self.assertEqual(
2047 source_tree.last_revision(), mirrored_branch.last_revision())
2048
2049@@ -179,7 +179,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2050 source_branch.base, self.get_url('destdir'),
2051 policy=PrearrangedStackedBranchPolicy(stack_on.base))
2052 to_mirror.mirrorWithoutChecks()
2053- dest = bzrlib.branch.Branch.open(self.get_url('destdir'))
2054+ dest = breezy.branch.Branch.open(self.get_url('destdir'))
2055 self.assertFalse(dest._format.supports_stacking())
2056
2057 def test_defaultStackedOnBranchIncompatibleMirrorsOK(self):
2058@@ -192,7 +192,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2059 source_branch.base, self.get_url('destdir'),
2060 policy=PrearrangedStackedBranchPolicy(stack_on.base))
2061 to_mirror.mirrorWithoutChecks()
2062- dest = bzrlib.branch.Branch.open(self.get_url('destdir'))
2063+ dest = breezy.branch.Branch.open(self.get_url('destdir'))
2064 self.assertRaises(NotStacked, dest.get_stacked_on_url)
2065
2066 def testCanMirrorWithIncompatibleRepos(self):
2067@@ -212,7 +212,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2068 # IncompatibleRepositories.
2069 self.assertRaises(
2070 IncompatibleRepositories,
2071- bzrlib.branch.Branch.open, 'dest/stacked')
2072+ breezy.branch.Branch.open, 'dest/stacked')
2073 source_branch = self.make_branch(
2074 'source-branch', format='2a')
2075 to_mirror = self.makePullerWorker(
2076@@ -220,7 +220,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
2077 # The branch can be mirrored without errors and the destionation
2078 # location is upgraded to match the source format.
2079 to_mirror.mirrorWithoutChecks()
2080- mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)
2081+ mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
2082 self.assertEqual(
2083 source_branch.repository._format,
2084 mirrored_branch.repository._format)
2085@@ -286,7 +286,7 @@ class TestReferenceOpener(TestCaseWithTransport):
2086 :return: file url to the created pure branch reference.
2087 """
2088 # XXX DavidAllouche 2007-09-12 bug=139109:
2089- # We do this manually because the bzrlib API does not support creating
2090+ # We do this manually because the breezy API does not support creating
2091 # a branch reference without opening it.
2092 t = get_transport(self.get_url('.'))
2093 t.mkdir('reference')
2094@@ -314,7 +314,7 @@ class TestReferenceOpener(TestCaseWithTransport):
2095
2096 # Open the branch reference and check that the result is indeed the
2097 # branch we wanted it to point at.
2098- opened_branch = bzrlib.branch.Branch.open(reference_url)
2099+ opened_branch = breezy.branch.Branch.open(reference_url)
2100 self.assertEqual(opened_branch.base, target_branch.base)
2101
2102 def testFollowReferenceValue(self):
2103@@ -496,9 +496,9 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
2104 def setUp(self):
2105 super(TestWorkerProgressReporting, self).setUp()
2106 BranchOpener.install_hook()
2107- self.saved_factory = bzrlib.ui.ui_factory
2108+ self.saved_factory = breezy.ui.ui_factory
2109 self.disable_directory_isolation()
2110- self.addCleanup(setattr, bzrlib.ui, 'ui_factory', self.saved_factory)
2111+ self.addCleanup(setattr, breezy.ui, 'ui_factory', self.saved_factory)
2112
2113 def getHttpServerForCwd(self):
2114 """Get an `HttpServer` instance that serves from '.'."""
2115@@ -530,7 +530,7 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
2116
2117 p = self.StubProtocol()
2118 install_worker_ui_factory(p)
2119- b2_http = bzrlib.branch.Branch.open(
2120+ b2_http = breezy.branch.Branch.open(
2121 http_server.get_url() + 'some-other-branch')
2122 b1.pull(b2_http)
2123 self.assertSubset([WORKER_ACTIVITY_NETWORK], p.calls)
2124diff --git a/lib/lp/codehosting/puller/tests/test_worker_formats.py b/lib/lp/codehosting/puller/tests/test_worker_formats.py
2125index 3cc8873..b065ffa 100644
2126--- a/lib/lp/codehosting/puller/tests/test_worker_formats.py
2127+++ b/lib/lp/codehosting/puller/tests/test_worker_formats.py
2128@@ -5,19 +5,19 @@
2129
2130 __metaclass__ = type
2131
2132-from bzrlib.branch import Branch
2133-from bzrlib.bzrdir import BzrDirMetaFormat1
2134-from bzrlib.plugins.weave_fmt.bzrdir import BzrDirFormat6
2135-from bzrlib.plugins.weave_fmt.repository import (
2136+from breezy.branch import Branch
2137+from breezy.bzr.bzrdir import BzrDirMetaFormat1
2138+from breezy.bzr.knitpack_repo import RepositoryFormatKnitPack5
2139+from breezy.bzr.knitrepo import RepositoryFormatKnit1
2140+from breezy.plugins.weave_fmt.bzrdir import BzrDirFormat6
2141+from breezy.plugins.weave_fmt.repository import (
2142 RepositoryFormat6,
2143 RepositoryFormat7,
2144 )
2145-from bzrlib.repofmt.knitpack_repo import RepositoryFormatKnitPack5
2146-from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
2147-from bzrlib.tests.per_repository import TestCaseWithRepository
2148-from bzrlib.url_policy_open import BranchOpener
2149+from breezy.tests.per_repository import TestCaseWithRepository
2150+from breezy.url_policy_open import BranchOpener
2151
2152-import lp.codehosting # For bzr plugins.
2153+import lp.codehosting # For brz plugins.
2154 from lp.codehosting.puller.tests import PullerWorkerMixin
2155 from lp.codehosting.tests.helpers import LoomTestMixin
2156
2157@@ -27,7 +27,7 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
2158
2159 def setUp(self):
2160 TestCaseWithRepository.setUp(self)
2161- # make_bzrdir relies on this being a relative filesystem path.
2162+ # make_controldir relies on this being a relative filesystem path.
2163 self._source_branch_path = 'source-branch'
2164 BranchOpener.install_hook()
2165 self.worker = self.makePullerWorker(
2166@@ -39,7 +39,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
2167 """Make a source branch with the given formats."""
2168 if branch_format is not None:
2169 bzrdir_format.set_branch_format(branch_format)
2170- bd = self.make_bzrdir(self._source_branch_path, format=bzrdir_format)
2171+ bd = self.make_controldir(
2172+ self._source_branch_path, format=bzrdir_format)
2173 repository_format.initialize(bd)
2174 branch = bd.create_branch()
2175 tree = branch.create_checkout('source-checkout')
2176@@ -58,8 +59,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
2177 source_branch.repository._format.get_format_description(),
2178 dest_branch.repository._format.get_format_description())
2179 self.assertEqual(
2180- source_branch.bzrdir._format.get_format_description(),
2181- dest_branch.bzrdir._format.get_format_description())
2182+ source_branch.controldir._format.get_format_description(),
2183+ dest_branch.controldir._format.get_format_description())
2184
2185 def _testMirrorWithFormats(self, repository_format, bzrdir_format):
2186 """Make a branch with certain formats, mirror it and check the mirror.
2187@@ -85,9 +86,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
2188 self.assertMirrored(branch, mirrored_branch)
2189
2190 # XXX: JonathanLange 2008-06-25: These next three tests should be
2191- # implemented against all supported repository formats using bzrlib's test
2192- # adaptation APIs. Unfortunately, this API changes between 1.5 and 1.6, so
2193- # it'd be a bit silly to do the work now.
2194+ # implemented against all supported repository formats using breezy's test
2195+ # adaptation APIs.
2196 def testMirrorKnitAsKnit(self):
2197 # Create a source branch in knit format, and check that the mirror is
2198 # in knit format.
2199diff --git a/lib/lp/codehosting/puller/worker.py b/lib/lp/codehosting/puller/worker.py
2200index e0ff5b4..d0ed4ca 100644
2201--- a/lib/lp/codehosting/puller/worker.py
2202+++ b/lib/lp/codehosting/puller/worker.py
2203@@ -12,22 +12,25 @@ import urllib2
2204 # line below this comment.
2205 import lp.codehosting
2206
2207-from bzrlib import (
2208+from breezy import (
2209 errors,
2210 urlutils,
2211 )
2212-from bzrlib.branch import Branch
2213-from bzrlib.plugins.loom.branch import LoomSupport
2214-from bzrlib.plugins.weave_fmt.branch import BzrBranchFormat4
2215-from bzrlib.plugins.weave_fmt.repository import (
2216+from breezy.branch import (
2217+ Branch,
2218+ UnstackableBranchFormat,
2219+ )
2220+from breezy.plugins.loom.branch import LoomSupport
2221+from breezy.plugins.weave_fmt.branch import BzrBranchFormat4
2222+from breezy.plugins.weave_fmt.repository import (
2223 RepositoryFormat4,
2224 RepositoryFormat5,
2225 RepositoryFormat6,
2226 )
2227-from bzrlib.transport import get_transport
2228-import bzrlib.ui
2229-from bzrlib.ui import SilentUIFactory
2230-from bzrlib.url_policy_open import (
2231+from breezy.transport import get_transport
2232+import breezy.ui
2233+from breezy.ui import SilentUIFactory
2234+from breezy.url_policy_open import (
2235 BadUrl,
2236 BranchLoopError,
2237 BranchOpener,
2238@@ -158,7 +161,7 @@ class BranchMirrorerPolicy(BranchOpenPolicy):
2239 revision_id = None
2240 else:
2241 revision_id = 'null:'
2242- source_branch.bzrdir.clone_on_transport(
2243+ source_branch.controldir.clone_on_transport(
2244 dest_transport, revision_id=revision_id)
2245 return Branch.open(destination_url)
2246
2247@@ -251,7 +254,7 @@ class BranchMirrorer(object):
2248 try:
2249 dest_branch.set_stacked_on_url(stacked_on_url)
2250 except (errors.UnstackableRepositoryFormat,
2251- errors.UnstackableBranchFormat,
2252+ UnstackableBranchFormat,
2253 errors.IncompatibleRepositories):
2254 stacked_on_url = None
2255 if stacked_on_url is None:
2256@@ -448,7 +451,7 @@ class PullerWorker:
2257 # XXX: Aaron Bentley 2008-06-13
2258 # Bazaar does not provide a public API for learning about
2259 # format markers. Fix this in Bazaar, then here.
2260- control_string = dest_branch.bzrdir._format.get_format_string()
2261+ control_string = dest_branch.controldir._format.get_format_string()
2262 if dest_branch._format.__class__ is BzrBranchFormat4:
2263 branch_string = BranchFormat.BZR_BRANCH_4.title
2264 else:
2265@@ -488,8 +491,10 @@ class PullerWorkerUIFactory(SilentUIFactory):
2266 def confirm_action(self, prompt, confirmation_id, args):
2267 """If we're asked to break a lock like a stale lock of ours, say yes.
2268 """
2269- assert confirmation_id == 'bzrlib.lockdir.break', \
2270- "Didn't expect confirmation id %r" % (confirmation_id,)
2271+ if confirmation_id not in (
2272+ 'bzrlib.lockdir.break', 'breezy.lockdir.break'):
2273+ raise AssertionError(
2274+ "Didn't expect confirmation id %r" % (confirmation_id,))
2275 branch_id = self.puller_worker_protocol.branch_id
2276 prompt = prompt % args
2277 if get_lock_id_for_branch_id(branch_id) in prompt:
2278@@ -518,7 +523,7 @@ def install_worker_ui_factory(puller_worker_protocol):
2279 2) Break locks if and only if they appear to be stale locks
2280 created by another puller worker process.
2281 """
2282- bzrlib.ui.ui_factory = PullerWorkerUIFactory(puller_worker_protocol)
2283+ breezy.ui.ui_factory = PullerWorkerUIFactory(puller_worker_protocol)
2284
2285
2286 class MirroredBranchPolicy(BranchMirrorerPolicy):
2287@@ -600,7 +605,7 @@ class ImportedBranchPolicy(BranchMirrorerPolicy):
2288 Because we control the process that creates import branches, a
2289 vfs-level copy is safe and more efficient than a bzr fetch.
2290 """
2291- source_transport = source_branch.bzrdir.root_transport
2292+ source_transport = source_branch.controldir.root_transport
2293 dest_transport = get_transport(destination_url)
2294 while True:
2295 # We loop until the remote file list before and after the copy is
2296diff --git a/lib/lp/codehosting/rewrite.py b/lib/lp/codehosting/rewrite.py
2297index c6e204d..f59520b 100644
2298--- a/lib/lp/codehosting/rewrite.py
2299+++ b/lib/lp/codehosting/rewrite.py
2300@@ -6,7 +6,7 @@
2301
2302 import time
2303
2304-from bzrlib import urlutils
2305+from breezy import urlutils
2306 from zope.component import getUtility
2307 from zope.security.interfaces import Unauthorized
2308
2309diff --git a/lib/lp/codehosting/scanner/buglinks.py b/lib/lp/codehosting/scanner/buglinks.py
2310index 539bd93..95d8eaa 100644
2311--- a/lib/lp/codehosting/scanner/buglinks.py
2312+++ b/lib/lp/codehosting/scanner/buglinks.py
2313@@ -10,7 +10,7 @@ __all__ = [
2314
2315 import urlparse
2316
2317-from bzrlib.errors import InvalidBugStatus
2318+from breezy.bugtracker import InvalidBugStatus
2319 from zope.component import getUtility
2320
2321 from lp.app.errors import NotFoundError
2322diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
2323index 0161972..4eab1a9 100755
2324--- a/lib/lp/codehosting/scanner/bzrsync.py
2325+++ b/lib/lp/codehosting/scanner/bzrsync.py
2326@@ -16,8 +16,8 @@ __all__ = [
2327
2328 import logging
2329
2330-from bzrlib.graph import DictParentsProvider
2331-from bzrlib.revision import NULL_REVISION
2332+from breezy.graph import DictParentsProvider
2333+from breezy.revision import NULL_REVISION
2334 import pytz
2335 import six
2336 from storm.locals import Store
2337@@ -91,7 +91,7 @@ class BzrSync:
2338 self.logger.info(" from %s", bzr_branch.base)
2339 # Get the history and ancestry from the branch first, to fail early
2340 # if something is wrong with the branch.
2341- self.logger.info("Retrieving history from bzrlib.")
2342+ self.logger.info("Retrieving history from breezy.")
2343 bzr_history = branch_revision_history(bzr_branch)
2344 # The BranchRevision, Revision and RevisionParent tables are only
2345 # written to by the branch-scanner, so they are not subject to
2346@@ -197,7 +197,7 @@ class BzrSync:
2347
2348 def planDatabaseChanges(self, bzr_branch, bzr_history, db_ancestry,
2349 db_history):
2350- """Plan database changes to synchronize with bzrlib data.
2351+ """Plan database changes to synchronize with breezy data.
2352
2353 Use the data retrieved by `retrieveDatabaseAncestry` and
2354 `retrieveBranchDetails` to plan the changes to apply to the database.
2355@@ -240,7 +240,7 @@ class BzrSync:
2356 def getBazaarRevisions(self, bzr_branch, revisions):
2357 """Like ``get_revisions(revisions)`` but filter out ghosts first.
2358
2359- :param revisions: the set of Bazaar revision IDs to return bzrlib
2360+ :param revisions: the set of Breezy revision IDs to return breezy
2361 Revision objects for.
2362 """
2363 revisions = bzr_branch.repository.get_parent_map(revisions)
2364@@ -249,9 +249,9 @@ class BzrSync:
2365 def syncRevisions(self, bzr_branch, bzr_revisions, revids_to_insert):
2366 """Import the supplied revisions.
2367
2368- :param bzr_branch: The Bazaar branch that's being scanned.
2369+ :param bzr_branch: The Breezy branch that's being scanned.
2370 :param bzr_revisions: the revisions to import
2371- :type bzr_revision: bzrlib.revision.Revision
2372+ :type bzr_revision: breezy.revision.Revision
2373 :param revids_to_insert: a dict of revision ids to integer
2374 revno. Non-mainline revisions will be mapped to None.
2375 """
2376diff --git a/lib/lp/codehosting/scanner/mergedetection.py b/lib/lp/codehosting/scanner/mergedetection.py
2377index db23fdb..0e5dcd5 100644
2378--- a/lib/lp/codehosting/scanner/mergedetection.py
2379+++ b/lib/lp/codehosting/scanner/mergedetection.py
2380@@ -9,7 +9,7 @@ __all__ = [
2381 'auto_merge_proposals',
2382 ]
2383
2384-from bzrlib.revision import NULL_REVISION
2385+from breezy.revision import NULL_REVISION
2386 from zope.component import getUtility
2387
2388 from lp.code.adapters.branch import BranchMergeProposalNoPreviewDiffDelta
2389diff --git a/lib/lp/codehosting/scanner/tests/test_buglinks.py b/lib/lp/codehosting/scanner/tests/test_buglinks.py
2390index bfa2981..935af50 100644
2391--- a/lib/lp/codehosting/scanner/tests/test_buglinks.py
2392+++ b/lib/lp/codehosting/scanner/tests/test_buglinks.py
2393@@ -1,11 +1,11 @@
2394 # Copyright 2009 Canonical Ltd. This software is licensed under the
2395 # GNU Affero General Public License version 3 (see the file LICENSE).
2396
2397-"""Tests for creating BugBranch items based on Bazaar revisions."""
2398+"""Tests for creating BugBranch items based on Breezy revisions."""
2399
2400 __metaclass__ = type
2401
2402-from bzrlib.revision import Revision
2403+from breezy.revision import Revision
2404 from zope.component import getUtility
2405 from zope.event import notify
2406
2407@@ -192,7 +192,7 @@ class TestBugLinking(BzrSyncTestCase):
2408 author = self.factory.getUniqueString()
2409 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2410 # required to generate the revision-id.
2411- with override_environ(BZR_EMAIL='me@example.com'):
2412+ with override_environ(BRZ_EMAIL='me@example.com'):
2413 self.bzr_tree.commit(
2414 u'common parent', committer=author, rev_id='r1',
2415 allow_pointless=True)
2416@@ -253,7 +253,7 @@ class TestSubscription(TestCaseWithFactory):
2417 switch_dbuser("branchscanner")
2418 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2419 # required to generate the revision-id.
2420- with override_environ(BZR_EMAIL='me@example.com'):
2421+ with override_environ(BRZ_EMAIL='me@example.com'):
2422 revision_id = tree.commit('fix revision',
2423 revprops={
2424 'bugs': 'https://launchpad.net/bugs/%d fixed' % bug.id})
2425diff --git a/lib/lp/codehosting/scanner/tests/test_bzrsync.py b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
2426index 660d101..9ddc355 100644
2427--- a/lib/lp/codehosting/scanner/tests/test_bzrsync.py
2428+++ b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
2429@@ -8,13 +8,13 @@ import os
2430 import random
2431 import time
2432
2433-from bzrlib.revision import (
2434+from breezy.revision import (
2435 NULL_REVISION,
2436 Revision as BzrRevision,
2437 )
2438-from bzrlib.tests import TestCaseWithTransport
2439-from bzrlib.uncommit import uncommit
2440-from bzrlib.url_policy_open import BranchOpener
2441+from breezy.tests import TestCaseWithTransport
2442+from breezy.uncommit import uncommit
2443+from breezy.url_policy_open import BranchOpener
2444 from fixtures import (
2445 FakeLogger,
2446 TempDir,
2447@@ -191,7 +191,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
2448 self.bzr_tree.add_pending_merge(*extra_parents)
2449 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2450 # required to generate the revision-id.
2451- with override_environ(BZR_EMAIL='me@example.com'):
2452+ with override_environ(BRZ_EMAIL='me@example.com'):
2453 return self.bzr_tree.commit(
2454 message, committer=committer, rev_id=rev_id,
2455 timestamp=timestamp, timezone=timezone, allow_pointless=True,
2456@@ -240,7 +240,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
2457 db_branch=db_branch)
2458 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2459 # required to generate the revision-id.
2460- with override_environ(BZR_EMAIL='me@example.com'):
2461+ with override_environ(BRZ_EMAIL='me@example.com'):
2462 trunk_tree.commit(u'base revision', rev_id=base_rev_id)
2463
2464 # Branch from the base revision.
2465@@ -572,7 +572,8 @@ class TestPlanDatabaseChanges(BzrSyncTestCase):
2466 # deletion anyway.
2467 rev1_id = self.bzr_tree.commit(
2468 'initial commit', committer='me@example.org')
2469- merge_tree = self.bzr_tree.bzrdir.sprout('merge').open_workingtree()
2470+ merge_tree = self.bzr_tree.controldir.sprout(
2471+ 'merge').open_workingtree()
2472 merge_id = merge_tree.commit(
2473 'mergeable commit', committer='me@example.org')
2474 self.bzr_tree.merge_from_branch(merge_tree.branch)
2475diff --git a/lib/lp/codehosting/scanner/tests/test_email.py b/lib/lp/codehosting/scanner/tests/test_email.py
2476index 39ccec3..a403251 100644
2477--- a/lib/lp/codehosting/scanner/tests/test_email.py
2478+++ b/lib/lp/codehosting/scanner/tests/test_email.py
2479@@ -8,7 +8,7 @@ __metaclass__ = type
2480 import email
2481 import os
2482
2483-from bzrlib.uncommit import uncommit
2484+from breezy.uncommit import uncommit
2485 from zope.component import getUtility
2486 from zope.event import notify
2487
2488diff --git a/lib/lp/codehosting/scanner/tests/test_mergedetection.py b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
2489index 3d4508e..c0cb7ad 100644
2490--- a/lib/lp/codehosting/scanner/tests/test_mergedetection.py
2491+++ b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
2492@@ -7,7 +7,7 @@ __metaclass__ = type
2493
2494 import logging
2495
2496-from bzrlib.revision import NULL_REVISION
2497+from breezy.revision import NULL_REVISION
2498 from lazr.lifecycle.event import ObjectModifiedEvent
2499 import transaction
2500 from zope.component import getUtility
2501@@ -143,7 +143,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
2502
2503 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2504 # required to generate the revision-id.
2505- with override_environ(BZR_EMAIL='me@example.com'):
2506+ with override_environ(BRZ_EMAIL='me@example.com'):
2507 branch_tree.commit(u'another revision', rev_id='another-rev')
2508 current_proposal_status = proposal.queue_status
2509 self.assertNotEqual(
2510@@ -164,7 +164,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
2511
2512 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
2513 # required to generate the revision-id.
2514- with override_environ(BZR_EMAIL='me@example.com'):
2515+ with override_environ(BRZ_EMAIL='me@example.com'):
2516 branch_tree.commit(u'another revision', rev_id='another-rev')
2517 current_proposal_status = proposal.queue_status
2518 self.assertNotEqual(
2519diff --git a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
2520index b820539..5f9443f 100644
2521--- a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
2522+++ b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
2523@@ -8,7 +8,7 @@ import logging
2524 import os
2525 from os.path import dirname
2526
2527-from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
2528+from breezy.bzr.groupcompress_repo import RepositoryFormat2a
2529 from fixtures import TempDir
2530 import transaction
2531
2532diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
2533index 4c7e7fb..51d42e7 100644
2534--- a/lib/lp/codehosting/sftp.py
2535+++ b/lib/lp/codehosting/sftp.py
2536@@ -24,12 +24,12 @@ import errno
2537 import os
2538 import stat
2539
2540-from bzrlib import (
2541+from breezy import (
2542 errors as bzr_errors,
2543 osutils,
2544 urlutils,
2545 )
2546-from bzrlib.transport.local import LocalTransport
2547+from breezy.transport.local import LocalTransport
2548 from lazr.sshserver.sftp import FileIsADirectory
2549 from twisted.conch.interfaces import (
2550 ISFTPFile,
2551@@ -160,7 +160,7 @@ class TransportSFTPFile:
2552 def _truncateFile(self):
2553 """Truncate this file."""
2554 self._written = True
2555- return self.transport.put_bytes(self._escaped_path, '')
2556+ return self.transport.put_bytes(self._escaped_path, b'')
2557
2558 @with_sftp_error
2559 def writeChunk(self, offset, data):
2560@@ -198,7 +198,7 @@ class TransportSFTPFile:
2561
2562 Doing things this way around, by trying to read all the data
2563 requested and then handling the short read error, might be a bit
2564- inefficient, but the bzrlib sftp transport doesn't read past the
2565+ inefficient, but the breezy sftp transport doesn't read past the
2566 end of files, so we don't need to worry too much about performance
2567 here.
2568 """
2569diff --git a/lib/lp/codehosting/sshserver/session.py b/lib/lp/codehosting/sshserver/session.py
2570index 64567fe..91d31e4 100644
2571--- a/lib/lp/codehosting/sshserver/session.py
2572+++ b/lib/lp/codehosting/sshserver/session.py
2573@@ -26,7 +26,7 @@ from twisted.python import log
2574 from zope.event import notify
2575 from zope.interface import implementer
2576
2577-from lp.codehosting import get_bzr_path
2578+from lp.codehosting import get_brz_path
2579 from lp.services.config import config
2580
2581
2582@@ -141,16 +141,17 @@ class ForkedProcessTransport(process.BaseProcess):
2583
2584 :return: The pid, communication directory, and request socket.
2585 """
2586- assert executable == 'bzr', executable # Maybe .endswith()
2587- assert args[0] == 'bzr', args[0]
2588+ assert executable == 'brz', executable # Maybe .endswith()
2589+ assert args[0] == 'brz', args[0]
2590 message = ['fork-env %s\n' % (' '.join(args[1:]),)]
2591 for key, value in environment.iteritems():
2592- # XXX: Currently we only pass BZR_EMAIL, should we be passing
2593+ # XXX: Currently we only pass BRZ_EMAIL, should we be passing
2594 # everything else? Note that many won't be handled properly,
2595 # since the process is already running.
2596- if key != 'BZR_EMAIL':
2597- continue
2598- message.append('%s: %s\n' % (key, value))
2599+ if key in ('BZR_EMAIL', 'BRZ_EMAIL'):
2600+ # Map both of these to BRZ_EMAIL, since we run brz on the
2601+ # server.
2602+ message.append('BRZ_EMAIL: %s\n' % (value,))
2603 message.append('end\n')
2604 message = ''.join(message)
2605 response, sock = self._sendMessageToService(message)
2606@@ -418,7 +419,7 @@ class ForkingRestrictedExecOnlySession(RestrictedExecOnlySession):
2607 def _simplifyEnvironment(self, env):
2608 """Pull out the bits of the environment we want to pass along."""
2609 env = {}
2610- for env_var in ['BZR_EMAIL']:
2611+ for env_var in ['BRZ_EMAIL']:
2612 if env_var in self.environment:
2613 env[env_var] = self.environment[env_var]
2614 return env
2615@@ -426,15 +427,15 @@ class ForkingRestrictedExecOnlySession(RestrictedExecOnlySession):
2616 def getCommandToFork(self, executable, arguments, env):
2617 assert executable.endswith('/bin/py')
2618 assert arguments[0] == executable
2619- assert arguments[1].endswith('/bzr')
2620- executable = 'bzr'
2621+ assert arguments[1].endswith('/brz')
2622+ executable = 'brz'
2623 arguments = arguments[1:]
2624- arguments[0] = 'bzr'
2625+ arguments[0] = 'brz'
2626 env = self._simplifyEnvironment(env)
2627 return executable, arguments, env
2628
2629 def _spawn(self, protocol, executable, arguments, env):
2630- # When spawning, adapt the idea of "bin/py .../bzr" to just using "bzr"
2631+ # When spawning, adapt the idea of "bin/py .../brz" to just using "brz"
2632 # and the executable
2633 executable, arguments, env = self.getCommandToFork(executable,
2634 arguments, env)
2635@@ -449,16 +450,18 @@ def lookup_command_template(command):
2636 :return: Command template
2637 :raise ForbiddenCommand: Raised when command isn't allowed
2638 """
2639- python_command = "%(root)s/bin/py %(bzr)s" % {
2640+ python_command = "%(root)s/bin/py %(brz)s" % {
2641 'root': config.root,
2642- 'bzr': get_bzr_path(),
2643+ 'brz': get_brz_path(),
2644 }
2645 args = " lp-serve --inet %(user_id)s"
2646 command_template = python_command + args
2647
2648- if command == 'bzr serve --inet --directory=/ --allow-writes':
2649+ if command in (
2650+ 'bzr serve --inet --directory=/ --allow-writes',
2651+ 'brz serve --inet --directory=/ --allow-writes'):
2652 return command_template
2653- # At the moment, only bzr branch serving is allowed.
2654+ # At the moment, only bzr/brz branch serving is allowed.
2655 raise ForbiddenCommand("Not allowed to execute %r." % (command,))
2656
2657
2658@@ -469,7 +472,7 @@ def launch_smart_server(avatar):
2659
2660 # Extract the hostname from the supermirror root config.
2661 hostname = urlparse.urlparse(config.codehosting.supermirror_root)[1]
2662- environment['BZR_EMAIL'] = '%s@%s' % (avatar.username, hostname)
2663+ environment['BRZ_EMAIL'] = '%s@%s' % (avatar.username, hostname)
2664 # TODO: Use a FeatureFlag to enable this in a more fine-grained approach.
2665 # If the forking daemon has been spawned, then we can use it if the
2666 # feature is set to true for the given user, etc.
2667diff --git a/lib/lp/codehosting/sshserver/tests/test_session.py b/lib/lp/codehosting/sshserver/tests/test_session.py
2668index 7b1ad2f..a212873 100644
2669--- a/lib/lp/codehosting/sshserver/tests/test_session.py
2670+++ b/lib/lp/codehosting/sshserver/tests/test_session.py
2671@@ -13,8 +13,8 @@ from twisted.internet.process import ProcessExitedAlready
2672 from twisted.internet.protocol import ProcessProtocol
2673
2674 from lp.codehosting import (
2675- get_bzr_path,
2676- get_BZR_PLUGIN_PATH_for_subprocess,
2677+ get_brz_path,
2678+ get_BRZ_PLUGIN_PATH_for_subprocess,
2679 )
2680 from lp.codehosting.sshserver.daemon import CodehostingAvatar
2681 from lp.codehosting.sshserver.session import (
2682@@ -382,18 +382,18 @@ class TestSessionIntegration(AvatarTestCase):
2683 "ISession(avatar) doesn't adapt to ExecOnlySession. "
2684 "Got %r instead." % (session,))
2685 self.assertEqual(
2686- get_BZR_PLUGIN_PATH_for_subprocess(),
2687- session.environment['BZR_PLUGIN_PATH'])
2688+ get_BRZ_PLUGIN_PATH_for_subprocess(),
2689+ session.environment['BRZ_PLUGIN_PATH'])
2690 self.assertEqual(
2691 '%s@bazaar.launchpad.test' % self.avatar.username,
2692- session.environment['BZR_EMAIL'])
2693+ session.environment['BRZ_EMAIL'])
2694
2695 executable, arguments = session.getCommandToRun(
2696 'bzr serve --inet --directory=/ --allow-writes')
2697 interpreter = '%s/bin/py' % config.root
2698 self.assertEqual(interpreter, executable)
2699 self.assertEqual(
2700- [interpreter, get_bzr_path(), 'lp-serve',
2701+ [interpreter, get_brz_path(), 'lp-serve',
2702 '--inet', str(self.avatar.user_id)],
2703 list(arguments))
2704 self.assertRaises(
2705@@ -422,9 +422,9 @@ class TestSessionIntegration(AvatarTestCase):
2706 'bzr serve --inet --directory=/ --allow-writes')
2707 executable, arguments, env = session.getCommandToFork(
2708 executable, arguments, session.environment)
2709- self.assertEqual('bzr', executable)
2710+ self.assertEqual('brz', executable)
2711 self.assertEqual(
2712- ['bzr', 'lp-serve',
2713+ ['brz', 'lp-serve',
2714 '--inet', str(self.avatar.user_id)],
2715 list(arguments))
2716
2717@@ -436,7 +436,14 @@ class TestLookupCommand(TestCase):
2718
2719 def test_bzr(self):
2720 self.assertEqual(
2721- config.root + '/bin/py ' + get_bzr_path() +
2722+ config.root + '/bin/py ' + get_brz_path() +
2723 ' lp-serve --inet %(user_id)s',
2724 lookup_command_template(
2725 'bzr serve --inet --directory=/ --allow-writes'))
2726+
2727+ def test_brz(self):
2728+ self.assertEqual(
2729+ config.root + '/bin/py ' + get_brz_path() +
2730+ ' lp-serve --inet %(user_id)s',
2731+ lookup_command_template(
2732+ 'brz serve --inet --directory=/ --allow-writes'))
2733diff --git a/lib/lp/codehosting/tests/helpers.py b/lib/lp/codehosting/tests/helpers.py
2734index e278e53..71d4a52 100644
2735--- a/lib/lp/codehosting/tests/helpers.py
2736+++ b/lib/lp/codehosting/tests/helpers.py
2737@@ -15,10 +15,9 @@ __all__ = [
2738
2739 import os
2740
2741-from bzrlib.bzrdir import BzrDir
2742-from bzrlib.errors import FileExists
2743-from bzrlib.plugins.loom import branch as loom_branch
2744-from bzrlib.tests import (
2745+from breezy.errors import FileExists
2746+from breezy.plugins.loom import branch as loom_branch
2747+from breezy.tests import (
2748 TestNotApplicable,
2749 TestSkipped,
2750 )
2751@@ -60,7 +59,7 @@ class LoomTestMixin:
2752 loom_branch.loomify(tree.branch)
2753 finally:
2754 tree.unlock()
2755- loom_tree = tree.bzrdir.open_workingtree()
2756+ loom_tree = tree.controldir.open_workingtree()
2757 loom_tree.lock_write()
2758 loom_tree.branch.new_thread('bottom-thread')
2759 loom_tree.commit('this is a commit', rev_id='commit-1')
2760@@ -78,7 +77,7 @@ class LoomTestMixin:
2761 loom_branch.loomify(tree.branch)
2762 finally:
2763 tree.unlock()
2764- loom_tree = tree.bzrdir.open_workingtree()
2765+ loom_tree = tree.controldir.open_workingtree()
2766 loom_tree.lock_write()
2767 loom_tree.branch.new_thread('bottom-thread')
2768 loom_tree.commit('this is a commit', rev_id='commit-1')
2769@@ -100,6 +99,9 @@ def make_bazaar_branch_and_tree(db_branch):
2770
2771 def create_branch_with_one_revision(branch_dir, format=None):
2772 """Create a dummy Bazaar branch at the given directory."""
2773+ # XXX cjwatson 2019-06-13: This still uses bzrlib until such time as the
2774+ # code import workers are ported to Breezy.
2775+ from bzrlib.bzrdir import BzrDir
2776 if not os.path.exists(branch_dir):
2777 os.makedirs(branch_dir)
2778 try:
2779@@ -124,7 +126,7 @@ def force_stacked_on_url(branch, url):
2780
2781
2782 class TestResultWrapper:
2783- """A wrapper for `TestResult` that knows about bzrlib's `TestSkipped`."""
2784+ """A wrapper for `TestResult` that knows about breezy's `TestSkipped`."""
2785
2786 def __init__(self, result):
2787 self.result = result
2788diff --git a/lib/lp/codehosting/tests/servers.py b/lib/lp/codehosting/tests/servers.py
2789index 99006c0..68c4a73 100644
2790--- a/lib/lp/codehosting/tests/servers.py
2791+++ b/lib/lp/codehosting/tests/servers.py
2792@@ -15,7 +15,7 @@ import os
2793 import shutil
2794 import tempfile
2795
2796-from bzrlib.transport import (
2797+from breezy.transport import (
2798 get_transport,
2799 Server,
2800 )
2801diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
2802index d840ebf..1b4e1bf 100644
2803--- a/lib/lp/codehosting/tests/test_acceptance.py
2804+++ b/lib/lp/codehosting/tests/test_acceptance.py
2805@@ -14,11 +14,11 @@ import time
2806 import urllib2
2807 import xmlrpclib
2808
2809-import bzrlib.branch
2810-from bzrlib.tests import TestCaseWithTransport
2811-from bzrlib.tests.per_repository import all_repository_format_scenarios
2812-from bzrlib.urlutils import local_path_from_url
2813-from bzrlib.workingtree import WorkingTree
2814+import breezy.branch
2815+from breezy.tests import TestCaseWithTransport
2816+from breezy.tests.per_repository import all_repository_format_scenarios
2817+from breezy.urlutils import local_path_from_url
2818+from breezy.workingtree import WorkingTree
2819 from testscenarios import (
2820 load_tests_apply_scenarios,
2821 WithScenarios,
2822@@ -37,8 +37,8 @@ from lp.code.tests.helpers import (
2823 get_non_existant_source_package_branch_unique_name,
2824 )
2825 from lp.codehosting import (
2826- get_bzr_path,
2827- get_BZR_PLUGIN_PATH_for_subprocess,
2828+ get_brz_path,
2829+ get_BRZ_PLUGIN_PATH_for_subprocess,
2830 )
2831 from lp.codehosting.bzrutils import DenyingServer
2832 from lp.codehosting.tests.helpers import LoomTestMixin
2833@@ -64,10 +64,10 @@ class ForkingServerForTests(object):
2834 self.socket_path = None
2835
2836 def setUp(self):
2837- bzr_path = get_bzr_path()
2838- BZR_PLUGIN_PATH = get_BZR_PLUGIN_PATH_for_subprocess()
2839+ brz_path = get_brz_path()
2840+ BRZ_PLUGIN_PATH = get_BRZ_PLUGIN_PATH_for_subprocess()
2841 env = os.environ.copy()
2842- env['BZR_PLUGIN_PATH'] = BZR_PLUGIN_PATH
2843+ env['BRZ_PLUGIN_PATH'] = BRZ_PLUGIN_PATH
2844 # TODO: We probably want to use a random disk path for
2845 # forking_daemon_socket, but we need to update config so that
2846 # the CodeHosting service can find it.
2847@@ -77,7 +77,7 @@ class ForkingServerForTests(object):
2848 # settings, we have to somehow pass it a new config-on-disk to
2849 # use.
2850 self.socket_path = config.codehosting.forking_daemon_socket
2851- command = [sys.executable, bzr_path, 'launchpad-forking-service',
2852+ command = [sys.executable, brz_path, 'launchpad-forking-service',
2853 '--path', self.socket_path, '-Derror']
2854 process = subprocess.Popen(
2855 command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
2856@@ -110,12 +110,12 @@ class ForkingServerForTests(object):
2857 print process.stderr.read()
2858 print "-" * 70
2859 raise RuntimeError(
2860- 'Bzr server did not start correctly. See stdout and stderr '
2861- 'reported above. Command was "%s". PYTHONPATH was "%s". '
2862- 'BZR_PLUGIN_PATH was "%s".' %
2863+ 'Breezy server did not start correctly. See stdout and '
2864+ 'stderr reported above. Command was "%s". PYTHONPATH was '
2865+ '"%s". BRZ_PLUGIN_PATH was "%s".' %
2866 (' '.join(command),
2867 env.get('PYTHONPATH'),
2868- env.get('BZR_PLUGIN_PATH')))
2869+ env.get('BRZ_PLUGIN_PATH')))
2870
2871 def tearDown(self):
2872 # SIGTERM is the graceful exit request, potentially we could wait a
2873@@ -234,8 +234,8 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
2874 """
2875 return self.run_bzr_subprocess(
2876 args, env_changes={
2877- 'BZR_SSH': 'paramiko',
2878- 'BZR_PLUGIN_PATH': get_BZR_PLUGIN_PATH_for_subprocess()
2879+ 'BRZ_SSH': 'paramiko',
2880+ 'BRZ_PLUGIN_PATH': get_BRZ_PLUGIN_PATH_for_subprocess()
2881 },
2882 allow_plugins=True, retcode=retcode)
2883
2884@@ -244,7 +244,7 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
2885 """
2886 output, error = self._run_bzr(args, retcode=3)
2887 for line in error.splitlines():
2888- if line.startswith("bzr: ERROR"):
2889+ if line.startswith("brz: ERROR"):
2890 return line
2891 raise AssertionError(
2892 "Didn't find error line in output:\n\n%s\n" % error)
2893@@ -253,12 +253,12 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
2894 """Branch from the given URL to a local directory."""
2895 self._run_bzr(['branch', remote_url, local_directory])
2896
2897- def get_bzr_path(self):
2898- """See `bzrlib.tests.TestCase.get_bzr_path`.
2899+ def get_brz_path(self):
2900+ """See `breezy.tests.TestCase.get_brz_path`.
2901
2902- We override this to return the 'bzr' executable from sourcecode.
2903+ We override this to return our own 'brz' executable.
2904 """
2905- return get_bzr_path()
2906+ return get_brz_path()
2907
2908 def push(self, local_directory, remote_url, extra_args=None):
2909 """Push the local branch to the given URL."""
2910@@ -271,19 +271,19 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
2911 """Check that we cannot push from 'local_directory' to 'remote_url'.
2912
2913 In addition, if a list of messages is supplied as the error_messages
2914- argument, check that the bzr client printed one of these messages
2915- which shouldn't include the 'bzr: ERROR:' part of the message.
2916+ argument, check that the brz client printed one of these messages
2917+ which shouldn't include the 'brz: ERROR:' part of the message.
2918
2919 :return: The last line of the stderr from the subprocess, which will
2920- be the 'bzr: ERROR: <repr of Exception>' line.
2921+ be the 'brz: ERROR: <repr of Exception>' line.
2922 """
2923 error_line = self._run_bzr_error(
2924 ['push', '-d', local_directory, remote_url])
2925- # This will be the will be the 'bzr: ERROR: <repr of Exception>' line.
2926+ # This will be the 'brz: ERROR: <repr of Exception>' line.
2927 if not error_messages:
2928 return error_line
2929 for msg in error_messages:
2930- if error_line.startswith('bzr: ERROR: ' + msg):
2931+ if error_line.startswith('brz: ERROR: ' + msg):
2932 return error_line
2933 self.fail(
2934 "Error message %r didn't match any of those supplied."
2935@@ -340,11 +340,11 @@ class SmokeTest(WithScenarios, SSHTestCase):
2936 """Smoke test for repository support."""
2937
2938 excluded_scenarios = [
2939- # RepositoryFormat4 is not initializable (bzrlib raises TestSkipped
2940+ # RepositoryFormat4 is not initializable (breezy raises TestSkipped
2941 # when you try).
2942 'RepositoryFormat4',
2943 # Fetching weave formats from the smart server is known to be broken.
2944- # See bug 173807 and bzrlib.tests.test_repository.
2945+ # See bug 173807 and breezy.tests.test_repository.
2946 'RepositoryFormat5',
2947 'RepositoryFormat6',
2948 'RepositoryFormat7',
2949@@ -364,14 +364,14 @@ class SmokeTest(WithScenarios, SSHTestCase):
2950 self.second_tree = 'second'
2951
2952 def make_branch_specifying_repo_format(self, relpath, repo_format):
2953- bd = self.make_bzrdir(relpath, format=self.bzrdir_format)
2954+ bd = self.make_controldir(relpath, format=self.bzrdir_format)
2955 repo_format.initialize(bd)
2956 return bd.create_branch()
2957
2958 def make_branch_and_tree(self, relpath):
2959 b = self.make_branch_specifying_repo_format(
2960 relpath, self.repository_format)
2961- return b.bzrdir.create_workingtree()
2962+ return b.controldir.create_workingtree()
2963
2964 def test_smoke(self):
2965 # Make a new branch
2966@@ -411,7 +411,7 @@ class AcceptanceTests(WithScenarios, SSHTestCase):
2967 error_line = self._run_bzr_error(
2968 ['cat-revision', '-r', 'branch:' + url])
2969 self.assertTrue(
2970- error_line.startswith('bzr: ERROR: Not a branch:'),
2971+ error_line.startswith('brz: ERROR: Not a branch:'),
2972 'Expected "Not a branch", found %r' % error_line)
2973
2974 def makeDatabaseBranch(self, owner_name, product_name, branch_name,
2975@@ -693,7 +693,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
2976 # We can get information from a read-only branch.
2977 ro_branch_url = self.createBazaarBranch(
2978 'mark', '+junk', 'ro-branch')
2979- revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()
2980+ revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
2981 remote_revision = self.getLastRevision(
2982 self.getTransportURL('~mark/+junk/ro-branch'))
2983 self.assertEqual(revision, remote_revision)
2984@@ -715,7 +715,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
2985 # Added to catch bug 126245.
2986 ro_branch_url = self.makeMirroredBranch(
2987 'testuser', 'firefox', 'mirror')
2988- revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()
2989+ revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
2990 remote_revision = self.getLastRevision(
2991 self.getTransportURL('~testuser/firefox/mirror'))
2992 self.assertEqual(revision, remote_revision)
2993@@ -724,7 +724,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
2994 # Users should be able to read mirrored branches even if they don't
2995 # own those branches.
2996 ro_branch_url = self.makeMirroredBranch('mark', 'firefox', 'mirror')
2997- revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()
2998+ revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
2999 remote_revision = self.getLastRevision(
3000 self.getTransportURL('~mark/firefox/mirror'))
3001 self.assertEqual(revision, remote_revision)
3002diff --git a/lib/lp/codehosting/tests/test_bzrlib.py b/lib/lp/codehosting/tests/test_breezy.py
3003similarity index 58%
3004rename from lib/lp/codehosting/tests/test_bzrlib.py
3005rename to lib/lp/codehosting/tests/test_breezy.py
3006index 35f44aa..c9cf83d 100644
3007--- a/lib/lp/codehosting/tests/test_bzrlib.py
3008+++ b/lib/lp/codehosting/tests/test_breezy.py
3009@@ -1,17 +1,17 @@
3010 # Copyright 2009 Canonical Ltd. This software is licensed under the
3011 # GNU Affero General Public License version 3 (see the file LICENSE).
3012
3013-"""Launchpad specific tests of bzrlib behaviour."""
3014+"""Launchpad-specific tests of Breezy behaviour."""
3015
3016 __metaclass__ = type
3017
3018 from lp.testing import TestCase
3019
3020
3021-class TestBzrlib(TestCase):
3022+class TestBreezy(TestCase):
3023 def test_has_cextensions(self):
3024- """Ensure Bazaar C extensions are being used."""
3025+ """Ensure Breezy C extensions are being used."""
3026 try:
3027- import bzrlib._dirstate_helpers_pyx
3028+ import breezy.bzr._dirstate_helpers_pyx
3029 except ImportError:
3030- self.fail("Bzr not built with C extensions.")
3031+ self.fail("Breezy not built with C extensions.")
3032diff --git a/lib/lp/codehosting/tests/test_bzrutils.py b/lib/lp/codehosting/tests/test_bzrutils.py
3033index e05c14d..a78d35f 100644
3034--- a/lib/lp/codehosting/tests/test_bzrutils.py
3035+++ b/lib/lp/codehosting/tests/test_bzrutils.py
3036@@ -8,20 +8,23 @@ __metaclass__ = type
3037 import gc
3038 import sys
3039
3040-from bzrlib import (
3041+from breezy import (
3042 errors,
3043 trace,
3044 )
3045-from bzrlib.branch import Branch
3046-from bzrlib.bzrdir import format_registry
3047-from bzrlib.errors import AppendRevisionsOnlyViolation
3048-from bzrlib.remote import RemoteBranch
3049-from bzrlib.tests import (
3050+from breezy.branch import (
3051+ Branch,
3052+ UnstackableBranchFormat,
3053+ )
3054+from breezy.bzr.remote import RemoteBranch
3055+from breezy.controldir import format_registry
3056+from breezy.errors import AppendRevisionsOnlyViolation
3057+from breezy.tests import (
3058 test_server,
3059 TestCaseWithTransport,
3060 TestNotApplicable,
3061 )
3062-from bzrlib.tests.per_branch import (
3063+from breezy.tests.per_branch import (
3064 branch_scenarios,
3065 TestCaseWithControlDir,
3066 )
3067@@ -80,14 +83,14 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
3068 stacked_branch = self.make_branch('stacked')
3069 try:
3070 stacked_branch.set_stacked_on_url('../stacked-on')
3071- except errors.UnstackableBranchFormat:
3072+ except UnstackableBranchFormat:
3073 raise TestNotApplicable('This format does not support stacking.')
3074 # Deleting the stacked-on branch ensures that Bazaar will raise an
3075 # error if it tries to open the stacked-on branch.
3076 self.get_transport('.').delete_tree('stacked-on')
3077 self.assertEqual(
3078 '../stacked-on',
3079- get_branch_stacked_on_url(stacked_branch.bzrdir))
3080+ get_branch_stacked_on_url(stacked_branch.controldir))
3081
3082 def testGetBranchStackedOnUrlUnstackable(self):
3083 # get_branch_stacked_on_url raises UnstackableBranchFormat if it's
3084@@ -97,11 +100,11 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
3085 branch.get_stacked_on_url()
3086 except errors.NotStacked:
3087 raise TestNotApplicable('This format supports stacked branches.')
3088- except errors.UnstackableBranchFormat:
3089+ except UnstackableBranchFormat:
3090 pass
3091 self.assertRaises(
3092- errors.UnstackableBranchFormat,
3093- get_branch_stacked_on_url, branch.bzrdir)
3094+ UnstackableBranchFormat,
3095+ get_branch_stacked_on_url, branch.controldir)
3096
3097 def testGetBranchStackedOnUrlNotStacked(self):
3098 # get_branch_stacked_on_url raises NotStacked if it's called on the
3099@@ -111,16 +114,16 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
3100 branch.get_stacked_on_url()
3101 except errors.NotStacked:
3102 pass
3103- except errors.UnstackableBranchFormat:
3104+ except UnstackableBranchFormat:
3105 raise TestNotApplicable(
3106 'This format does not support stacked branches')
3107 self.assertRaises(
3108- errors.NotStacked, get_branch_stacked_on_url, branch.bzrdir)
3109+ errors.NotStacked, get_branch_stacked_on_url, branch.controldir)
3110
3111 def testGetBranchStackedOnUrlNoBranch(self):
3112 # get_branch_stacked_on_url raises a NotBranchError if it's called on
3113 # a bzrdir that's not got a branch.
3114- a_bzrdir = self.make_bzrdir('source')
3115+ a_bzrdir = self.make_controldir('source')
3116 if a_bzrdir.has_branch():
3117 raise TestNotApplicable(
3118 'This format does not support branchless bzrdirs.')
3119diff --git a/lib/lp/codehosting/tests/test_format_comparison.py b/lib/lp/codehosting/tests/test_format_comparison.py
3120index 0346af7..de06e64 100644
3121--- a/lib/lp/codehosting/tests/test_format_comparison.py
3122+++ b/lib/lp/codehosting/tests/test_format_comparison.py
3123@@ -45,7 +45,7 @@ class StubObjectWithFormat:
3124 class StubBranch:
3125 """A stub branch object that just has formats."""
3126 def __init__(self, bzrdir_format, repo_format, branch_format):
3127- self.bzrdir = StubObjectWithFormat(bzrdir_format)
3128+ self.controldir = StubObjectWithFormat(bzrdir_format)
3129 self.repository = StubObjectWithFormat(repo_format)
3130 self._format = branch_format
3131
3132diff --git a/lib/lp/codehosting/tests/test_lpserve.py b/lib/lp/codehosting/tests/test_lpserve.py
3133index 2655e7e..81294cc 100644
3134--- a/lib/lp/codehosting/tests/test_lpserve.py
3135+++ b/lib/lp/codehosting/tests/test_lpserve.py
3136@@ -5,10 +5,10 @@
3137
3138 __metaclass__ = type
3139
3140-from bzrlib import errors
3141-from bzrlib.plugins.lpserve.test_lpserve import TestCaseWithSubprocess
3142-from bzrlib.smart import medium
3143-from bzrlib.transport import remote
3144+from breezy import errors
3145+from breezy.bzr.smart import medium
3146+from breezy.plugins.lpserve.test_lpserve import TestCaseWithSubprocess
3147+from breezy.transport import remote
3148
3149 from lp.testing.fixture import CaptureOops
3150 from lp.testing.layers import LaunchpadLayer
3151@@ -112,8 +112,8 @@ class TestLaunchpadServe(TestCaseWithSubprocess):
3152
3153
3154 def test_suite():
3155- from bzrlib import tests
3156- from bzrlib.plugins import lpserve
3157+ from breezy import tests
3158+ from breezy.plugins import lpserve
3159
3160 loader = tests.TestLoader()
3161 suite = loader.loadTestsFromName(__name__)
3162diff --git a/lib/lp/codehosting/tests/test_sftp.py b/lib/lp/codehosting/tests/test_sftp.py
3163index 7539dd6..3ea1309 100644
3164--- a/lib/lp/codehosting/tests/test_sftp.py
3165+++ b/lib/lp/codehosting/tests/test_sftp.py
3166@@ -6,13 +6,13 @@
3167 from contextlib import closing
3168 import os
3169
3170-from bzrlib import (
3171+from breezy import (
3172 errors as bzr_errors,
3173 urlutils,
3174 )
3175-from bzrlib.tests import TestCaseInTempDir
3176-from bzrlib.transport import get_transport
3177-from bzrlib.transport.memory import MemoryTransport
3178+from breezy.tests import TestCaseInTempDir
3179+from breezy.transport import get_transport
3180+from breezy.transport.memory import MemoryTransport
3181 from lazr.sshserver.sftp import FileIsADirectory
3182 from testtools.twistedsupport import (
3183 assert_fails_with,
3184@@ -70,7 +70,7 @@ class TestFatLocalTransport(TestCaseInTempDir):
3185 def test_writeChunk(self):
3186 # writeChunk writes a chunk of data to a file at a given offset.
3187 filename = 'foo'
3188- self.transport.put_bytes(filename, 'content')
3189+ self.transport.put_bytes(filename, b'content')
3190 self.transport.writeChunk(filename, 1, 'razy')
3191 self.assertEqual('crazynt', self.transport.get_bytes(filename))
3192
3193@@ -612,7 +612,7 @@ class TestSFTPServer(TestCaseInTempDir, SFTPTestMixin):
3194 def test_openDirectoryMemory(self):
3195 """openDirectory works on MemoryTransport."""
3196 transport = MemoryTransport()
3197- transport.put_bytes('hello', 'hello')
3198+ transport.put_bytes('hello', b'hello')
3199 sftp_server = TransportSFTPServer(AsyncTransport(transport))
3200 deferred = sftp_server.openDirectory('.')
3201
3202diff --git a/lib/lp/codehosting/tests/test_upgrade.py b/lib/lp/codehosting/tests/test_upgrade.py
3203index 8d53d28..3326d16 100644
3204--- a/lib/lp/codehosting/tests/test_upgrade.py
3205+++ b/lib/lp/codehosting/tests/test_upgrade.py
3206@@ -7,18 +7,16 @@ __metaclass__ = type
3207 import logging
3208 from os.path import dirname
3209
3210-from bzrlib.branch import Branch
3211-from bzrlib.bzrdir import (
3212- BzrDir,
3213- format_registry,
3214- )
3215-from bzrlib.plugins.loom.branch import loomify
3216-from bzrlib.repofmt.groupcompress_repo import (
3217+from breezy.branch import Branch
3218+from breezy.bzr.bzrdir import BzrDir
3219+from breezy.bzr.groupcompress_repo import (
3220 RepositoryFormat2a,
3221 RepositoryFormat2aSubtree,
3222 )
3223-from bzrlib.revision import NULL_REVISION
3224-from bzrlib.transport import get_transport
3225+from breezy.controldir import format_registry
3226+from breezy.plugins.loom.branch import loomify
3227+from breezy.revision import NULL_REVISION
3228+from breezy.transport import get_transport
3229 from fixtures import TempDir
3230
3231 from lp.code.bzr import (
3232@@ -51,7 +49,7 @@ class TestUpgrader(TestCaseWithFactory):
3233 'foo', rev_id='prepare-commit', committer='jrandom@example.com')
3234 if loomify_branch:
3235 loomify(tree.branch)
3236- bzr_branch = tree.bzrdir.open_branch()
3237+ bzr_branch = tree.controldir.open_branch()
3238 else:
3239 bzr_branch = tree.branch
3240 return self.getUpgrader(bzr_branch, branch)
3241@@ -76,8 +74,8 @@ class TestUpgrader(TestCaseWithFactory):
3242 :param tree: A Bazaar WorkingTree to add a tree to.
3243 """
3244 sub_branch = BzrDir.create_branch_convenience(
3245- tree.bzrdir.root_transport.clone('sub').base)
3246- tree.add_reference(sub_branch.bzrdir.open_workingtree())
3247+ tree.controldir.root_transport.clone('sub').base)
3248+ tree.add_reference(sub_branch.controldir.open_workingtree())
3249 tree.commit('added tree reference', committer='jrandom@example.com')
3250
3251 def check_branch(self, upgraded, branch_format=BranchFormat.BZR_BRANCH_7,
3252@@ -128,7 +126,7 @@ class TestUpgrader(TestCaseWithFactory):
3253 def test_subtree_format_repo_format(self):
3254 """Even subtree formats use 2a if they don't have tree references."""
3255 self.useBzrBranches(direct_database=True)
3256- format = format_registry.make_bzrdir('pack-0.92-subtree')
3257+ format = format_registry.make_controldir('pack-0.92-subtree')
3258 branch, tree = self.create_branch_and_tree(format=format)
3259 upgrader = self.getUpgrader(tree.branch, branch)
3260 with read_locked(upgrader.bzr_branch):
3261@@ -139,7 +137,7 @@ class TestUpgrader(TestCaseWithFactory):
3262 def test_tree_reference_repo_format(self):
3263 """Repos with tree references get 2aSubtree."""
3264 self.useBzrBranches(direct_database=True)
3265- format = format_registry.make_bzrdir('pack-0.92-subtree')
3266+ format = format_registry.make_controldir('pack-0.92-subtree')
3267 branch, tree = self.create_branch_and_tree(format=format)
3268 upgrader = self.getUpgrader(tree.branch, branch)
3269 self.addTreeReference(tree)
3270@@ -186,7 +184,7 @@ class TestUpgrader(TestCaseWithFactory):
3271 def test_has_tree_references(self):
3272 """Detects whether repo contains actual tree references."""
3273 self.useBzrBranches(direct_database=True)
3274- format = format_registry.make_bzrdir('pack-0.92-subtree')
3275+ format = format_registry.make_controldir('pack-0.92-subtree')
3276 branch, tree = self.create_branch_and_tree(format=format)
3277 upgrader = self.getUpgrader(tree.branch, branch)
3278 with read_locked(tree.branch.repository):
3279@@ -198,11 +196,11 @@ class TestUpgrader(TestCaseWithFactory):
3280 def test_use_subtree_format_for_tree_references(self):
3281 """Subtree references cause RepositoryFormat2aSubtree to be used."""
3282 self.useBzrBranches(direct_database=True)
3283- format = format_registry.make_bzrdir('pack-0.92-subtree')
3284+ format = format_registry.make_controldir('pack-0.92-subtree')
3285 branch, tree = self.create_branch_and_tree(format=format)
3286 sub_branch = BzrDir.create_branch_convenience(
3287- tree.bzrdir.root_transport.clone('sub').base, format=format)
3288- tree.add_reference(sub_branch.bzrdir.open_workingtree())
3289+ tree.controldir.root_transport.clone('sub').base, format=format)
3290+ tree.add_reference(sub_branch.controldir.open_workingtree())
3291 tree.commit('added tree reference', committer='jrandom@example.org')
3292 upgrader = self.getUpgrader(tree.branch, branch)
3293 with read_locked(tree.branch):
3294diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py
3295index 43e592f..2159871 100755
3296--- a/lib/lp/codehosting/upgrade.py
3297+++ b/lib/lp/codehosting/upgrade.py
3298@@ -18,18 +18,16 @@ import os
3299 from shutil import rmtree
3300 from tempfile import mkdtemp
3301
3302-from bzrlib.bzrdir import (
3303- BzrDir,
3304- format_registry,
3305- )
3306-from bzrlib.errors import UpToDateFormat
3307-from bzrlib.plugins.loom import (
3308+from breezy.bzr.bzrdir import BzrDir
3309+from breezy.bzr.groupcompress_repo import RepositoryFormat2aSubtree
3310+from breezy.controldir import format_registry
3311+from breezy.errors import UpToDateFormat
3312+from breezy.plugins.loom import (
3313 NotALoom,
3314 require_loom_branch,
3315 )
3316-from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2aSubtree
3317-from bzrlib.upgrade import upgrade
3318-from bzrlib.url_policy_open import (
3319+from breezy.upgrade import upgrade
3320+from breezy.url_policy_open import (
3321 BranchOpener,
3322 SingleSchemePolicy,
3323 )
3324@@ -75,7 +73,7 @@ class Upgrader:
3325 :param branch: The bzr branch to upgrade
3326 :return: A Metadir format instance.
3327 """
3328- format = format_registry.make_bzrdir('2a')
3329+ format = format_registry.make_controldir('2a')
3330 try:
3331 require_loom_branch(self.bzr_branch)
3332 except NotALoom:
3333@@ -205,5 +203,5 @@ class Upgrader:
3334 def mirror_branch(self, bzr_branch, target_bd):
3335 """Mirror the actual branch from a bzr_branch to a target bzrdir."""
3336 target = target_bd.get_branch_transport(bzr_branch._format)
3337- source = bzr_branch.bzrdir.get_branch_transport(bzr_branch._format)
3338+ source = bzr_branch.controldir.get_branch_transport(bzr_branch._format)
3339 source.copy_tree_to_transport(target)
3340diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
3341index a928855..92d4b3f 100644
3342--- a/lib/lp/codehosting/vfs/branchfs.py
3343+++ b/lib/lp/codehosting/vfs/branchfs.py
3344@@ -29,7 +29,7 @@ the `IBranchFileSystem` interface and passing what that returns to a
3345 `ITransportDispatch` object.
3346
3347 We hook the `LaunchpadServer` into Bazaar by implementing a
3348-`AsyncVirtualTransport`, a `bzrlib.transport.Transport` that wraps all of its
3349+`AsyncVirtualTransport`, a `breezy.transport.Transport` that wraps all of its
3350 operations so that they are translated by an object that implements
3351 `translateVirtualPath`. See transport.py for more information.
3352
3353@@ -58,20 +58,18 @@ import os.path
3354 import sys
3355 import xmlrpclib
3356
3357-from bzrlib import urlutils
3358-from bzrlib.bzrdir import (
3359- BzrDir,
3360- BzrDirFormat,
3361- )
3362-from bzrlib.config import TransportConfig
3363-from bzrlib.errors import (
3364+from breezy import urlutils
3365+from breezy.bzr.bzrdir import BzrDir
3366+from breezy.bzr.smart.request import jail_info
3367+from breezy.config import TransportConfig
3368+from breezy.controldir import ControlDirFormat
3369+from breezy.errors import (
3370 NoSuchFile,
3371 PermissionDenied,
3372 TransportNotPossible,
3373 )
3374-from bzrlib.smart.request import jail_info
3375-from bzrlib.transport import get_transport
3376-from bzrlib.transport.memory import MemoryServer
3377+from breezy.transport import get_transport
3378+from breezy.transport.memory import MemoryServer
3379 from lazr.uri import URI
3380 import six
3381 from twisted.internet import (
3382@@ -224,7 +222,7 @@ class ITransportDispatch(Interface):
3383
3384 :return: A transport and a path on that transport that point to a
3385 place that matches the one described in transport_tuple.
3386- :rtype: (`bzrlib.transport.Transport`, str)
3387+ :rtype: (`breezy.transport.Transport`, str)
3388 """
3389
3390
3391@@ -333,7 +331,7 @@ class TransportDispatch:
3392 transport = get_transport(memory_server.get_url())
3393 if default_stack_on == '':
3394 return transport
3395- format = BzrDirFormat.get_default_format()
3396+ format = ControlDirFormat.get_default_format()
3397 bzrdir = format.initialize_on_transport(transport)
3398 bzrdir.get_config().set_default_stack_on(
3399 urlutils.unescape(default_stack_on))
3400diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
3401index 30c08d4..eba8732 100644
3402--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
3403+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
3404@@ -12,29 +12,27 @@ from StringIO import StringIO
3405 import sys
3406 import xmlrpclib
3407
3408-from bzrlib import errors
3409-from bzrlib.bzrdir import (
3410- BzrDir,
3411- format_registry,
3412- )
3413-from bzrlib.tests import (
3414+from breezy import errors
3415+from breezy.bzr.bzrdir import BzrDir
3416+from breezy.controldir import format_registry
3417+from breezy.tests import (
3418 TestCase as BzrTestCase,
3419 TestCaseInTempDir,
3420 TestCaseWithTransport,
3421 )
3422-from bzrlib.transport import (
3423+from breezy.transport import (
3424 _get_protocol_handlers,
3425 get_transport,
3426 register_transport,
3427 Server,
3428 unregister_transport,
3429 )
3430-from bzrlib.transport.chroot import ChrootTransport
3431-from bzrlib.transport.memory import (
3432+from breezy.transport.chroot import ChrootTransport
3433+from breezy.transport.memory import (
3434 MemoryServer,
3435 MemoryTransport,
3436 )
3437-from bzrlib.urlutils import (
3438+from breezy.urlutils import (
3439 escape,
3440 local_path_to_url,
3441 )
3442@@ -142,7 +140,7 @@ class TestTransportDispatch(TestCase):
3443 default_stack_on='/~foo/bar/baz')
3444 self.assertRaises(
3445 errors.TransportNotPossible,
3446- transport.put_bytes, '.bzr/control.conf', 'data')
3447+ transport.put_bytes, '.bzr/control.conf', b'data')
3448
3449 def test_control_conf_with_stacking(self):
3450 transport = self.factory._makeControlTransport(
3451@@ -159,7 +157,7 @@ class TestTransportDispatch(TestCase):
3452 transport = self.factory._makeBranchTransport(id=5, writable=False)
3453 self.assertRaises(
3454 errors.TransportNotPossible, transport.put_bytes,
3455- '.bzr/README', 'data')
3456+ '.bzr/README', b'data')
3457
3458 def test_writable_implies_writable(self):
3459 transport = self.factory._makeBranchTransport(id=5, writable=True)
3460@@ -559,7 +557,7 @@ class LaunchpadTransportTests:
3461 transport.put_bytes,
3462 '~%s/%s/.bzr/control.conf' % (
3463 branch.owner.name, branch.product.name),
3464- 'hello nurse!')
3465+ b'hello nurse!')
3466
3467 def _makeOnBackingTransport(self, branch):
3468 """Make directories for 'branch' on the backing transport.
3469@@ -578,7 +576,7 @@ class LaunchpadTransportTests:
3470 branch = self.factory.makeAnyBranch(
3471 branch_type=BranchType.HOSTED, owner=self.requester)
3472 backing_transport = self._makeOnBackingTransport(branch)
3473- backing_transport.put_bytes('hello.txt', 'Hello World!')
3474+ backing_transport.put_bytes('hello.txt', b'Hello World!')
3475 deferred = self._ensureDeferred(
3476 transport.get_bytes, '%s/.bzr/hello.txt' % branch.unique_name)
3477 return deferred.addCallback(self.assertEqual, 'Hello World!')
3478@@ -589,7 +587,7 @@ class LaunchpadTransportTests:
3479 branch = self.factory.makeAnyBranch(
3480 branch_type=BranchType.HOSTED, owner=self.requester)
3481 backing_transport = self._makeOnBackingTransport(branch)
3482- backing_transport.put_bytes('hello.txt', 'Hello World!')
3483+ backing_transport.put_bytes('hello.txt', b'Hello World!')
3484 url = escape('%s/.bzr/hello.txt' % branch.unique_name)
3485 transport = self.getTransport()
3486 deferred = self._ensureDeferred(transport.get_bytes, url)
3487@@ -601,7 +599,7 @@ class LaunchpadTransportTests:
3488 branch = self.factory.makeAnyBranch(
3489 branch_type=BranchType.HOSTED, owner=self.requester)
3490 backing_transport = self._makeOnBackingTransport(branch)
3491- data = 'Hello World!'
3492+ data = b'Hello World!'
3493 backing_transport.put_bytes('hello.txt', data)
3494 transport = self.getTransport()
3495 deferred = self._ensureDeferred(
3496@@ -622,7 +620,7 @@ class LaunchpadTransportTests:
3497 backing_transport = self._makeOnBackingTransport(branch)
3498 deferred = self._ensureDeferred(
3499 transport.put_bytes,
3500- '%s/.bzr/goodbye.txt' % branch.unique_name, "Goodbye")
3501+ '%s/.bzr/goodbye.txt' % branch.unique_name, b"Goodbye")
3502
3503 def check_bytes_written(ignored):
3504 self.assertEqual(
3505@@ -659,7 +657,7 @@ class LaunchpadTransportTests:
3506 branch = self.factory.makeAnyBranch(
3507 branch_type=BranchType.HOSTED, owner=self.requester)
3508 backing_transport = self._makeOnBackingTransport(branch)
3509- backing_transport.put_bytes('hello.txt', 'Hello World!')
3510+ backing_transport.put_bytes('hello.txt', b'Hello World!')
3511 transport = transport.clone('~%s' % branch.owner.name)
3512 deferred = self._ensureDeferred(
3513 transport.get_bytes,
3514@@ -696,7 +694,7 @@ class LaunchpadTransportTests:
3515 branch = self.factory.makeAnyBranch(
3516 branch_type=BranchType.HOSTED, owner=self.requester)
3517 backing_transport = self._makeOnBackingTransport(branch)
3518- backing_transport.put_bytes('hello.txt', 'Hello World!')
3519+ backing_transport.put_bytes('hello.txt', b'Hello World!')
3520
3521 transport = self.getTransport().clone(branch.unique_name)
3522
3523@@ -735,7 +733,7 @@ class LaunchpadTransportTests:
3524 branch = self.factory.makeAnyBranch(
3525 branch_type=BranchType.HOSTED, owner=self.requester)
3526 backing_transport = self._makeOnBackingTransport(branch)
3527- backing_transport.put_bytes('hello.txt', 'Hello World!')
3528+ backing_transport.put_bytes('hello.txt', b'Hello World!')
3529 transport = self.getTransport().clone(branch.unique_name)
3530 backing_transport = self.backing_transport.clone(
3531 branch_to_path(branch))
3532@@ -985,7 +983,7 @@ class TestBranchChangedNotification(TestCaseWithTransport):
3533
3534 def assertFormatStringsPassed(self, branch):
3535 self.assertEqual(1, len(self._branch_changed_log))
3536- control_string = branch.bzrdir._format.get_format_string()
3537+ control_string = branch.controldir._format.get_format_string()
3538 branch_string = branch._format.get_format_string()
3539 repository_string = branch.repository._format.get_format_string()
3540 self.assertEqual(
3541@@ -1130,7 +1128,7 @@ class TestLaunchpadTransportReadOnly(BzrTestCase):
3542 self.requester.id, codehosting_api, backing_transport)
3543 self.lp_transport = get_transport(self.lp_server.get_url())
3544 self.lp_transport.mkdir(os.path.dirname(self.writable_file))
3545- self.lp_transport.put_bytes(self.writable_file, 'Hello World!')
3546+ self.lp_transport.put_bytes(self.writable_file, b'Hello World!')
3547
3548 def _setUpMemoryServer(self):
3549 memory_server = MemoryServer()
3550diff --git a/lib/lp/codehosting/vfs/tests/test_filesystem.py b/lib/lp/codehosting/vfs/tests/test_filesystem.py
3551index 467ec2a..3e03e94 100644
3552--- a/lib/lp/codehosting/vfs/tests/test_filesystem.py
3553+++ b/lib/lp/codehosting/vfs/tests/test_filesystem.py
3554@@ -7,12 +7,12 @@ __metaclass__ = type
3555
3556 import stat
3557
3558-from bzrlib import errors
3559-from bzrlib.bzrdir import BzrDir
3560-from bzrlib.tests import TestCaseWithTransport
3561-from bzrlib.transport import get_transport
3562-from bzrlib.transport.memory import MemoryTransport
3563-from bzrlib.urlutils import escape
3564+from breezy import errors
3565+from breezy.bzr.bzrdir import BzrDir
3566+from breezy.tests import TestCaseWithTransport
3567+from breezy.transport import get_transport
3568+from breezy.transport.memory import MemoryTransport
3569+from breezy.urlutils import escape
3570
3571 from lp.code.interfaces.branchtarget import IBranchTarget
3572 from lp.code.interfaces.codehosting import branch_id_alias
3573@@ -218,7 +218,7 @@ class TestFilesystem(TestCaseWithTransport):
3574 transport.mkdir(branch_path)
3575 self.assertRaises(
3576 errors.PermissionDenied,
3577- transport.put_bytes, '%s/README' % branch_path, 'Hello!')
3578+ transport.put_bytes, '%s/README' % branch_path, b'Hello!')
3579
3580 def test_rename_to_non_bzr_directory_fails(self):
3581 # Users cannot create an allowed directory (e.g. '.bzr' or
3582@@ -296,7 +296,7 @@ class TestFilesystem(TestCaseWithTransport):
3583 # unescape(path).encode('utf-8') != path.
3584 path = '%41%42%43'
3585 escaped_path = escape(path)
3586- content = 'content'
3587+ content = b'content'
3588 transport.put_bytes(escaped_path, content)
3589
3590 # We can use the escaped path to reach the file.
3591diff --git a/lib/lp/codehosting/vfs/tests/test_transport.py b/lib/lp/codehosting/vfs/tests/test_transport.py
3592index e4bc291..45c155a 100644
3593--- a/lib/lp/codehosting/vfs/tests/test_transport.py
3594+++ b/lib/lp/codehosting/vfs/tests/test_transport.py
3595@@ -5,14 +5,14 @@
3596
3597 __metaclass__ = type
3598
3599-from bzrlib.tests import per_transport
3600-from bzrlib.transport import (
3601+from breezy.tests import per_transport
3602+from breezy.transport import (
3603 chroot,
3604 get_transport,
3605 Transport,
3606 )
3607-from bzrlib.transport.local import LocalTransport
3608-from bzrlib.urlutils import local_path_to_url
3609+from breezy.transport.local import LocalTransport
3610+from breezy.urlutils import local_path_to_url
3611
3612 from lp.codehosting.inmemory import InMemoryFrontend
3613 from lp.codehosting.tests.helpers import TestResultWrapper
3614diff --git a/lib/lp/codehosting/vfs/tests/test_transport_extensions.py b/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
3615index 31c07a1..56b587f 100644
3616--- a/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
3617+++ b/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
3618@@ -5,7 +5,7 @@
3619
3620 __metaclass__ = type
3621
3622-from bzrlib.transport.memory import MemoryTransport
3623+from breezy.transport.memory import MemoryTransport
3624
3625 from lp.codehosting.vfs.transport import get_readonly_transport
3626 from lp.testing import TestCase
3627diff --git a/lib/lp/codehosting/vfs/transport.py b/lib/lp/codehosting/vfs/transport.py
3628index db67847..f53b49a 100644
3629--- a/lib/lp/codehosting/vfs/transport.py
3630+++ b/lib/lp/codehosting/vfs/transport.py
3631@@ -5,7 +5,7 @@
3632
3633 The code hosting filesystem is implemented using Bazaar transports. This
3634 module contains utilities for implementing virtual filesystems using
3635-bzrlib.transport classes.
3636+breezy.transport classes.
3637 """
3638
3639 __metaclass__ = type
3640@@ -19,14 +19,14 @@ __all__ = [
3641 ]
3642
3643
3644-from bzrlib import urlutils
3645-from bzrlib.errors import (
3646+from breezy import urlutils
3647+from breezy.errors import (
3648 BzrError,
3649 InProcessTransport,
3650 NoSuchFile,
3651 TransportNotPossible,
3652 )
3653-from bzrlib.transport import (
3654+from breezy.transport import (
3655 chroot,
3656 get_transport,
3657 register_transport,
3658@@ -113,7 +113,7 @@ class AsyncVirtualTransport(Transport):
3659 This method is called as an errback by `_call`. Use it to translate
3660 errors from the server into something that users of the transport
3661 might expect. This could include translating vfs-specific errors into
3662- bzrlib errors (e.g. "couldn\'t translate" into `NoSuchFile`) or
3663+ breezy errors (e.g. "couldn\'t translate" into `NoSuchFile`) or
3664 translating underlying paths into virtual paths.
3665
3666 :param failure: A `twisted.python.failure.Failure`.
3667@@ -276,105 +276,105 @@ class SynchronousAdapter(Transport):
3668 return self._async_transport.set_segment_parameter(name, value)
3669
3670 def clone(self, offset=None):
3671- """See `bzrlib.transport.Transport`."""
3672+ """See `breezy.transport.Transport`."""
3673 cloned_async = self._async_transport.clone(offset)
3674 return SynchronousAdapter(cloned_async)
3675
3676 def external_url(self):
3677- """See `bzrlib.transport.Transport`."""
3678+ """See `breezy.transport.Transport`."""
3679 raise InProcessTransport(self)
3680
3681 def abspath(self, relpath):
3682- """See `bzrlib.transport.Transport`."""
3683+ """See `breezy.transport.Transport`."""
3684 return self._async_transport.abspath(relpath)
3685
3686 def append_file(self, relpath, f, mode=None):
3687- """See `bzrlib.transport.Transport`."""
3688+ """See `breezy.transport.Transport`."""
3689 return extract_result(
3690 self._async_transport.append_file(relpath, f, mode))
3691
3692 def delete(self, relpath):
3693- """See `bzrlib.transport.Transport`."""
3694+ """See `breezy.transport.Transport`."""
3695 return extract_result(self._async_transport.delete(relpath))
3696
3697 def delete_tree(self, relpath):
3698- """See `bzrlib.transport.Transport`."""
3699+ """See `breezy.transport.Transport`."""
3700 return extract_result(self._async_transport.delete_tree(relpath))
3701
3702 def get(self, relpath):
3703- """See `bzrlib.transport.Transport`."""
3704+ """See `breezy.transport.Transport`."""
3705 return extract_result(self._async_transport.get(relpath))
3706
3707 def get_bytes(self, relpath):
3708- """See `bzrlib.transport.Transport`."""
3709+ """See `breezy.transport.Transport`."""
3710 return extract_result(self._async_transport.get_bytes(relpath))
3711
3712 def has(self, relpath):
3713- """See `bzrlib.transport.Transport`."""
3714+ """See `breezy.transport.Transport`."""
3715 return extract_result(self._async_transport.has(relpath))
3716
3717 def iter_files_recursive(self):
3718- """See `bzrlib.transport.Transport`."""
3719+ """See `breezy.transport.Transport`."""
3720 return extract_result(
3721 self._async_transport.iter_files_recursive())
3722
3723 def listable(self):
3724- """See `bzrlib.transport.Transport`."""
3725+ """See `breezy.transport.Transport`."""
3726 return extract_result(self._async_transport.listable())
3727
3728 def list_dir(self, relpath):
3729- """See `bzrlib.transport.Transport`."""
3730+ """See `breezy.transport.Transport`."""
3731 return extract_result(self._async_transport.list_dir(relpath))
3732
3733 def lock_read(self, relpath):
3734- """See `bzrlib.transport.Transport`."""
3735+ """See `breezy.transport.Transport`."""
3736 return extract_result(self._async_transport.lock_read(relpath))
3737
3738 def lock_write(self, relpath):
3739- """See `bzrlib.transport.Transport`."""
3740+ """See `breezy.transport.Transport`."""
3741 return extract_result(self._async_transport.lock_write(relpath))
3742
3743 def mkdir(self, relpath, mode=None):
3744- """See `bzrlib.transport.Transport`."""
3745+ """See `breezy.transport.Transport`."""
3746 return extract_result(self._async_transport.mkdir(relpath, mode))
3747
3748 def open_write_stream(self, relpath, mode=None):
3749- """See `bzrlib.transport.Transport`."""
3750+ """See `breezy.transport.Transport`."""
3751 return extract_result(
3752 self._async_transport.open_write_stream(relpath, mode))
3753
3754 def put_file(self, relpath, f, mode=None):
3755- """See `bzrlib.transport.Transport`."""
3756+ """See `breezy.transport.Transport`."""
3757 return extract_result(
3758 self._async_transport.put_file(relpath, f, mode))
3759
3760 def local_realPath(self, relpath):
3761- """See `bzrlib.transport.Transport`."""
3762+ """See `lp.codehosting.sftp.FatLocalTransport`."""
3763 return extract_result(
3764 self._async_transport.local_realPath(relpath))
3765
3766 def readv(self, relpath, offsets, adjust_for_latency=False,
3767 upper_limit=None):
3768- """See `bzrlib.transport.Transport`."""
3769+ """See `breezy.transport.Transport`."""
3770 return extract_result(
3771 self._async_transport.readv(
3772 relpath, offsets, adjust_for_latency, upper_limit))
3773
3774 def rename(self, rel_from, rel_to):
3775- """See `bzrlib.transport.Transport`."""
3776+ """See `breezy.transport.Transport`."""
3777 return extract_result(
3778 self._async_transport.rename(rel_from, rel_to))
3779
3780 def rmdir(self, relpath):
3781- """See `bzrlib.transport.Transport`."""
3782+ """See `breezy.transport.Transport`."""
3783 return extract_result(self._async_transport.rmdir(relpath))
3784
3785 def stat(self, relpath):
3786- """See `bzrlib.transport.Transport`."""
3787+ """See `breezy.transport.Transport`."""
3788 return extract_result(self._async_transport.stat(relpath))
3789
3790 def writeChunk(self, relpath, offset, data):
3791- """See `bzrlib.transport.Transport`."""
3792+ """See `lp.codehosting.sftp.FatLocalTransport`."""
3793 return extract_result(
3794 self._async_transport.writeChunk(relpath, offset, data))
3795
3796@@ -394,7 +394,7 @@ class AsyncVirtualServer(Server):
3797
3798 :param scheme: The URL scheme to use.
3799 """
3800- # bzrlib's Server class does not have a constructor, so we cannot
3801+ # breezy's Server class does not have a constructor, so we cannot
3802 # safely upcall it.
3803 self._scheme = scheme
3804 self._is_started = False
3805diff --git a/lib/lp/scripts/runlaunchpad.py b/lib/lp/scripts/runlaunchpad.py
3806index 60332e6..b66e26f 100644
3807--- a/lib/lp/scripts/runlaunchpad.py
3808+++ b/lib/lp/scripts/runlaunchpad.py
3809@@ -202,13 +202,13 @@ class ForkingSessionService(Service):
3810 # service.
3811 if not self.should_launch:
3812 return
3813- from lp.codehosting import get_bzr_path
3814- command = [config.root + '/bin/py', get_bzr_path(),
3815+ from lp.codehosting import get_brz_path
3816+ command = [config.root + '/bin/py', get_brz_path(),
3817 'launchpad-forking-service',
3818 '--path', config.codehosting.forking_daemon_socket,
3819 ]
3820 env = dict(os.environ)
3821- env['BZR_PLUGIN_PATH'] = config.root + '/bzrplugins'
3822+ env['BRZ_PLUGIN_PATH'] = config.root + '/brzplugins'
3823 logfile = self.logfile
3824 if logfile == '-':
3825 # This process uses a different logging infrastructure from the
3826@@ -216,7 +216,7 @@ class ForkingSessionService(Service):
3827 # as the logfile. So we just ignore this setting.
3828 pass
3829 else:
3830- env['BZR_LOG'] = logfile
3831+ env['BRZ_LOG'] = logfile
3832 process = subprocess.Popen(command, env=env, stdin=subprocess.PIPE)
3833 self.addCleanup(stop_process, process)
3834 process.stdin.close()
3835diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py
3836index f4277be..c3cf774 100644
3837--- a/lib/lp/testing/__init__.py
3838+++ b/lib/lp/testing/__init__.py
3839@@ -81,12 +81,13 @@ import tempfile
3840 import time
3841 import unittest
3842
3843-from bzrlib import trace
3844-from bzrlib.bzrdir import (
3845- BzrDir,
3846+from breezy import trace
3847+from breezy.controldir import (
3848+ ControlDir,
3849 format_registry,
3850 )
3851-from bzrlib.transport import get_transport
3852+from breezy.transport import get_transport
3853+from bzrlib import trace as bzr_trace
3854 import fixtures
3855 from lazr.restful.testing.tales import test_tales
3856 from lazr.restful.testing.webservice import FakeRequest
3857@@ -846,11 +847,12 @@ class TestCaseWithFactory(TestCase):
3858 self._use_bzr_branch_called = False
3859 # XXX: JonathanLange 2010-12-24 bug=694140: Because of Launchpad's
3860 # messing with global log state (see
3861- # lp.services.scripts.logger), trace._bzr_logger does not
3862- # necessarily equal logging.getLogger('bzr'), so we have to explicitly
3863- # make it so in order to avoid "No handlers for "bzr" logger'
3864+ # lp.services.scripts.logger), trace._brz_logger does not
3865+ # necessarily equal logging.getLogger('brz'), so we have to explicitly
3866+ # make it so in order to avoid "No handlers for "brz" logger'
3867 # messages.
3868- trace._bzr_logger = logging.getLogger('bzr')
3869+ trace._brz_logger = logging.getLogger('brz')
3870+ bzr_trace._bzr_logger = logging.getLogger('bzr')
3871
3872 def getUserBrowser(self, url=None, user=None):
3873 """Return a Browser logged in as a fresh user, maybe opened at `url`.
3874@@ -887,8 +889,7 @@ class TestCaseWithFactory(TestCase):
3875 """
3876 if format is not None and isinstance(format, basestring):
3877 format = format_registry.get(format)()
3878- return BzrDir.create_branch_convenience(
3879- branch_url, format=format)
3880+ return ControlDir.create_branch_convenience(branch_url, format=format)
3881
3882 def create_branch_and_tree(self, tree_location=None, product=None,
3883 db_branch=None, format=None,
3884@@ -948,6 +949,7 @@ class TestCaseWithFactory(TestCase):
3885 self.useTempDir()
3886 # Avoid leaking local user configuration into tests.
3887 self.useContext(override_environ(
3888+ BRZ_HOME=os.getcwd(), BRZ_EMAIL=None,
3889 BZR_HOME=os.getcwd(), BZR_EMAIL=None, EMAIL=None,
3890 ))
3891
3892@@ -1405,7 +1407,7 @@ def map_branch_contents(branch):
3893 for entry in entries:
3894 file_path, file_name, file_type = entry[:3]
3895 if file_type == 'file':
3896- stored_file = tree.get_file_by_path(file_path)
3897+ stored_file = tree.get_file(file_path)
3898 contents[file_path] = stored_file.read()
3899 finally:
3900 tree.unlock()
3901diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
3902index f0310f3..a03bdfd 100644
3903--- a/lib/lp/testing/factory.py
3904+++ b/lib/lp/testing/factory.py
3905@@ -46,8 +46,8 @@ from types import InstanceType
3906 import uuid
3907 import warnings
3908
3909-from bzrlib.plugins.builder.recipe import BaseRecipeBranch
3910-from bzrlib.revision import Revision as BzrRevision
3911+from breezy.plugins.builder.recipe import BaseRecipeBranch
3912+from breezy.revision import Revision as BzrRevision
3913 from cryptography.utils import int_to_bytes
3914 from lazr.jobrunner.jobrunner import SuspendJobException
3915 import pytz
3916@@ -3036,7 +3036,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
3917 If no branches are passed, return a recipe text that references an
3918 arbitrary branch.
3919 """
3920- from bzrlib.plugins.builder.recipe import RecipeParser
3921+ from breezy.plugins.builder.recipe import RecipeParser
3922 parser = RecipeParser(self.makeRecipeText(*branches))
3923 return parser.parse()
3924
3925diff --git a/lib/lp/translations/browser/productseries.py b/lib/lp/translations/browser/productseries.py
3926index a5a6588..499e515 100644
3927--- a/lib/lp/translations/browser/productseries.py
3928+++ b/lib/lp/translations/browser/productseries.py
3929@@ -18,7 +18,7 @@ __all__ = [
3930
3931 import os.path
3932
3933-from bzrlib.revision import NULL_REVISION
3934+from breezy.revision import NULL_REVISION
3935 from zope.component import getUtility
3936 from zope.publisher.browser import FileUpload
3937
3938diff --git a/lib/lp/translations/pottery/detect_intltool.py b/lib/lp/translations/pottery/detect_intltool.py
3939index ae7d8e3..81eb352 100644
3940--- a/lib/lp/translations/pottery/detect_intltool.py
3941+++ b/lib/lp/translations/pottery/detect_intltool.py
3942@@ -26,7 +26,7 @@ def is_intltool_structure(tree):
3943
3944 Currently this just checks for the existence of POTFILES.in.
3945
3946- :param tree: A bzrlib.Tree object to search for the intltool structure.
3947+ :param tree: A breezy.Tree object to search for the intltool structure.
3948 :returns: True if signs of an intltool structure were found.
3949 """
3950 with read_lock_tree(tree):
3951diff --git a/lib/lp/translations/pottery/tests/test_detect_intltool.py b/lib/lp/translations/pottery/tests/test_detect_intltool.py
3952index 152fb8a..cc0d5d7 100644
3953--- a/lib/lp/translations/pottery/tests/test_detect_intltool.py
3954+++ b/lib/lp/translations/pottery/tests/test_detect_intltool.py
3955@@ -7,7 +7,7 @@ import errno
3956 import os
3957 import tarfile
3958
3959-from bzrlib.bzrdir import BzrDir
3960+from breezy.controldir import ControlDir
3961
3962 from lp.testing import TestCase
3963 from lp.translations.pottery.detect_intltool import is_intltool_structure
3964@@ -56,7 +56,7 @@ class SetupTestPackageMixin:
3965 class TestDetectIntltoolInBzrTree(TestCase, SetupTestPackageMixin):
3966
3967 def prepare_tree(self):
3968- return BzrDir.create_standalone_workingtree(".")
3969+ return ControlDir.create_standalone_workingtree(".")
3970
3971 def test_detect_intltool_structure(self):
3972 # Detect a simple intltool structure.
3973diff --git a/lib/lp/translations/scripts/tests/test_translations_to_branch.py b/lib/lp/translations/scripts/tests/test_translations_to_branch.py
3974index ec201fe..248b2e0 100644
3975--- a/lib/lp/translations/scripts/tests/test_translations_to_branch.py
3976+++ b/lib/lp/translations/scripts/tests/test_translations_to_branch.py
3977@@ -7,7 +7,7 @@ import datetime
3978 import re
3979 from textwrap import dedent
3980
3981-from bzrlib.errors import NotBranchError
3982+from breezy.errors import NotBranchError
3983 import pytz
3984 from testtools.matchers import MatchesRegex
3985 import transaction
3986@@ -193,7 +193,7 @@ class TestExportTranslationsToBranch(TestCaseWithFactory):
3987 self.assertTrue("GruesomeException" in message)
3988
3989 def test_exportToBranches_handles_unpushed_branches(self):
3990- # bzrlib raises NotBranchError when accessing a nonexistent
3991+ # breezy raises NotBranchError when accessing a nonexistent
3992 # branch. The exporter deals with that by calling
3993 # _handleUnpushedBranch.
3994 exporter = ExportTranslationsToBranch(test_args=[])
3995diff --git a/lib/lp/translations/scripts/translations_to_branch.py b/lib/lp/translations/scripts/translations_to_branch.py
3996index 973b45f..5f7a64f 100644
3997--- a/lib/lp/translations/scripts/translations_to_branch.py
3998+++ b/lib/lp/translations/scripts/translations_to_branch.py
3999@@ -17,8 +17,8 @@ import os.path
4000 # line below this comment.
4001 import lp.codehosting
4002
4003-from bzrlib.errors import NotBranchError
4004-from bzrlib.revision import NULL_REVISION
4005+from breezy.errors import NotBranchError
4006+from breezy.revision import NULL_REVISION
4007 import pytz
4008 from storm.expr import (
4009 And,
4010diff --git a/lib/lp/translations/tests/test_rosetta_branches_script.py b/lib/lp/translations/tests/test_rosetta_branches_script.py
4011index 1d332d4..1d140cd 100644
4012--- a/lib/lp/translations/tests/test_rosetta_branches_script.py
4013+++ b/lib/lp/translations/tests/test_rosetta_branches_script.py
4014@@ -9,7 +9,7 @@ provisions to handle Bazaar branches.
4015
4016 __metaclass__ = type
4017
4018-from bzrlib.revision import NULL_REVISION
4019+from breezy.revision import NULL_REVISION
4020 import transaction
4021 from zope.component import getUtility
4022
4023@@ -43,11 +43,11 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
4024 self.useBzrBranches()
4025 pot_content = self.factory.getUniqueString()
4026 branch, tree = self.create_branch_and_tree()
4027- tree.bzrdir.root_transport.put_bytes(pot_path, pot_content)
4028+ tree.controldir.root_transport.put_bytes(pot_path, pot_content)
4029 tree.add(pot_path)
4030 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
4031 # required to generate the revision-id.
4032- with override_environ(BZR_EMAIL='me@example.com'):
4033+ with override_environ(BRZ_EMAIL='me@example.com'):
4034 revision_id = tree.commit("first commit")
4035 branch.last_scanned_id = revision_id
4036 branch.last_mirrored_id = revision_id
4037diff --git a/lib/lp_sitecustomize.py b/lib/lp_sitecustomize.py
4038index 67c0030..d23cd74 100644
4039--- a/lib/lp_sitecustomize.py
4040+++ b/lib/lp_sitecustomize.py
4041@@ -77,11 +77,12 @@ def silence_amqp_logger():
4042 amqp_logger.propagate = False
4043
4044
4045-def silence_bzr_logger():
4046- """Install the NullHandler on the bzr logger to silence logs."""
4047- bzr_logger = logging.getLogger('bzr')
4048- bzr_logger.addHandler(logging.NullHandler())
4049- bzr_logger.propagate = False
4050+def silence_bzr_loggers():
4051+ """Install the NullHandler on the bzr/brz loggers to silence logs."""
4052+ for logger_name in ('bzr', 'brz'):
4053+ logger = logging.getLogger(logger_name)
4054+ logger.addHandler(logging.NullHandler())
4055+ logger.propagate = False
4056
4057
4058 def silence_swiftclient_logger():
4059@@ -154,7 +155,7 @@ def customize_logger():
4060 logging between tests.
4061 """
4062 silence_amqp_logger()
4063- silence_bzr_logger()
4064+ silence_bzr_loggers()
4065 silence_zcml_logger()
4066 silence_transaction_logger()
4067 silence_swiftclient_logger()
4068@@ -185,3 +186,9 @@ def main(instance_name=None):
4069 # through actually using itertools.groupby.
4070 grouper = type(list(itertools.groupby([0]))[0][1])
4071 checker.BasicTypes[grouper] = checker._iteratorChecker
4072+
4073+ # XXX 2019-09-17: git must be disabled until codeimport is upgraded,
4074+ # since the required dulwich versions for our current version of bzr-git
4075+ # and for Breezy are incompatible in both directions.
4076+ import types
4077+ sys.modules['breezy.git'] = types.ModuleType('breezy.git')
4078diff --git a/scripts/mirror-branch.py b/scripts/mirror-branch.py
4079index a493cf0..90f8cef 100755
4080--- a/scripts/mirror-branch.py
4081+++ b/scripts/mirror-branch.py
4082@@ -33,7 +33,7 @@ import os
4083 import resource
4084 import sys
4085
4086-import bzrlib.repository
4087+import breezy.repository
4088
4089 from lp.code.enums import BranchType
4090 from lp.codehosting.puller.worker import (
4091@@ -54,24 +54,7 @@ def shut_up_deprecation_warning():
4092 # XXX DavidAllouche 2006-01-29:
4093 # Quick hack to disable the deprecation warning for old repository
4094 # formats.
4095- bzrlib.repository._deprecation_warning_done = True
4096-
4097-
4098-def force_bzr_to_use_urllib():
4099- # These lines prevent bzr from using pycurl to connect to http: urls. We
4100- # want this for two reasons:
4101- # 1) pycurl rejects self signed certificates, which prevents a significant
4102- # number of mirror branchs from updating, and
4103- # 2) the script sometimes hangs inside pycurl, preventing all mirrors from
4104- # being updated until the script is restarted.
4105- # There is no test for this (it would involve a great number of moving
4106- # parts) but it has been verified to work on production. Also see
4107- # https://bugs.launchpad.net/bzr/+bug/82086
4108- from bzrlib.transport import register_lazy_transport
4109- register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
4110- 'HttpTransport_urllib')
4111- register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
4112- 'HttpTransport_urllib')
4113+ breezy.repository._deprecation_warning_done = True
4114
4115
4116 if __name__ == '__main__':
4117@@ -86,7 +69,6 @@ if __name__ == '__main__':
4118 section_name = 'supermirror_%s_puller' % branch_type_map[branch_type]
4119 globalErrorUtility.configure(section_name)
4120 shut_up_deprecation_warning()
4121- force_bzr_to_use_urllib()
4122
4123 resource.setrlimit(resource.RLIMIT_AS, (1500000000, 1500000000))
4124
4125diff --git a/scripts/update-stacked-on.py b/scripts/update-stacked-on.py
4126index 41e11fa..dda181d 100755
4127--- a/scripts/update-stacked-on.py
4128+++ b/scripts/update-stacked-on.py
4129@@ -23,9 +23,10 @@ import _pythonpath
4130 from collections import namedtuple
4131 import sys
4132
4133-from bzrlib import errors
4134-from bzrlib.bzrdir import BzrDir
4135-from bzrlib.config import TransportConfig
4136+from breezy import errors
4137+from breezy.branch import UnstackableBranchFormat
4138+from breezy.bzr.bzrdir import BzrDir
4139+from breezy.config import TransportConfig
4140
4141 from lp.code.interfaces.codehosting import branch_id_alias
4142 from lp.codehosting.bzrutils import get_branch_stacked_on_url
4143@@ -109,7 +110,7 @@ class UpdateStackedBranches(LaunchpadScript):
4144 self.logger.warn(
4145 "Branch for %r at %r is not stacked at all. Giving up."
4146 % (branch_id, bzr_branch_url))
4147- except errors.UnstackableBranchFormat:
4148+ except UnstackableBranchFormat:
4149 self.logger.error(
4150 "Branch for %r at %r is unstackable. Giving up."
4151 % (branch_id, bzr_branch_url))
4152diff --git a/setup.py b/setup.py
4153index 2f9ab7a..3f7b6b3 100644
4154--- a/setup.py
4155+++ b/setup.py
4156@@ -149,6 +149,7 @@ setup(
4157 'backports.lzma',
4158 'BeautifulSoup',
4159 'beautifulsoup4[lxml]',
4160+ 'breezy',
4161 'bzr',
4162 'celery',
4163 'cssselect',
4164@@ -283,6 +284,7 @@ setup(
4165 'zope.vocabularyregistry',
4166 # Loggerhead dependencies. These should be removed once
4167 # bug 383360 is fixed and we include it as a source dist.
4168+ 'bleach',
4169 'Paste',
4170 'PasteDeploy',
4171 'SimpleTAL',
4172diff --git a/utilities/create-lp-wadl-and-apidoc.py b/utilities/create-lp-wadl-and-apidoc.py
4173index 808c991..4894943 100755
4174--- a/utilities/create-lp-wadl-and-apidoc.py
4175+++ b/utilities/create-lp-wadl-and-apidoc.py
4176@@ -18,8 +18,8 @@ import os
4177 import subprocess
4178 import sys
4179
4180-import bzrlib
4181-from bzrlib.branch import Branch
4182+import breezy
4183+from breezy.branch import Branch
4184 from lazr.restful.interfaces import IWebServiceConfiguration
4185 from z3c.ptcompat import PageTemplateFile
4186 from zope.component import getUtility
4187@@ -144,7 +144,7 @@ def main(directory, force=False):
4188 ["git", "log", "-1", "--format=%ct", "HEAD"],
4189 universal_newlines=True))
4190 else:
4191- with bzrlib.initialize():
4192+ with breezy.get_global_state():
4193 branch = Branch.open(top)
4194 timestamp = branch.repository.get_revision(
4195 branch.last_revision()).timestamp
4196diff --git a/utilities/sourcedeps.cache b/utilities/sourcedeps.cache
4197index 1360489..59ec12b 100644
4198--- a/utilities/sourcedeps.cache
4199+++ b/utilities/sourcedeps.cache
4200@@ -1,16 +1,16 @@
4201 {
4202- "bzr-builder": [
4203- 70,
4204- "launchpad@pqm.canonical.com-20111114140506-6bmt9isw6lcud7yt"
4205+ "brz-builder": [
4206+ 180,
4207+ "jelmer@jelmer.uk-20180624153632-1f0weftl0pawz6wj"
4208+ ],
4209+ "brz-loom": [
4210+ 166,
4211+ "jelmer@jelmer.uk-20190822193925-ydrq7fgdi78lpgm7"
4212 ],
4213 "bzr-git": [
4214 280,
4215 "launchpad@pqm.canonical.com-20171222005919-u98ut0f5z2g618um"
4216 ],
4217- "bzr-loom": [
4218- 55,
4219- "launchpad@pqm.canonical.com-20120830090804-cg49kky93htwax7s"
4220- ],
4221 "bzr-svn": [
4222 2725,
4223 "launchpad@pqm.canonical.com-20130816045016-wzr810hu2z459t4y"
4224@@ -24,8 +24,8 @@
4225 "cjwatson@canonical.com-20190614154330-091l9edcnubsjmsx"
4226 ],
4227 "loggerhead": [
4228- 493,
4229- "cjwatson@canonical.com-20190621112125-3aaxj3hrmty19lr6"
4230+ 494,
4231+ "cjwatson@canonical.com-20190919081036-q1symc2h2iedtlh3"
4232 ],
4233 "mailman": [
4234 977,
4235diff --git a/utilities/sourcedeps.conf b/utilities/sourcedeps.conf
4236index d1dc1df..f21c98f 100644
4237--- a/utilities/sourcedeps.conf
4238+++ b/utilities/sourcedeps.conf
4239@@ -7,13 +7,13 @@
4240 #### DEPRECATED. NO NEW ITEMS. NO NO NO NO NO NONONONONO
4241 #########################################################
4242
4243-bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=70
4244+brz-builder lp:~jelmer/brz-builder/trunk;revno=180
4245+brz-loom lp:~jelmer/brz-loom/trunk;revno=166
4246 bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=280
4247-bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=55
4248 bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2725
4249 cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=433
4250 difftacular lp:~launchpad/difftacular/trunk;revno=11
4251-loggerhead lp:~loggerhead-team/loggerhead/trunk-rich;revno=493
4252+loggerhead lp:~loggerhead-team/loggerhead/trunk-rich;revno=494
4253 mailman lp:~launchpad-pqm/mailman/2.1;revno=977
4254 old_xmlplus lp:~launchpad-pqm/dtdparser/trunk;revno=4
4255 pygettextpo lp:~launchpad-pqm/pygettextpo/trunk;revno=25

Subscribers

People subscribed via source and target branches

to status/vote changes: