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
diff --git a/Makefile b/Makefile
index 62d59e2..0fc97c2 100644
--- a/Makefile
+++ b/Makefile
@@ -306,10 +306,10 @@ run_all: build inplace stop
306 memcached,rabbitmq -i $(LPCONFIG)306 memcached,rabbitmq -i $(LPCONFIG)
307307
308run_codebrowse: compile308run_codebrowse: compile
309 BZR_PLUGIN_PATH=bzrplugins $(PY) scripts/start-loggerhead.py309 BRZ_PLUGIN_PATH=brzplugins $(PY) scripts/start-loggerhead.py
310310
311start_codebrowse: compile311start_codebrowse: compile
312 BZR_PLUGIN_PATH=$(shell pwd)/bzrplugins $(PY) scripts/start-loggerhead.py --daemon312 BRZ_PLUGIN_PATH=$(shell pwd)/brzplugins $(PY) scripts/start-loggerhead.py --daemon
313313
314stop_codebrowse:314stop_codebrowse:
315 $(PY) scripts/stop-loggerhead.py315 $(PY) scripts/stop-loggerhead.py
diff --git a/brzplugins/builder b/brzplugins/builder
316new file mode 120000316new file mode 120000
index 0000000..2877987
--- /dev/null
+++ b/brzplugins/builder
@@ -0,0 +1 @@
1../sourcecode/brz-builder/brzbuildrecipe
0\ No newline at end of file2\ No newline at end of file
diff --git a/brzplugins/difftacular b/brzplugins/difftacular
1new file mode 1200003new file mode 120000
index 0000000..e34dfd2
--- /dev/null
+++ b/brzplugins/difftacular
@@ -0,0 +1 @@
1../sourcecode/difftacular
0\ No newline at end of file2\ No newline at end of file
diff --git a/brzplugins/loom b/brzplugins/loom
1new file mode 1200003new file mode 120000
index 0000000..ed0b36f
--- /dev/null
+++ b/brzplugins/loom
@@ -0,0 +1 @@
1../sourcecode/brz-loom
0\ No newline at end of file2\ No newline at end of file
diff --git a/bzrplugins/lpserve/__init__.py b/brzplugins/lpserve/__init__.py
1similarity index 97%3similarity index 97%
2rename from bzrplugins/lpserve/__init__.py4rename from bzrplugins/lpserve/__init__.py
3rename to brzplugins/lpserve/__init__.py5rename to brzplugins/lpserve/__init__.py
index 1db2554..b956568 100644
--- a/bzrplugins/lpserve/__init__.py
+++ b/brzplugins/lpserve/__init__.py
@@ -28,7 +28,7 @@ import tempfile
28import threading28import threading
29import time29import time
3030
31from bzrlib import (31from breezy import (
32 commands,32 commands,
33 errors,33 errors,
34 lockdir,34 lockdir,
@@ -36,15 +36,15 @@ from bzrlib import (
36 trace,36 trace,
37 ui,37 ui,
38 )38 )
39from bzrlib.commands import (39from breezy.commands import (
40 Command,40 Command,
41 register_command,41 register_command,
42 )42 )
43from bzrlib.option import (43from breezy.option import (
44 Option,44 Option,
45 RegistryOption,45 RegistryOption,
46 )46 )
47from bzrlib.transport import (47from breezy.transport import (
48 get_transport,48 get_transport,
49 transport_server_registry,49 transport_server_registry,
50 )50 )
@@ -88,7 +88,7 @@ class cmd_launchpad_server(Command):
88 type=unicode),88 type=unicode),
89 RegistryOption(89 RegistryOption(
90 'protocol', help="Protocol to serve.",90 'protocol', help="Protocol to serve.",
91 lazy_registry=('bzrlib.transport', 'transport_server_registry'),91 lazy_registry=('breezy.transport', 'transport_server_registry'),
92 value_switches=True),92 value_switches=True),
93 ]93 ]
9494
@@ -192,7 +192,7 @@ class LPForkingService(object):
192 that should be reset.192 that should be reset.
193193
194 fork-env allows you to supply environment variables such as194 fork-env allows you to supply environment variables such as
195 "BZR_EMAIL: joe@foo.com" which will be set in os.environ before195 "BRZ_EMAIL: joe@foo.com" which will be set in os.environ before
196 the command is run.196 the command is run.
197 """197 """
198198
@@ -301,9 +301,9 @@ class LPForkingService(object):
301 # don't know any way to *remove* a function registered via301 # don't know any way to *remove* a function registered via
302 # 'atexit()' so if the forking service has some state, we my try to302 # 'atexit()' so if the forking service has some state, we my try to
303 # clean it up incorrectly.303 # clean it up incorrectly.
304 # Note that the bzr script itself uses sys.exitfunc(); os._exit() in304 # Note that the brz script itself uses sys.exitfunc(); os._exit() in
305 # the 'bzr' main script, as the teardown time of all the python305 # the 'brz' main script, as the teardown time of all the python
306 # state was quite noticeable in real-world runtime. As such, bzrlib306 # state was quite noticeable in real-world runtime. As such, breezy
307 # should be pretty safe, or it would have been failing for people307 # should be pretty safe, or it would have been failing for people
308 # already.308 # already.
309 # [Decision #7]309 # [Decision #7]
@@ -483,7 +483,7 @@ class LPForkingService(object):
483 os.rmdir(base_path)483 os.rmdir(base_path)
484484
485 def _bind_child_file_descriptors(self, base_path):485 def _bind_child_file_descriptors(self, base_path):
486 # Note: by this point bzrlib has opened stderr for logging486 # Note: by this point breezy has opened stderr for logging
487 # (as part of starting the service process in the first place).487 # (as part of starting the service process in the first place).
488 # As such, it has a stream handler that writes to stderr.488 # As such, it has a stream handler that writes to stderr.
489 # logging tries to flush and close that, but the file is already489 # logging tries to flush and close that, but the file is already
@@ -975,16 +975,16 @@ register_command(cmd_launchpad_replay)
975# manually, and observe what was expensive to import. It doesn't seem975# manually, and observe what was expensive to import. It doesn't seem
976# very easy to get this right automatically.976# very easy to get this right automatically.
977libraries_to_preload = [977libraries_to_preload = [
978 'bzrlib.errors',978 'breezy.bzr.groupcompress_repo',
979 'bzrlib.repofmt.groupcompress_repo',979 'breezy.bzr.smart',
980 'bzrlib.repository',980 'breezy.bzr.smart.protocol',
981 'bzrlib.smart',981 'breezy.bzr.smart.request',
982 'bzrlib.smart.protocol',982 'breezy.bzr.smart.server',
983 'bzrlib.smart.request',983 'breezy.bzr.smart.vfs',
984 'bzrlib.smart.server',984 'breezy.errors',
985 'bzrlib.smart.vfs',985 'breezy.repository',
986 'bzrlib.transport.local',986 'breezy.transport.local',
987 'bzrlib.transport.readonly',987 'breezy.transport.readonly',
988 'lp.codehosting.bzrutils',988 'lp.codehosting.bzrutils',
989 'lp.codehosting.vfs',989 'lp.codehosting.vfs',
990 'lp.codehosting.vfs.branchfs',990 'lp.codehosting.vfs.branchfs',
diff --git a/bzrplugins/lpserve/test_lpserve.py b/brzplugins/lpserve/test_lpserve.py
991similarity index 96%991similarity index 96%
992rename from bzrplugins/lpserve/test_lpserve.py992rename from bzrplugins/lpserve/test_lpserve.py
993rename to brzplugins/lpserve/test_lpserve.py993rename to brzplugins/lpserve/test_lpserve.py
index 6879ee6..3801df4 100644
--- a/bzrplugins/lpserve/test_lpserve.py
+++ b/brzplugins/lpserve/test_lpserve.py
@@ -11,18 +11,18 @@ import tempfile
11import threading11import threading
12import time12import time
1313
14from bzrlib import (14from breezy import (
15 errors,15 errors,
16 osutils,16 osutils,
17 tests,17 tests,
18 trace,18 trace,
19 )19 )
20from bzrlib.plugins import lpserve20from breezy.plugins import lpserve
21from testtools import content21from testtools import content
2222
23from lp.codehosting import (23from lp.codehosting import (
24 get_bzr_path,24 get_brz_path,
25 get_BZR_PLUGIN_PATH_for_subprocess,25 get_BRZ_PLUGIN_PATH_for_subprocess,
26 )26 )
27from lp.testing.fakemethod import FakeMethod27from lp.testing.fakemethod import FakeMethod
2828
@@ -187,13 +187,13 @@ class TestLPForkingServiceParseEnv(tests.TestCase):
187 self.assertEnv({}, 'end\n')187 self.assertEnv({}, 'end\n')
188188
189 def test_one_entries(self):189 def test_one_entries(self):
190 self.assertEnv({'BZR_EMAIL': 'joe@foo.com'},190 self.assertEnv({'BRZ_EMAIL': 'joe@foo.com'},
191 'BZR_EMAIL: joe@foo.com\n'191 'BRZ_EMAIL: joe@foo.com\n'
192 'end\n')192 'end\n')
193193
194 def test_two_entries(self):194 def test_two_entries(self):
195 self.assertEnv({'BZR_EMAIL': 'joe@foo.com', 'BAR': 'foo'},195 self.assertEnv({'BRZ_EMAIL': 'joe@foo.com', 'BAR': 'foo'},
196 'BZR_EMAIL: joe@foo.com\n'196 'BRZ_EMAIL: joe@foo.com\n'
197 'BAR: foo\n'197 'BAR: foo\n'
198 'end\n')198 'end\n')
199199
@@ -201,10 +201,10 @@ class TestLPForkingServiceParseEnv(tests.TestCase):
201 self.assertInvalid('')201 self.assertInvalid('')
202202
203 def test_invalid_end(self):203 def test_invalid_end(self):
204 self.assertInvalid("BZR_EMAIL: joe@foo.com\n")204 self.assertInvalid("BRZ_EMAIL: joe@foo.com\n")
205205
206 def test_invalid_entry(self):206 def test_invalid_entry(self):
207 self.assertInvalid("BZR_EMAIL joe@foo.com\nend\n")207 self.assertInvalid("BRZ_EMAIL joe@foo.com\nend\n")
208208
209209
210class TestLPForkingService(TestCaseWithLPForkingService):210class TestLPForkingService(TestCaseWithLPForkingService):
@@ -238,19 +238,19 @@ class TestLPForkingService(TestCaseWithLPForkingService):
238 def test_send_fork_env_with_env(self):238 def test_send_fork_env_with_env(self):
239 response = self.send_message_to_service(239 response = self.send_message_to_service(
240 'fork-env rocks\n'240 'fork-env rocks\n'
241 'BZR_EMAIL: joe@example.com\n'241 'BRZ_EMAIL: joe@example.com\n'
242 'end\n')242 'end\n')
243 self.assertEqual('ok\nfake forking\n', response)243 self.assertEqual('ok\nfake forking\n', response)
244 self.assertEqual([(['rocks'], {'BZR_EMAIL': 'joe@example.com'})],244 self.assertEqual([(['rocks'], {'BRZ_EMAIL': 'joe@example.com'})],
245 self.service.fork_log)245 self.service.fork_log)
246246
247 def test_send_fork_env_slowly(self):247 def test_send_fork_env_slowly(self):
248 response = self.send_message_to_service(248 response = self.send_message_to_service(
249 'fork-env rocks\n'249 'fork-env rocks\n'
250 'BZR_EMAIL: joe@example.com\n'250 'BRZ_EMAIL: joe@example.com\n'
251 'end\n', one_byte_at_a_time=True)251 'end\n', one_byte_at_a_time=True)
252 self.assertEqual('ok\nfake forking\n', response)252 self.assertEqual('ok\nfake forking\n', response)
253 self.assertEqual([(['rocks'], {'BZR_EMAIL': 'joe@example.com'})],253 self.assertEqual([(['rocks'], {'BRZ_EMAIL': 'joe@example.com'})],
254 self.service.fork_log)254 self.service.fork_log)
255255
256 def test_send_incomplete_fork_env_timeout(self):256 def test_send_incomplete_fork_env_timeout(self):
@@ -258,7 +258,7 @@ class TestLPForkingService(TestCaseWithLPForkingService):
258 # content258 # content
259 response = self.send_message_to_service(259 response = self.send_message_to_service(
260 'fork-env rocks\n'260 'fork-env rocks\n'
261 'BZR_EMAIL: joe@example.com\n',261 'BRZ_EMAIL: joe@example.com\n',
262 one_byte_at_a_time=True)262 one_byte_at_a_time=True)
263 # Note that we *don't* send a final 'end\n'263 # Note that we *don't* send a final 'end\n'
264 self.assertStartsWith(response, 'FAILURE\n')264 self.assertStartsWith(response, 'FAILURE\n')
@@ -315,24 +315,24 @@ class TestCaseWithSubprocess(tests.TestCaseWithTransport):
315 The launchpad infrastructure requires a fair amount of configuration to315 The launchpad infrastructure requires a fair amount of configuration to
316 get paths, etc correct. This provides a "start_bzr_subprocess" command316 get paths, etc correct. This provides a "start_bzr_subprocess" command
317 that has all of those paths appropriately set, but otherwise functions the317 that has all of those paths appropriately set, but otherwise functions the
318 same as the bzrlib.tests.TestCase version.318 same as the breezy.tests.TestCase version.
319 """319 """
320320
321 def start_bzr_subprocess(self, process_args, env_changes=None,321 def start_bzr_subprocess(self, process_args, env_changes=None,
322 working_dir=None):322 working_dir=None):
323 """Start bzr in a subprocess for testing.323 """Start bzr in a subprocess for testing.
324324
325 Copied and modified from `bzrlib.tests.TestCase.start_bzr_subprocess`.325 Copied and modified from `breezy.tests.TestCase.start_bzr_subprocess`.
326 This version removes some of the skipping stuff, some of the326 This version removes some of the skipping stuff, some of the
327 irrelevant comments (e.g. about win32) and uses Launchpad's own327 irrelevant comments (e.g. about win32) and uses Launchpad's own
328 mechanisms for getting the path to 'bzr'.328 mechanisms for getting the path to 'brz'.
329329
330 Comments starting with 'LAUNCHPAD' are comments about our330 Comments starting with 'LAUNCHPAD' are comments about our
331 modifications.331 modifications.
332 """332 """
333 if env_changes is None:333 if env_changes is None:
334 env_changes = {}334 env_changes = {}
335 env_changes['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()335 env_changes['BRZ_PLUGIN_PATH'] = get_BRZ_PLUGIN_PATH_for_subprocess()
336 old_env = {}336 old_env = {}
337337
338 def cleanup_environment():338 def cleanup_environment():
@@ -348,12 +348,12 @@ class TestCaseWithSubprocess(tests.TestCaseWithTransport):
348 cwd = osutils.getcwd()348 cwd = osutils.getcwd()
349 os.chdir(working_dir)349 os.chdir(working_dir)
350350
351 # LAUNCHPAD: We can't use self.get_bzr_path(), since it'll find351 # LAUNCHPAD: We can't use self.get_brz_path(), since it'll find
352 # lib/bzrlib, rather than the path to bin/bzr.352 # lib/breezy, rather than the path to bin/brz.
353 bzr_path = get_bzr_path()353 brz_path = get_brz_path()
354 try:354 try:
355 cleanup_environment()355 cleanup_environment()
356 command = [bzr_path]356 command = [brz_path]
357 command.extend(process_args)357 command.extend(process_args)
358 process = self._popen(358 process = self._popen(
359 command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,359 command, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
@@ -464,8 +464,8 @@ class TestCaseWithLPForkingServiceSubprocess(TestCaseWithSubprocess):
464 # The service wants to create this file as a socket.464 # The service wants to create this file as a socket.
465 os.remove(path)465 os.remove(path)
466 env_changes = {466 env_changes = {
467 'BZR_PLUGIN_PATH': lpserve.__path__[0],467 'BRZ_PLUGIN_PATH': lpserve.__path__[0],
468 'BZR_LOG': tempname,468 'BRZ_LOG': tempname,
469 }469 }
470 proc = self._start_subprocess(path, env_changes)470 proc = self._start_subprocess(path, env_changes)
471 return proc, path471 return proc, path
@@ -579,7 +579,7 @@ class TestLPServiceInSubprocess(TestCaseWithLPForkingServiceSubprocess):
579579
580 def test_fork_respects_env_vars(self):580 def test_fork_respects_env_vars(self):
581 path, pid, sock = self.send_fork_request('whoami',581 path, pid, sock = self.send_fork_request('whoami',
582 env={'BZR_EMAIL': 'this_test@example.com'})582 env={'BRZ_EMAIL': 'this_test@example.com'})
583 stdout_content, stderr_content = self.communicate_with_fork(path)583 stdout_content, stderr_content = self.communicate_with_fork(path)
584 self.assertEqual('', stderr_content)584 self.assertEqual('', stderr_content)
585 self.assertEqual('this_test@example.com\n', stdout_content)585 self.assertEqual('this_test@example.com\n', stdout_content)
diff --git a/bzrplugins/builder b/bzrplugins/builder
586deleted file mode 120000586deleted file mode 120000
index 733b41e..0000000
--- a/bzrplugins/builder
+++ /dev/null
@@ -1 +0,0 @@
1../sourcecode/bzr-builder/
2\ No newline at end of file0\ No newline at end of file
diff --git a/bzrplugins/difftacular b/bzrplugins/difftacular
3deleted file mode 1200001deleted file mode 120000
index 7129510..0000000
--- a/bzrplugins/difftacular
+++ /dev/null
@@ -1 +0,0 @@
1../sourcecode/difftacular/
2\ No newline at end of file0\ No newline at end of file
diff --git a/bzrplugins/loom b/bzrplugins/loom
3deleted file mode 1200001deleted file mode 120000
index 68f0573..0000000
--- a/bzrplugins/loom
+++ /dev/null
@@ -1 +0,0 @@
1../sourcecode/bzr-loom
2\ No newline at end of file0\ No newline at end of file
diff --git a/constraints.txt b/constraints.txt
index 6a7b6c3..fccf0fa 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -176,11 +176,14 @@ backports.lzma==0.0.3
176BeautifulSoup==3.2.1176BeautifulSoup==3.2.1
177beautifulsoup4[lxml]==4.7.1177beautifulsoup4[lxml]==4.7.1
178billiard==3.5.0.5178billiard==3.5.0.5
179bleach==3.1.0
180breezy==3.0.1
179bson==0.3.3181bson==0.3.3
180# lp:~launchpad/bzr/lp182# lp:~launchpad/bzr/lp
181bzr==2.6.0.lp.4183bzr==2.6.0.lp.4
182celery==4.1.1184celery==4.1.1
183Chameleon==2.11185Chameleon==2.11
186configobj==5.0.6
184constantly==15.1.0187constantly==15.1.0
185cookies==2.2.1188cookies==2.2.1
186cryptography==2.7189cryptography==2.7
@@ -197,6 +200,7 @@ eggtestinfo==0.3
197elementtree==1.2.6-20050316200elementtree==1.2.6-20050316
198enum34==1.1.6201enum34==1.1.6
199epydoc==3.0.1202epydoc==3.0.1
203fastimport==0.9.8
200feedparser==5.2.1204feedparser==5.2.1
201feedvalidator==0.0.0DEV-r1049205feedvalidator==0.0.0DEV-r1049
202FormEncode==1.2.4206FormEncode==1.2.4
@@ -310,6 +314,7 @@ vine==1.1.4
310virtualenv-tools3==2.0.0314virtualenv-tools3==2.0.0
311wadllib==1.3.2315wadllib==1.3.2
312waitress==1.3.1316waitress==1.3.1
317webencodings==0.5.1
313WebOb==1.8.5318WebOb==1.8.5
314WebTest==2.0.33319WebTest==2.0.33
315wheel==0.29.0320wheel==0.29.0
diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py
index ce24213..cd98725 100644
--- a/lib/launchpad_loggerhead/app.py
+++ b/lib/launchpad_loggerhead/app.py
@@ -8,13 +8,13 @@ import urllib
8import urlparse8import urlparse
9import xmlrpclib9import xmlrpclib
1010
11from bzrlib import (11from breezy import (
12 errors,12 errors,
13 lru_cache,13 lru_cache,
14 urlutils,14 urlutils,
15 )15 )
16from bzrlib.transport import get_transport16from breezy.transport import get_transport
17from bzrlib.url_policy_open import open_only_scheme17from breezy.url_policy_open import open_only_scheme
18from loggerhead.apps import (18from loggerhead.apps import (
19 favicon_app,19 favicon_app,
20 static_app,20 static_app,
diff --git a/lib/launchpad_loggerhead/wsgi.py b/lib/launchpad_loggerhead/wsgi.py
index e8822b1..ca95aef 100644
--- a/lib/launchpad_loggerhead/wsgi.py
+++ b/lib/launchpad_loggerhead/wsgi.py
@@ -153,16 +153,16 @@ class LoggerheadApplication(Application):
153 cfg.update(self.options)153 cfg.update(self.options)
154 return cfg154 return cfg
155155
156 def _load_bzr_plugins(self):156 def _load_brz_plugins(self):
157 from bzrlib.plugin import load_plugins157 from breezy.plugin import load_plugins
158 load_plugins()158 load_plugins()
159159
160 import bzrlib.plugins160 import breezy.plugins
161 if getattr(bzrlib.plugins, "loom", None) is None:161 if getattr(breezy.plugins, "loom", None) is None:
162 log.error("Loom plugin loading failed.")162 log.error("Loom plugin loading failed.")
163163
164 def load(self):164 def load(self):
165 self._load_bzr_plugins()165 self._load_brz_plugins()
166166
167 with open(os.path.join(167 with open(os.path.join(
168 config.root, config.codebrowse.secret_path)) as secret_file:168 config.root, config.codebrowse.secret_path)) as secret_file:
diff --git a/lib/lp/app/browser/stringformatter.py b/lib/lp/app/browser/stringformatter.py
index 1198a83..57b8eaf 100644
--- a/lib/lp/app/browser/stringformatter.py
+++ b/lib/lp/app/browser/stringformatter.py
@@ -21,7 +21,7 @@ from itertools import izip_longest
21import re21import re
22import sys22import sys
2323
24from bzrlib.patches import hunk_from_header24from breezy.patches import hunk_from_header
25from lxml import html25from lxml import html
26import markdown26import markdown
27from zope.component import getUtility27from zope.component import getUtility
diff --git a/lib/lp/code/browser/bazaar.py b/lib/lp/code/browser/bazaar.py
index 26b34dc..305c740 100644
--- a/lib/lp/code/browser/bazaar.py
+++ b/lib/lp/code/browser/bazaar.py
@@ -12,7 +12,7 @@ __all__ = [
1212
13from datetime import datetime13from datetime import datetime
1414
15import bzrlib15import breezy
16from zope.component import getUtility16from zope.component import getUtility
1717
18from lp.code.enums import CodeImportReviewStatus18from lp.code.enums import CodeImportReviewStatus
@@ -51,8 +51,8 @@ class BazaarApplicationView(LaunchpadView):
51 review_status=CodeImportReviewStatus.REVIEWED).count()51 review_status=CodeImportReviewStatus.REVIEWED).count()
5252
53 @property53 @property
54 def bzr_version(self):54 def brz_version(self):
55 return bzrlib.__version__55 return breezy.__version__
5656
57 def _precacheViewPermissions(self, branches):57 def _precacheViewPermissions(self, branches):
58 """Precache the launchpad.View permissions on the branches."""58 """Precache the launchpad.View permissions on the branches."""
diff --git a/lib/lp/code/browser/sourcepackagerecipe.py b/lib/lp/code/browser/sourcepackagerecipe.py
index a16f29b..d712879 100644
--- a/lib/lp/code/browser/sourcepackagerecipe.py
+++ b/lib/lp/code/browser/sourcepackagerecipe.py
@@ -17,7 +17,7 @@ __all__ = [
1717
18import itertools18import itertools
1919
20from bzrlib.plugins.builder.recipe import (20from breezy.plugins.builder.recipe import (
21 ForbiddenInstructionError,21 ForbiddenInstructionError,
22 RecipeParseError,22 RecipeParseError,
23 )23 )
diff --git a/lib/lp/code/bzr.py b/lib/lp/code/bzr.py
index 10683e1..fe1a7d8 100644
--- a/lib/lp/code/bzr.py
+++ b/lib/lp/code/bzr.py
@@ -24,53 +24,53 @@ import lp.codehosting
24# Silence lint warning.24# Silence lint warning.
25lp.codehosting25lp.codehosting
2626
27from bzrlib.branch import (27from breezy.branch import UnstackableBranchFormat
28from breezy.bzr.branch import (
28 BranchReferenceFormat,29 BranchReferenceFormat,
29 BzrBranchFormat6,30 BzrBranchFormat6,
30 BzrBranchFormat7,31 BzrBranchFormat7,
31 )32 )
32from bzrlib.branchfmt.fullhistory import BzrBranchFormat533from breezy.bzr.bzrdir import (
33from bzrlib.bzrdir import (
34 BzrDirMetaFormat1,34 BzrDirMetaFormat1,
35 BzrDirMetaFormat1Colo,35 BzrDirMetaFormat1Colo,
36 )36 )
37from bzrlib.errors import (37from breezy.bzr.fullhistory import BzrBranchFormat5
38from breezy.bzr.groupcompress_repo import RepositoryFormat2a
39from breezy.bzr.knitpack_repo import (
40 RepositoryFormatKnitPack1,
41 RepositoryFormatKnitPack3,
42 RepositoryFormatKnitPack4,
43 RepositoryFormatKnitPack5,
44 )
45from breezy.bzr.knitrepo import (
46 RepositoryFormatKnit1,
47 RepositoryFormatKnit3,
48 RepositoryFormatKnit4,
49 )
50from breezy.errors import (
38 NotStacked,51 NotStacked,
39 NoSuchRevision,52 NoSuchRevision,
40 UnstackableBranchFormat,
41 )53 )
42from bzrlib.plugins.loom.branch import (54from breezy.plugins.loom.branch import (
43 BzrBranchLoomFormat1,55 BzrBranchLoomFormat1,
44 BzrBranchLoomFormat6,56 BzrBranchLoomFormat6,
45 )57 )
46from bzrlib.plugins.weave_fmt.branch import BzrBranchFormat458from breezy.plugins.weave_fmt.branch import BzrBranchFormat4
47from bzrlib.plugins.weave_fmt.bzrdir import (59from breezy.plugins.weave_fmt.bzrdir import (
48 BzrDirFormat4,60 BzrDirFormat4,
49 BzrDirFormat5,61 BzrDirFormat5,
50 BzrDirFormat6,62 BzrDirFormat6,
51 )63 )
52from bzrlib.plugins.weave_fmt.repository import (64from breezy.plugins.weave_fmt.repository import (
53 RepositoryFormat4,65 RepositoryFormat4,
54 RepositoryFormat5,66 RepositoryFormat5,
55 RepositoryFormat6,67 RepositoryFormat6,
56 RepositoryFormat7,68 RepositoryFormat7,
57 )69 )
58from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a70from breezy.revision import (
59from bzrlib.repofmt.knitpack_repo import (
60 RepositoryFormatKnitPack1,
61 RepositoryFormatKnitPack3,
62 RepositoryFormatKnitPack4,
63 RepositoryFormatKnitPack5,
64 )
65from bzrlib.revision import (
66 is_null,71 is_null,
67 NULL_REVISION,72 NULL_REVISION,
68 )73 )
69from bzrlib.repofmt.knitrepo import (
70 RepositoryFormatKnit1,
71 RepositoryFormatKnit3,
72 RepositoryFormatKnit4,
73 )
74from lazr.enum import (74from lazr.enum import (
75 DBEnumeratedType,75 DBEnumeratedType,
76 DBItem,76 DBItem,
@@ -305,7 +305,7 @@ def get_branch_formats(bzr_branch):
305305
306 :returns: tuple of (ControlFormat, BranchFormat, RepositoryFormat)306 :returns: tuple of (ControlFormat, BranchFormat, RepositoryFormat)
307 """307 """
308 control_string = bzr_branch.bzrdir._format.get_format_string()308 control_string = bzr_branch.controldir._format.get_format_string()
309 branch_string = bzr_branch._format.get_format_string()309 branch_string = bzr_branch._format.get_format_string()
310 repository_string = bzr_branch.repository._format.get_format_string()310 repository_string = bzr_branch.repository._format.get_format_string()
311 return (ControlFormat.get_enum(control_string),311 return (ControlFormat.get_enum(control_string),
diff --git a/lib/lp/code/configure.zcml b/lib/lp/code/configure.zcml
index 0ae4a3c..0a3537e 100644
--- a/lib/lp/code/configure.zcml
+++ b/lib/lp/code/configure.zcml
@@ -1191,19 +1191,19 @@
1191 />1191 />
1192 </class>1192 </class>
1193 <class1193 <class
1194 class="bzrlib.plugins.builder.recipe.BaseRecipeBranch">1194 class="breezy.plugins.builder.recipe.BaseRecipeBranch">
1195 <allow attributes="name url revspec revid child_branches deb_version __str__" />1195 <allow attributes="name url revspec revid child_branches deb_version __str__" />
1196 </class>1196 </class>
1197 <class1197 <class
1198 class="bzrlib.plugins.builder.recipe.RecipeBranch">1198 class="breezy.plugins.builder.recipe.RecipeBranch">
1199 <allow attributes="name url revspec revid child_branches __str__" />1199 <allow attributes="name url revspec revid child_branches __str__" />
1200 </class>1200 </class>
1201 <class1201 <class
1202 class="bzrlib.plugins.builder.recipe.MergeInstruction">1202 class="breezy.plugins.builder.recipe.MergeInstruction">
1203 <allow attributes="as_tuple recipe_branch nest_path" />1203 <allow attributes="as_tuple recipe_branch nest_path" />
1204 </class>1204 </class>
1205 <class1205 <class
1206 class="bzrlib.plugins.builder.recipe.NestInstruction">1206 class="breezy.plugins.builder.recipe.NestInstruction">
1207 <allow attributes="as_tuple recipe_branch nest_path" />1207 <allow attributes="as_tuple recipe_branch nest_path" />
1208 </class>1208 </class>
12091209
diff --git a/lib/lp/code/errors.py b/lib/lp/code/errors.py
index 22f6e16..c68da65 100644
--- a/lib/lp/code/errors.py
+++ b/lib/lp/code/errors.py
@@ -66,7 +66,7 @@ __all__ = [
6666
67import httplib67import httplib
6868
69from bzrlib.plugins.builder.recipe import RecipeParseError69from breezy.plugins.builder.recipe import RecipeParseError
70from lazr.restful.declarations import error_status70from lazr.restful.declarations import error_status
71import six71import six
7272
diff --git a/lib/lp/code/interfaces/branch.py b/lib/lp/code/interfaces/branch.py
index 2d20376..29d5fdf 100644
--- a/lib/lp/code/interfaces/branch.py
+++ b/lib/lp/code/interfaces/branch.py
@@ -512,7 +512,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
512512
513 They are ordered with the most recent revision first, and the list513 They are ordered with the most recent revision first, and the list
514 only contains those in the "leftmost tree", or in other words514 only contains those in the "leftmost tree", or in other words
515 the revisions that match the revision history from bzrlib for this515 the revisions that match the revision history from breezy for this
516 branch.516 branch.
517517
518 The revisions are listed as tuples of (`BranchRevision`, `Revision`).518 The revisions are listed as tuples of (`BranchRevision`, `Revision`).
@@ -719,7 +719,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
719 """Construct a URL for this branch in codebrowse.719 """Construct a URL for this branch in codebrowse.
720720
721 :param extras: Zero or more path segments that will be joined onto the721 :param extras: Zero or more path segments that will be joined onto the
722 end of the URL (with `bzrlib.urlutils.join`).722 end of the URL (with `breezy.urlutils.join`).
723 """723 """
724724
725 browse_source_url = Attribute(725 browse_source_url = Attribute(
@@ -993,7 +993,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
993 :return: tuple of three items.993 :return: tuple of three items.
994 1. Ancestry set of bzr revision-ids.994 1. Ancestry set of bzr revision-ids.
995 2. History list of bzr revision-ids. Similar to the result of995 2. History list of bzr revision-ids. Similar to the result of
996 bzrlib.Branch.revision_history().996 breezy.Branch.revision_history().
997 3. Dictionnary mapping bzr bzr revision-ids to the database ids of997 3. Dictionnary mapping bzr bzr revision-ids to the database ids of
998 the corresponding BranchRevision rows for this branch.998 the corresponding BranchRevision rows for this branch.
999 """999 """
@@ -1012,7 +1012,7 @@ class IBranchView(IHasOwner, IHasBranchTarget, IHasMergeProposals,
1012 You can only call this if a server returned by `get_ro_server` or1012 You can only call this if a server returned by `get_ro_server` or
1013 `get_rw_server` is running.1013 `get_rw_server` is running.
10141014
1015 :raise bzrlib.url_policy_open.BadUrl: If the branch is stacked1015 :raise breezy.url_policy_open.BadUrl: If the branch is stacked
1016 on or a reference to an unacceptable URL.1016 on or a reference to an unacceptable URL.
1017 """1017 """
10181018
diff --git a/lib/lp/code/interfaces/tests/test_branch.py b/lib/lp/code/interfaces/tests/test_branch.py
index af02ded..2eaab2f 100644
--- a/lib/lp/code/interfaces/tests/test_branch.py
+++ b/lib/lp/code/interfaces/tests/test_branch.py
@@ -5,9 +5,9 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib.branch import format_registry as branch_format_registry8from breezy.branch import format_registry as branch_format_registry
9from bzrlib.bzrdir import BzrProber9from breezy.bzr import BzrProber
10from bzrlib.repository import format_registry as repo_format_registry10from breezy.repository import format_registry as repo_format_registry
1111
12from lp.code.bzr import (12from lp.code.bzr import (
13 BranchFormat,13 BranchFormat,
@@ -27,21 +27,21 @@ class TestFormatSupport(TestCase):
27 """27 """
2828
29 def test_control_format_complement(self):29 def test_control_format_complement(self):
30 self.bzrlib_is_subset(BzrProber.formats.keys(), ControlFormat)30 self.breezy_is_subset(BzrProber.formats.keys(), ControlFormat)
3131
32 def test_branch_format_complement(self):32 def test_branch_format_complement(self):
33 self.bzrlib_is_subset(branch_format_registry.keys(), BranchFormat)33 self.breezy_is_subset(branch_format_registry.keys(), BranchFormat)
3434
35 def test_repository_format_complement(self):35 def test_repository_format_complement(self):
36 self.bzrlib_is_subset(repo_format_registry.keys(), RepositoryFormat)36 self.breezy_is_subset(repo_format_registry.keys(), RepositoryFormat)
3737
38 def bzrlib_is_subset(self, bzrlib_formats, launchpad_enum):38 def breezy_is_subset(self, breezy_formats, launchpad_enum):
39 """Ensure the bzr format marker list is a subset of launchpad."""39 """Ensure the Breezy format marker list is a subset of Launchpad."""
40 bzrlib_format_strings = set(bzrlib_formats)40 breezy_format_strings = set(breezy_formats)
41 launchpad_format_strings = set(format.title for format41 launchpad_format_strings = set(format.title for format
42 in launchpad_enum.items)42 in launchpad_enum.items)
43 self.assertEqual(43 self.assertEqual(
44 set(), bzrlib_format_strings.difference(launchpad_format_strings))44 set(), breezy_format_strings.difference(launchpad_format_strings))
4545
46 def test_repositoryDescriptions(self):46 def test_repositoryDescriptions(self):
47 self.checkDescriptions(RepositoryFormat)47 self.checkDescriptions(RepositoryFormat)
diff --git a/lib/lp/code/mail/codereviewcomment.py b/lib/lp/code/mail/codereviewcomment.py
index 62706be..760d923 100644
--- a/lib/lp/code/mail/codereviewcomment.py
+++ b/lib/lp/code/mail/codereviewcomment.py
@@ -10,7 +10,7 @@ __all__ = [
10 'CodeReviewCommentMailer',10 'CodeReviewCommentMailer',
11 ]11 ]
1212
13from bzrlib.patches import BinaryPatch13from breezy.patches import BinaryPatch
14from zope.component import getUtility14from zope.component import getUtility
15from zope.security.proxy import removeSecurityProxy15from zope.security.proxy import removeSecurityProxy
1616
@@ -174,9 +174,9 @@ def format_comment(comment):
174 """Returns a list of correctly formatted comment(s)."""174 """Returns a list of correctly formatted comment(s)."""
175 comment_lines = []175 comment_lines = []
176 if comment is not None:176 if comment is not None:
177 comment_lines.append('')177 comment_lines.append(b'')
178 comment_lines.extend(comment.splitlines())178 comment_lines.extend(comment.splitlines())
179 comment_lines.append('')179 comment_lines.append(b'')
180 return comment_lines180 return comment_lines
181181
182182
@@ -201,7 +201,7 @@ def build_inline_comments_section(comments, diff_text):
201201
202 if isinstance(patch, dict) and 'dirty_head' in patch:202 if isinstance(patch, dict) and 'dirty_head' in patch:
203 for line in patch['dirty_head']:203 for line in patch['dirty_head']:
204 dirty_head.append(u'> %s' % line.rstrip('\n'))204 dirty_head.append(b'> %s' % line.rstrip(b'\n'))
205 line_count += 1 # inc for dirty headers205 line_count += 1 # inc for dirty headers
206 comment = comments.get(str(line_count))206 comment = comments.get(str(line_count))
207 if comment:207 if comment:
@@ -213,7 +213,7 @@ def build_inline_comments_section(comments, diff_text):
213 if type(patch) is BinaryPatch:213 if type(patch) is BinaryPatch:
214 if dirty_comment:214 if dirty_comment:
215 result_lines.extend(dirty_head)215 result_lines.extend(dirty_head)
216 result_lines.append(u'> %s' % str(patch).rstrip('\n'))216 result_lines.append(b'> %s' % patch.as_bytes().rstrip(b'\n'))
217 line_count += 1217 line_count += 1
218 comment = comments.get(str(line_count))218 comment = comments.get(str(line_count))
219 if comment:219 if comment:
@@ -224,7 +224,7 @@ def build_inline_comments_section(comments, diff_text):
224 line_count += 1 # inc patch headers224 line_count += 1 # inc patch headers
225 comment = comments.get(str(line_count))225 comment = comments.get(str(line_count))
226226
227 patch_lines.append('> {0}'.format(ph))227 patch_lines.append(b'> %s' % ph)
228 if comment:228 if comment:
229 patch_lines.extend(format_comment(comment))229 patch_lines.extend(format_comment(comment))
230 patch_comment = True230 patch_comment = True
@@ -236,8 +236,7 @@ def build_inline_comments_section(comments, diff_text):
236236
237 # add context line (hunk header)237 # add context line (hunk header)
238 line_count += 1 # inc hunk context line238 line_count += 1 # inc hunk context line
239 hunk_lines.append(u'> %s' % hunk.get_header().rstrip('\n').decode(239 hunk_lines.append(b'> %s' % hunk.get_header().rstrip(b'\n'))
240 'utf-8', 'replace'))
241240
242 # comment for context line (hunk header)241 # comment for context line (hunk header)
243 comment = comments.get(str(line_count))242 comment = comments.get(str(line_count))
@@ -248,11 +247,9 @@ def build_inline_comments_section(comments, diff_text):
248 for hunk_line in hunk.lines:247 for hunk_line in hunk.lines:
249 # A single HunkLine can actually represent multiple248 # A single HunkLine can actually represent multiple
250 # lines in the "No newline at end of file" case.249 # lines in the "No newline at end of file" case.
251 hunk_line = str(hunk_line)250 for line in hunk_line.as_bytes().splitlines():
252 for line in hunk_line.splitlines():
253 line_count += 1 # inc hunk lines251 line_count += 1 # inc hunk lines
254 hunk_lines.append(u'> %s' % line.rstrip('\n').decode(252 hunk_lines.append(b'> %s' % line.rstrip(b'\n'))
255 'utf-8', 'replace'))
256 comment = comments.get(str(line_count))253 comment = comments.get(str(line_count))
257 if comment:254 if comment:
258 hunk_lines.extend(format_comment(comment))255 hunk_lines.extend(format_comment(comment))
@@ -270,5 +267,5 @@ def build_inline_comments_section(comments, diff_text):
270 elif dirty_comment:267 elif dirty_comment:
271 result_lines.extend(dirty_head)268 result_lines.extend(dirty_head)
272269
273 result_text = '\n'.join(result_lines)270 result_text = b'\n'.join(result_lines).decode('UTF-8', errors='replace')
274 return '\n\nDiff comments:\n\n%s\n\n' % result_text271 return '\n\nDiff comments:\n\n%s\n\n' % result_text
diff --git a/lib/lp/code/mail/patches.py b/lib/lp/code/mail/patches.py
index 5b5ccac..11e655d 100644
--- a/lib/lp/code/mail/patches.py
+++ b/lib/lp/code/mail/patches.py
@@ -1,4 +1,4 @@
1# This file was partially cloned from bzr-2.6.0-lp-3 (bzrlib.patches) and1# This file was partially cloned from breezy 3.0.0 (breezy.patches) and
2# customised for LP.2# customised for LP.
3#3#
4# Copyright (C) 2005-2010 Aaron Bentley, Canonical Ltd4# Copyright (C) 2005-2010 Aaron Bentley, Canonical Ltd
@@ -20,7 +20,7 @@
2020
21from __future__ import absolute_import21from __future__ import absolute_import
2222
23from bzrlib.patches import (23from breezy.patches import (
24 binary_files_re,24 binary_files_re,
25 hunk_from_header,25 hunk_from_header,
26 parse_patch,26 parse_patch,
@@ -50,10 +50,10 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
50 beginning = True50 beginning = True
51 in_git_patch = False51 in_git_patch = False
5252
53 dirty_headers = ('=== ', 'diff ', 'index ')53 dirty_headers = (b'=== ', b'diff ', b'index ')
54 for line in iter_lines:54 for line in iter_lines:
55 # preserve bzr modified/added headers and blank lines55 # preserve bzr modified/added headers and blank lines
56 if line.startswith(dirty_headers) or not line.strip('\n'):56 if line.startswith(dirty_headers) or not line.strip(b'\n'):
57 if len(saved_lines) > 0:57 if len(saved_lines) > 0:
58 if keep_dirty and len(dirty_head) > 0:58 if keep_dirty and len(dirty_head) > 0:
59 yield {'saved_lines': saved_lines,59 yield {'saved_lines': saved_lines,
@@ -63,7 +63,7 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
63 yield saved_lines63 yield saved_lines
64 in_git_patch = False64 in_git_patch = False
65 saved_lines = []65 saved_lines = []
66 if line.startswith('diff --git'):66 if line.startswith(b'diff --git'):
67 in_git_patch = True67 in_git_patch = True
68 dirty_head.append(line)68 dirty_head.append(line)
69 continue69 continue
@@ -73,14 +73,14 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
73 # in the patch before the next "diff" header line can do so.73 # in the patch before the next "diff" header line can do so.
74 dirty_head.append(line)74 dirty_head.append(line)
75 continue75 continue
76 if line.startswith('*** '):76 if line.startswith(b'*** '):
77 continue77 continue
78 if line.startswith('#'):78 if line.startswith(b'#'):
79 continue79 continue
80 elif orig_range > 0:80 elif orig_range > 0:
81 if line.startswith('-') or line.startswith(' '):81 if line.startswith(b'-') or line.startswith(b' '):
82 orig_range -= 182 orig_range -= 1
83 elif line.startswith('--- ') or regex.match(line):83 elif line.startswith(b'--- ') or regex.match(line):
84 if allow_dirty and beginning:84 if allow_dirty and beginning:
85 # Patches can have "junk" at the beginning85 # Patches can have "junk" at the beginning
86 # Stripping junk from the end of patches is handled when we86 # Stripping junk from the end of patches is handled when we
@@ -95,7 +95,7 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
95 yield saved_lines95 yield saved_lines
96 in_git_patch = False96 in_git_patch = False
97 saved_lines = []97 saved_lines = []
98 elif line.startswith('@@'):98 elif line.startswith(b'@@'):
99 hunk = hunk_from_header(line)99 hunk = hunk_from_header(line)
100 orig_range = hunk.orig_range100 orig_range = hunk.orig_range
101 saved_lines.append(line)101 saved_lines.append(line)
@@ -116,12 +116,11 @@ def parse_patches(iter_lines, allow_dirty=False, keep_dirty=False):
116 :kwarg keep_dirty: If True, returns a dict of patches with dirty headers.116 :kwarg keep_dirty: If True, returns a dict of patches with dirty headers.
117 Default False.117 Default False.
118 '''118 '''
119 patches = []
120 for patch_lines in iter_file_patch(iter_lines, allow_dirty, keep_dirty):119 for patch_lines in iter_file_patch(iter_lines, allow_dirty, keep_dirty):
121 if 'dirty_head' in patch_lines:120 if 'dirty_head' in patch_lines:
122 patches.append({'patch': parse_patch(121 yield {
123 patch_lines['saved_lines'], allow_dirty),122 'patch': parse_patch(patch_lines['saved_lines'], allow_dirty),
124 'dirty_head': patch_lines['dirty_head']})123 'dirty_head': patch_lines['dirty_head'],
124 }
125 else:125 else:
126 patches.append(parse_patch(patch_lines, allow_dirty))126 yield parse_patch(patch_lines, allow_dirty)
127 return patches
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index 691b0c9..c95247a 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -14,9 +14,9 @@ import json
14import operator14import operator
15import os.path15import os.path
1616
17from bzrlib import urlutils17from breezy import urlutils
18from bzrlib.revision import NULL_REVISION18from breezy.revision import NULL_REVISION
19from bzrlib.url_policy_open import open_only_scheme19from breezy.url_policy_open import open_only_scheme
20from lazr.lifecycle.event import ObjectCreatedEvent20from lazr.lifecycle.event import ObjectCreatedEvent
21import pytz21import pytz
22import six22import six
diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
index 38a961f..8cf99c9 100644
--- a/lib/lp/code/model/branchjob.py
+++ b/lib/lp/code/model/branchjob.py
@@ -19,20 +19,20 @@ import shutil
19from StringIO import StringIO19from StringIO import StringIO
20import tempfile20import tempfile
2121
22from bzrlib.branch import Branch as BzrBranch22from breezy.branch import Branch as BzrBranch
23from bzrlib.diff import show_diff_trees23from breezy.diff import show_diff_trees
24from bzrlib.errors import (24from breezy.errors import (
25 NoSuchFile,25 NoSuchFile,
26 NotBranchError,26 NotBranchError,
27 )27 )
28from bzrlib.log import (28from breezy.log import (
29 log_formatter,29 log_formatter,
30 show_log,30 show_log,
31 )31 )
32from bzrlib.revision import NULL_REVISION32from breezy.revision import NULL_REVISION
33from bzrlib.revisionspec import RevisionInfo33from breezy.revisionspec import RevisionInfo
34from bzrlib.transport import get_transport34from breezy.transport import get_transport
35from bzrlib.upgrade import upgrade35from breezy.upgrade import upgrade
36from lazr.delegates import delegate_to36from lazr.delegates import delegate_to
37from lazr.enum import (37from lazr.enum import (
38 DBEnumeratedType,38 DBEnumeratedType,
@@ -533,7 +533,7 @@ class RevisionsAddedJob(BranchJobDerived):
533 repository = self.bzr_branch.repository533 repository = self.bzr_branch.repository
534 added_revisions = repository.get_graph().find_unique_ancestors(534 added_revisions = repository.get_graph().find_unique_ancestors(
535 self.last_revision_id, [self.last_scanned_id])535 self.last_revision_id, [self.last_scanned_id])
536 # Avoid hitting the database since bzrlib makes it easy to check.536 # Avoid hitting the database since breezy makes it easy to check.
537 # There are possibly more efficient ways to get the mainline537 # There are possibly more efficient ways to get the mainline
538 # revisions, but this is simple and it works.538 # revisions, but this is simple and it works.
539 history = branch_revision_history(self.bzr_branch)539 history = branch_revision_history(self.bzr_branch)
@@ -625,7 +625,7 @@ class RevisionsAddedJob(BranchJobDerived):
625 """Determine which revisions were merged by this revision.625 """Determine which revisions were merged by this revision.
626626
627 :param revision_id: ID of the revision to examine.627 :param revision_id: ID of the revision to examine.
628 :param graph: a bzrlib.graph.Graph.628 :param graph: a breezy.graph.Graph.
629 :return: a set of revision IDs.629 :return: a set of revision IDs.
630 """630 """
631 parents = graph.get_parent_map([revision_id])[revision_id]631 parents = graph.get_parent_map([revision_id])[revision_id]
@@ -901,7 +901,7 @@ class RosettaUploadJob(BranchJobDerived):
901 continue901 continue
902 file_id, (from_path, to_path) = changed_file[:2]902 file_id, (from_path, to_path) = changed_file[:2]
903 changed_files.append((903 changed_files.append((
904 to_path, to_tree.get_file_text(file_id)))904 to_path, to_tree.get_file_text(to_path)))
905 finally:905 finally:
906 from_tree.unlock()906 from_tree.unlock()
907 finally:907 finally:
diff --git a/lib/lp/code/model/branchlookup.py b/lib/lp/code/model/branchlookup.py
index 18d8744..b0012e7 100644
--- a/lib/lp/code/model/branchlookup.py
+++ b/lib/lp/code/model/branchlookup.py
@@ -9,7 +9,7 @@ __metaclass__ = type
9__all__ = []9__all__ = []
1010
1111
12from bzrlib.urlutils import escape12from breezy.urlutils import escape
13from lazr.enum import DBItem13from lazr.enum import DBItem
14from lazr.uri import (14from lazr.uri import (
15 InvalidURIError,15 InvalidURIError,
diff --git a/lib/lp/code/model/diff.py b/lib/lp/code/model/diff.py
index ac8d525..500dd5c 100644
--- a/lib/lp/code/model/diff.py
+++ b/lib/lp/code/model/diff.py
@@ -16,14 +16,14 @@ from operator import attrgetter
16import sys16import sys
17from uuid import uuid117from uuid import uuid1
1818
19from bzrlib import trace19from breezy import trace
20from bzrlib.diff import show_diff_trees20from breezy.diff import show_diff_trees
21from bzrlib.merge import Merge3Merger21from breezy.merge import Merge3Merger
22from bzrlib.patches import (22from breezy.patches import (
23 parse_patches,23 parse_patches,
24 Patch,24 Patch,
25 )25 )
26from bzrlib.plugins.difftacular.generate_diff import diff_ignore_branches26from breezy.plugins.difftacular.generate_diff import diff_ignore_branches
27from lazr.delegates import delegate_to27from lazr.delegates import delegate_to
28import simplejson28import simplejson
29from sqlobject import (29from sqlobject import (
diff --git a/lib/lp/code/model/directbranchcommit.py b/lib/lp/code/model/directbranchcommit.py
index 4dd4d46..0b7a902 100644
--- a/lib/lp/code/model/directbranchcommit.py
+++ b/lib/lp/code/model/directbranchcommit.py
@@ -12,9 +12,9 @@ __all__ = [
1212
13import os.path13import os.path
1414
15from bzrlib.generate_ids import gen_file_id15from breezy.bzr.generate_ids import gen_file_id
16from bzrlib.revision import NULL_REVISION16from breezy.revision import NULL_REVISION
17from bzrlib.transform import (17from breezy.transform import (
18 ROOT_PARENT,18 ROOT_PARENT,
19 TransformPreview,19 TransformPreview,
20 )20 )
@@ -226,10 +226,11 @@ class DirectBranchCommit:
226 if rev_id == NULL_REVISION:226 if rev_id == NULL_REVISION:
227 if list(self.transform_preview.iter_changes()) == []:227 if list(self.transform_preview.iter_changes()) == []:
228 return228 return
229 self.transform_preview.fixup_new_roots()
229 committer_id = self.getBzrCommitterID()230 committer_id = self.getBzrCommitterID()
230 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is231 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
231 # required to generate the revision-id.232 # required to generate the revision-id.
232 with override_environ(BZR_EMAIL=committer_id):233 with override_environ(BRZ_EMAIL=committer_id):
233 new_rev_id = self.transform_preview.commit(234 new_rev_id = self.transform_preview.commit(
234 self.bzrbranch, commit_message, self.merge_parents,235 self.bzrbranch, commit_message, self.merge_parents,
235 committer=committer_id)236 committer=committer_id)
diff --git a/lib/lp/code/model/gitrepository.py b/lib/lp/code/model/gitrepository.py
index 93a2d16..14c09a4 100644
--- a/lib/lp/code/model/gitrepository.py
+++ b/lib/lp/code/model/gitrepository.py
@@ -27,7 +27,7 @@ from itertools import (
27from operator import attrgetter27from operator import attrgetter
28from urllib import quote_plus28from urllib import quote_plus
2929
30from bzrlib import urlutils30from breezy import urlutils
31from lazr.enum import DBItem31from lazr.enum import DBItem
32from lazr.lifecycle.event import ObjectModifiedEvent32from lazr.lifecycle.event import ObjectModifiedEvent
33from lazr.lifecycle.snapshot import Snapshot33from lazr.lifecycle.snapshot import Snapshot
diff --git a/lib/lp/code/model/revision.py b/lib/lp/code/model/revision.py
index 119ac41..4895ebb 100644
--- a/lib/lp/code/model/revision.py
+++ b/lib/lp/code/model/revision.py
@@ -16,7 +16,7 @@ from datetime import (
16 )16 )
17import email17import email
1818
19from bzrlib.revision import NULL_REVISION19from breezy.revision import NULL_REVISION
20import pytz20import pytz
21from sqlobject import (21from sqlobject import (
22 BoolCol,22 BoolCol,
@@ -322,7 +322,7 @@ class RevisionSet:
322 This works around a bug in Python that causes datetime.fromtimestamp322 This works around a bug in Python that causes datetime.fromtimestamp
323 to raise an exception if it is given a negative, fractional timestamp.323 to raise an exception if it is given a negative, fractional timestamp.
324324
325 :param timestamp: A timestamp from a bzrlib.revision.Revision325 :param timestamp: A timestamp from a breezy.revision.Revision
326 :type timestamp: float326 :type timestamp: float
327327
328 :return: A datetime corresponding to the given timestamp.328 :return: A datetime corresponding to the given timestamp.
diff --git a/lib/lp/code/model/sourcepackagerecipedata.py b/lib/lp/code/model/sourcepackagerecipedata.py
index a30b3c2..e0801bf 100644
--- a/lib/lp/code/model/sourcepackagerecipedata.py
+++ b/lib/lp/code/model/sourcepackagerecipedata.py
@@ -13,7 +13,7 @@ __all__ = ['SourcePackageRecipeData']
1313
14import re14import re
1515
16from bzrlib.plugins.builder.recipe import (16from breezy.plugins.builder.recipe import (
17 BaseRecipeBranch,17 BaseRecipeBranch,
18 MergeInstruction,18 MergeInstruction,
19 NestInstruction,19 NestInstruction,
diff --git a/lib/lp/code/model/tests/test_branch.py b/lib/lp/code/model/tests/test_branch.py
index ecad508..2bd0b62 100644
--- a/lib/lp/code/model/tests/test_branch.py
+++ b/lib/lp/code/model/tests/test_branch.py
@@ -13,10 +13,10 @@ from datetime import (
13 )13 )
14import json14import json
1515
16from bzrlib.branch import Branch16from breezy.branch import Branch
17from bzrlib.bzrdir import BzrDir17from breezy.bzr.bzrdir import BzrDir
18from bzrlib.revision import NULL_REVISION18from breezy.revision import NULL_REVISION
19from bzrlib.url_policy_open import BadUrl19from breezy.url_policy_open import BadUrl
20from pytz import UTC20from pytz import UTC
21from sqlobject import SQLObjectNotFound21from sqlobject import SQLObjectNotFound
22from storm.exceptions import LostObjectError22from storm.exceptions import LostObjectError
@@ -2257,7 +2257,7 @@ class TestRevisionHistory(TestCaseWithFactory):
2257 def test_tip_revision_when_no_revisions(self):2257 def test_tip_revision_when_no_revisions(self):
2258 # When a branch has no revisions but does have Bazaar data, its tip2258 # When a branch has no revisions but does have Bazaar data, its tip
2259 # revision is None and its last_scanned_id is2259 # revision is None and its last_scanned_id is
2260 # bzrlib.revision.NULL_REVISION.2260 # breezy.revision.NULL_REVISION.
2261 branch = self.factory.makeBranch()2261 branch = self.factory.makeBranch()
2262 branch.updateScannedDetails(None, 0)2262 branch.updateScannedDetails(None, 0)
2263 self.assertEqual(NULL_REVISION, branch.last_scanned_id)2263 self.assertEqual(NULL_REVISION, branch.last_scanned_id)
@@ -3276,7 +3276,7 @@ class TestGetBzrBranch(TestCaseWithFactory):
3276 db_branch, tree = self.create_branch_and_tree()3276 db_branch, tree = self.create_branch_and_tree()
3277 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is3277 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
3278 # required to generate the revision-id.3278 # required to generate the revision-id.
3279 with override_environ(BZR_EMAIL='me@example.com'):3279 with override_environ(BRZ_EMAIL='me@example.com'):
3280 revid = tree.commit('')3280 revid = tree.commit('')
3281 bzr_branch = db_branch.getBzrBranch()3281 bzr_branch = db_branch.getBzrBranch()
3282 self.assertEqual(revid, bzr_branch.last_revision())3282 self.assertEqual(revid, bzr_branch.last_revision())
diff --git a/lib/lp/code/model/tests/test_branchjob.py b/lib/lp/code/model/tests/test_branchjob.py
index 66badbf..0c4a893 100644
--- a/lib/lp/code/model/tests/test_branchjob.py
+++ b/lib/lp/code/model/tests/test_branchjob.py
@@ -11,11 +11,11 @@ import datetime
11import os11import os
12import shutil12import shutil
1313
14from bzrlib import errors as bzr_errors14from breezy import errors as bzr_errors
15from bzrlib.branch import Branch15from breezy.branch import Branch
16from bzrlib.bzrdir import BzrDir16from breezy.bzr.bzrdir import BzrDir
17from bzrlib.revision import NULL_REVISION17from breezy.revision import NULL_REVISION
18from bzrlib.transport import get_transport18from breezy.transport import get_transport
19from fixtures import MockPatch19from fixtures import MockPatch
20import pytz20import pytz
21from sqlobject import SQLObjectNotFound21from sqlobject import SQLObjectNotFound
@@ -149,7 +149,7 @@ class TestBranchScanJob(TestCaseWithFactory):
149 db_branch, bzr_tree = self.create_branch_and_tree()149 db_branch, bzr_tree = self.create_branch_and_tree()
150 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is150 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
151 # required to generate the revision-id.151 # required to generate the revision-id.
152 with override_environ(BZR_EMAIL='me@example.com'):152 with override_environ(BRZ_EMAIL='me@example.com'):
153 bzr_tree.commit('First commit', rev_id=b'rev1')153 bzr_tree.commit('First commit', rev_id=b'rev1')
154 bzr_tree.commit('Second commit', rev_id=b'rev2')154 bzr_tree.commit('Second commit', rev_id=b'rev2')
155 bzr_tree.commit('Third commit', rev_id=b'rev3')155 bzr_tree.commit('Third commit', rev_id=b'rev3')
@@ -177,7 +177,7 @@ class TestBranchScanJob(TestCaseWithFactory):
177 db_branch, bzr_tree = self.create_branch_and_tree()177 db_branch, bzr_tree = self.create_branch_and_tree()
178 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is178 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
179 # required to generate the revision-id.179 # required to generate the revision-id.
180 with override_environ(BZR_EMAIL='me@example.com'):180 with override_environ(BRZ_EMAIL='me@example.com'):
181 bzr_tree.commit('First commit', rev_id=b'rev1')181 bzr_tree.commit('First commit', rev_id=b'rev1')
182 LaunchpadZopelessLayer.commit()182 LaunchpadZopelessLayer.commit()
183183
@@ -198,7 +198,7 @@ class TestBranchScanJob(TestCaseWithFactory):
198 private_bug = self.factory.makeBug(198 private_bug = self.factory.makeBug(
199 target=product, information_type=InformationType.USERDATA)199 target=product, information_type=InformationType.USERDATA)
200 bug_line = b'https://launchpad.net/bugs/%s fixed' % private_bug.id200 bug_line = b'https://launchpad.net/bugs/%s fixed' % private_bug.id
201 with override_environ(BZR_EMAIL='me@example.com'):201 with override_environ(BRZ_EMAIL='me@example.com'):
202 bzr_tree.commit(202 bzr_tree.commit(
203 'First commit', rev_id=b'rev1', revprops={b'bugs': bug_line})203 'First commit', rev_id=b'rev1', revprops={b'bugs': bug_line})
204 job = BranchScanJob.create(db_branch)204 job = BranchScanJob.create(db_branch)
@@ -314,7 +314,7 @@ class TestBranchUpgradeJob(TestCaseWithFactory):
314 db_branch, tree = self.create_branch_and_tree()314 db_branch, tree = self.create_branch_and_tree()
315 branch2 = BzrDir.create_branch_convenience('.')315 branch2 = BzrDir.create_branch_convenience('.')
316 tree.branch.set_stacked_on_url(branch2.base)316 tree.branch.set_stacked_on_url(branch2.base)
317 branch2.bzrdir.destroy_branch()317 branch2.controldir.destroy_branch()
318 # Create BranchUpgradeJob manually, because we're trying to upgrade a318 # Create BranchUpgradeJob manually, because we're trying to upgrade a
319 # branch that doesn't need upgrading.319 # branch that doesn't need upgrading.
320 requester = self.factory.makePerson()320 requester = self.factory.makePerson()
@@ -463,7 +463,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
463 try:463 try:
464 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is464 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
465 # required to generate the revision-id.465 # required to generate the revision-id.
466 with override_environ(BZR_EMAIL='me@example.com'):466 with override_environ(BRZ_EMAIL='me@example.com'):
467 tree.commit('rev1', rev_id=b'rev1')467 tree.commit('rev1', rev_id=b'rev1')
468 tree.commit('rev2', rev_id=b'rev2')468 tree.commit('rev2', rev_id=b'rev2')
469 tree.commit('rev3', rev_id=b'rev3')469 tree.commit('rev3', rev_id=b'rev3')
@@ -492,7 +492,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
492 tree.add_parent_tree_id(b'rev3')492 tree.add_parent_tree_id(b'rev3')
493 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is493 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
494 # required to generate the revision-id.494 # required to generate the revision-id.
495 with override_environ(BZR_EMAIL='me@example.com'):495 with override_environ(BRZ_EMAIL='me@example.com'):
496 tree.commit('rev3a', rev_id=b'rev3a')496 tree.commit('rev3a', rev_id=b'rev3a')
497 self.updateDBRevisions(branch, tree.branch, [b'rev3', b'rev3a'])497 self.updateDBRevisions(branch, tree.branch, [b'rev3', b'rev3a'])
498 job = RevisionsAddedJob.create(branch, 'rev1', 'rev3', '')498 job = RevisionsAddedJob.create(branch, 'rev1', 'rev3', '')
@@ -533,7 +533,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
533 self.addCleanup(tree.unlock)533 self.addCleanup(tree.unlock)
534 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is534 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
535 # required to generate the revision-id.535 # required to generate the revision-id.
536 with override_environ(BZR_EMAIL='me@example.com'):536 with override_environ(BRZ_EMAIL='me@example.com'):
537 tree.commit(537 tree.commit(
538 'rev1', rev_id=b'rev1', timestamp=1000, timezone=0,538 'rev1', rev_id=b'rev1', timestamp=1000, timezone=0,
539 committer='J. Random Hacker <jrandom@example.org>')539 committer='J. Random Hacker <jrandom@example.org>')
@@ -552,14 +552,14 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
552 tree.branch.nick = 'nicholas'552 tree.branch.nick = 'nicholas'
553 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is553 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
554 # required to generate the revision-id.554 # required to generate the revision-id.
555 with override_environ(BZR_EMAIL='me@example.com'):555 with override_environ(BRZ_EMAIL='me@example.com'):
556 tree.commit('rev1')556 tree.commit('rev1')
557 tree2 = tree.bzrdir.sprout('tree2').open_workingtree()557 tree2 = tree.controldir.sprout('tree2').open_workingtree()
558 tree2.commit('rev2a', rev_id=b'rev2a-id', committer='foo@')558 tree2.commit('rev2a', rev_id=b'rev2a-id', committer='foo@')
559 tree2.commit('rev3', rev_id=b'rev3-id',559 tree2.commit('rev3', rev_id=b'rev3-id',
560 authors=['bar@', 'baz@blaine.com'])560 authors=['bar@', 'baz@blaine.com'])
561 tree.merge_from_branch(tree2.branch)561 tree.merge_from_branch(tree2.branch)
562 tree3 = tree.bzrdir.sprout('tree3').open_workingtree()562 tree3 = tree.controldir.sprout('tree3').open_workingtree()
563 tree3.commit('rev2b', rev_id=b'rev2b-id', committer='qux@')563 tree3.commit('rev2b', rev_id=b'rev2b-id', committer='qux@')
564 tree.merge_from_branch(tree3.branch, force=True)564 tree.merge_from_branch(tree3.branch, force=True)
565 if include_ghost:565 if include_ghost:
@@ -808,17 +808,17 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
808 self.useBzrBranches(direct_database=True)808 self.useBzrBranches(direct_database=True)
809 db_branch, tree = self.create_branch_and_tree()809 db_branch, tree = self.create_branch_and_tree()
810 first_revision = b'rev-1'810 first_revision = b'rev-1'
811 tree.bzrdir.root_transport.put_bytes('hello.txt', 'Hello World\n')811 tree.controldir.root_transport.put_bytes('hello.txt', b'Hello World\n')
812 tree.add('hello.txt')812 tree.add('hello.txt')
813 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is813 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
814 # required to generate the revision-id.814 # required to generate the revision-id.
815 with override_environ(BZR_EMAIL='me@example.com'):815 with override_environ(BRZ_EMAIL='me@example.com'):
816 tree.commit(816 tree.commit(
817 rev_id=first_revision, message="Log message",817 rev_id=first_revision, message="Log message",
818 committer="Joe Bloggs <joe@example.com>",818 committer="Joe Bloggs <joe@example.com>",
819 timestamp=1000000000.0, timezone=0)819 timestamp=1000000000.0, timezone=0)
820 tree.bzrdir.root_transport.put_bytes(820 tree.controldir.root_transport.put_bytes(
821 'hello.txt', 'Hello World\n\nFoo Bar\n')821 'hello.txt', b'Hello World\n\nFoo Bar\n')
822 second_revision = b'rev-2'822 second_revision = b'rev-2'
823 tree.commit(823 tree.commit(
824 rev_id=second_revision, message="Extended contents",824 rev_id=second_revision, message="Extended contents",
@@ -864,7 +864,7 @@ class TestRevisionsAddedJob(TestCaseWithFactory):
864 rev_id = b'rev-1'864 rev_id = b'rev-1'
865 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is865 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
866 # required to generate the revision-id.866 # required to generate the revision-id.
867 with override_environ(BZR_EMAIL='me@example.com'):867 with override_environ(BRZ_EMAIL='me@example.com'):
868 tree.commit(868 tree.commit(
869 rev_id=rev_id, message="Non ASCII: \xe9",869 rev_id=rev_id, message="Non ASCII: \xe9",
870 committer="Non ASCII: \xed", timestamp=1000000000.0,870 committer="Non ASCII: \xed", timestamp=1000000000.0,
@@ -971,8 +971,9 @@ class TestRosettaUploadJob(TestCaseWithFactory):
971 except IndexError:971 except IndexError:
972 file_content = self.factory.getUniqueString()972 file_content = self.factory.getUniqueString()
973 dname = os.path.dirname(file_name)973 dname = os.path.dirname(file_name)
974 self.tree.bzrdir.root_transport.clone(dname).create_prefix()974 self.tree.controldir.root_transport.clone(dname).create_prefix()
975 self.tree.bzrdir.root_transport.put_bytes(file_name, file_content)975 self.tree.controldir.root_transport.put_bytes(
976 file_name, file_content)
976 if len(files) > 0:977 if len(files) > 0:
977 self.tree.smart_add(978 self.tree.smart_add(
978 [self.tree.abspath(file_pair[0]) for file_pair in files])979 [self.tree.abspath(file_pair[0]) for file_pair in files])
@@ -980,7 +981,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
980 commit_message = self.factory.getUniqueString('commit')981 commit_message = self.factory.getUniqueString('commit')
981 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is982 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
982 # required to generate the revision-id.983 # required to generate the revision-id.
983 with override_environ(BZR_EMAIL='me@example.com'):984 with override_environ(BRZ_EMAIL='me@example.com'):
984 revision_id = self.tree.commit(commit_message)985 revision_id = self.tree.commit(commit_message)
985 self.branch.last_scanned_id = revision_id986 self.branch.last_scanned_id = revision_id
986 self.branch.last_mirrored_id = revision_id987 self.branch.last_mirrored_id = revision_id
@@ -1076,7 +1077,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1076 # An empty POT cannot be uploaded, if if the product series is1077 # An empty POT cannot be uploaded, if if the product series is
1077 # configured for template import.1078 # configured for template import.
1078 entries = self._runJobWithFile(1079 entries = self._runJobWithFile(
1079 TranslationsBranchImportMode.IMPORT_TEMPLATES, 'empty.pot', '')1080 TranslationsBranchImportMode.IMPORT_TEMPLATES, 'empty.pot', b'')
1080 self.assertEqual(entries, [])1081 self.assertEqual(entries, [])
10811082
1082 def test_upload_hidden_pot(self):1083 def test_upload_hidden_pot(self):
@@ -1103,7 +1104,7 @@ class TestRosettaUploadJob(TestCaseWithFactory):
1103 def test_upload_pot_content(self):1104 def test_upload_pot_content(self):
1104 # The content of the uploaded file is stored in the librarian.1105 # The content of the uploaded file is stored in the librarian.
1105 # The uploader of a POT is the series owner.1106 # The uploader of a POT is the series owner.
1106 POT_CONTENT = "pot content\n"1107 POT_CONTENT = b"pot content\n"
1107 self._runJobWithFile(1108 self._runJobWithFile(
1108 TranslationsBranchImportMode.IMPORT_TEMPLATES,1109 TranslationsBranchImportMode.IMPORT_TEMPLATES,
1109 'foo.pot', POT_CONTENT)1110 'foo.pot', POT_CONTENT)
diff --git a/lib/lp/code/model/tests/test_branchmergeproposaljobs.py b/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
index 8f1fcca..9836caf 100644
--- a/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
+++ b/lib/lp/code/model/tests/test_branchmergeproposaljobs.py
@@ -190,7 +190,7 @@ class TestMergeProposalNeedsReviewEmailJobBzr(
190 target_branch, tree = self.create_branch_and_tree()190 target_branch, tree = self.create_branch_and_tree()
191 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is191 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
192 # required to generate the revision-id.192 # required to generate the revision-id.
193 with override_environ(BZR_EMAIL='me@example.com'):193 with override_environ(BRZ_EMAIL='me@example.com'):
194 tree.commit('test')194 tree.commit('test')
195 source_branch = self.factory.makeProductBranch(195 source_branch = self.factory.makeProductBranch(
196 product=target_branch.product)196 product=target_branch.product)
@@ -212,7 +212,7 @@ class TestMergeProposalNeedsReviewEmailJobBzr(
212 tree = self.create_branch_and_tree(db_branch=bmp.target_branch)[1]212 tree = self.create_branch_and_tree(db_branch=bmp.target_branch)[1]
213 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is213 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
214 # required to generate the revision-id.214 # required to generate the revision-id.
215 with override_environ(BZR_EMAIL='me@example.com'):215 with override_environ(BRZ_EMAIL='me@example.com'):
216 tree.commit('Initial commit')216 tree.commit('Initial commit')
217 self.createBzrBranch(bmp.source_branch, tree.branch)217 self.createBzrBranch(bmp.source_branch, tree.branch)
218 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)218 self.factory.makeRevisionsForBranch(bmp.source_branch, count=1)
diff --git a/lib/lp/code/model/tests/test_diff.py b/lib/lp/code/model/tests/test_diff.py
index f082a8e..f4ec2ce 100644
--- a/lib/lp/code/model/tests/test_diff.py
+++ b/lib/lp/code/model/tests/test_diff.py
@@ -12,8 +12,8 @@ from difflib import unified_diff
12import logging12import logging
13from textwrap import dedent13from textwrap import dedent
1414
15from bzrlib import trace15from breezy import trace
16from bzrlib.patches import (16from breezy.patches import (
17 InsertLine,17 InsertLine,
18 parse_patches,18 parse_patches,
19 RemoveLine,19 RemoveLine,
@@ -565,7 +565,7 @@ class TestPreviewDiff(DiffTestCase):
565 reload(trace)565 reload(trace)
566 bmp, source_rev_id, target_rev_id = self.createExampleBzrMerge()566 bmp, source_rev_id, target_rev_id = self.createExampleBzrMerge()
567 handler = RecordLister()567 handler = RecordLister()
568 logger = logging.getLogger('bzr')568 logger = logging.getLogger('brz')
569 logger.addHandler(handler)569 logger.addHandler(handler)
570 try:570 try:
571 PreviewDiff.fromBranchMergeProposal(bmp)571 PreviewDiff.fromBranchMergeProposal(bmp)
diff --git a/lib/lp/code/model/tests/test_gitref.py b/lib/lp/code/model/tests/test_gitref.py
index 2152b03..9b546fe 100644
--- a/lib/lp/code/model/tests/test_gitref.py
+++ b/lib/lp/code/model/tests/test_gitref.py
@@ -14,7 +14,7 @@ from datetime import (
14import hashlib14import hashlib
15import json15import json
1616
17from bzrlib import urlutils17from breezy import urlutils
18import pytz18import pytz
19import responses19import responses
20from storm.store import Store20from storm.store import Store
diff --git a/lib/lp/code/model/tests/test_gitrepository.py b/lib/lp/code/model/tests/test_gitrepository.py
index f1a80ed..e7615f3 100644
--- a/lib/lp/code/model/tests/test_gitrepository.py
+++ b/lib/lp/code/model/tests/test_gitrepository.py
@@ -20,7 +20,7 @@ from functools import partial
20import hashlib20import hashlib
21import json21import json
2222
23from bzrlib import urlutils23from breezy import urlutils
24from fixtures import MockPatch24from fixtures import MockPatch
25from lazr.lifecycle.event import ObjectModifiedEvent25from lazr.lifecycle.event import ObjectModifiedEvent
26from pymacaroons import Macaroon26from pymacaroons import Macaroon
diff --git a/lib/lp/code/model/tests/test_sourcepackagerecipe.py b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
index aa950f2..fd47336 100644
--- a/lib/lp/code/model/tests/test_sourcepackagerecipe.py
+++ b/lib/lp/code/model/tests/test_sourcepackagerecipe.py
@@ -13,7 +13,7 @@ from datetime import (
13 )13 )
14import textwrap14import textwrap
1515
16from bzrlib.plugins.builder.recipe import ForbiddenInstructionError16from breezy.plugins.builder.recipe import ForbiddenInstructionError
17from pytz import UTC17from pytz import UTC
18from storm.locals import Store18from storm.locals import Store
19from testtools.matchers import Equals19from testtools.matchers import Equals
diff --git a/lib/lp/code/scripts/tests/test_scan_branches.py b/lib/lp/code/scripts/tests/test_scan_branches.py
index ddaeea8..4f5783f 100644
--- a/lib/lp/code/scripts/tests/test_scan_branches.py
+++ b/lib/lp/code/scripts/tests/test_scan_branches.py
@@ -39,7 +39,7 @@ class TestScanBranches(TestCaseWithFactory):
39 target, target_tree = self.create_branch_and_tree(db_branch=db_branch)39 target, target_tree = self.create_branch_and_tree(db_branch=db_branch)
40 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is40 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
41 # required to generate the revision-id.41 # required to generate the revision-id.
42 with override_environ(BZR_EMAIL='me@example.com'):42 with override_environ(BRZ_EMAIL='me@example.com'):
43 target_tree.commit('First commit', rev_id='rev1')43 target_tree.commit('First commit', rev_id='rev1')
44 target_tree.commit('Second commit', rev_id='rev2')44 target_tree.commit('Second commit', rev_id='rev2')
45 target_tree.commit('Third commit', rev_id='rev3')45 target_tree.commit('Third commit', rev_id='rev3')
diff --git a/lib/lp/code/scripts/tests/test_sendbranchmail.py b/lib/lp/code/scripts/tests/test_sendbranchmail.py
index bee4c9f..e7e983d 100644
--- a/lib/lp/code/scripts/tests/test_sendbranchmail.py
+++ b/lib/lp/code/scripts/tests/test_sendbranchmail.py
@@ -32,12 +32,12 @@ class TestSendbranchmail(TestCaseWithFactory):
32 BranchSubscriptionDiffSize.WHOLEDIFF,32 BranchSubscriptionDiffSize.WHOLEDIFF,
33 CodeReviewNotificationLevel.FULL,33 CodeReviewNotificationLevel.FULL,
34 branch.registrant)34 branch.registrant)
35 transport = tree.bzrdir.root_transport35 transport = tree.controldir.root_transport
36 transport.put_bytes('foo', 'bar')36 transport.put_bytes('foo', b'bar')
37 tree.add('foo')37 tree.add('foo')
38 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is38 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
39 # required to generate the revision-id.39 # required to generate the revision-id.
40 with override_environ(BZR_EMAIL='me@example.com'):40 with override_environ(BRZ_EMAIL='me@example.com'):
41 tree.commit('Added foo.', rev_id='rev1')41 tree.commit('Added foo.', rev_id='rev1')
42 return branch, tree42 return branch, tree
4343
@@ -65,10 +65,10 @@ class TestSendbranchmail(TestCaseWithFactory):
65 """RevisionsAddedJobs are run by sendbranchmail."""65 """RevisionsAddedJobs are run by sendbranchmail."""
66 self.useBzrBranches()66 self.useBzrBranches()
67 branch, tree = self.createBranch()67 branch, tree = self.createBranch()
68 tree.bzrdir.root_transport.put_bytes('foo', 'baz')68 tree.controldir.root_transport.put_bytes('foo', b'baz')
69 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is69 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
70 # required to generate the revision-id.70 # required to generate the revision-id.
71 with override_environ(BZR_EMAIL='me@example.com'):71 with override_environ(BRZ_EMAIL='me@example.com'):
72 tree.commit('Added foo.', rev_id='rev2')72 tree.commit('Added foo.', rev_id='rev2')
73 job = RevisionsAddedJob.create(73 job = RevisionsAddedJob.create(
74 branch, 'rev1', 'rev2', 'from@example.org')74 branch, 'rev1', 'rev2', 'from@example.org')
diff --git a/lib/lp/code/scripts/tests/test_upgrade_branches.py b/lib/lp/code/scripts/tests/test_upgrade_branches.py
index a349d90..b95dc8b 100644
--- a/lib/lp/code/scripts/tests/test_upgrade_branches.py
+++ b/lib/lp/code/scripts/tests/test_upgrade_branches.py
@@ -4,7 +4,7 @@
4"""Test the upgrade_branches script."""4"""Test the upgrade_branches script."""
55
66
7from bzrlib.branch import Branch as BzrBranch7from breezy.branch import Branch as BzrBranch
8import transaction8import transaction
99
10from lp.code.model.branch import (10from lp.code.model.branch import (
diff --git a/lib/lp/code/stories/branches/xx-bazaar-home.txt b/lib/lp/code/stories/branches/xx-bazaar-home.txt
index ec8c20e..5b90cca 100644
--- a/lib/lp/code/stories/branches/xx-bazaar-home.txt
+++ b/lib/lp/code/stories/branches/xx-bazaar-home.txt
@@ -1,15 +1,15 @@
1The Launchpad Code front page1The Launchpad Code front page
2=============================2=============================
33
4First we manually set the Bazaar version, so that this document will not need4First we manually set the Breezy version, so that this document will not need
5updating when Launchpad upgrades Bazaar.5updating when Launchpad upgrades Breezy.
66
7 >>> import bzrlib7 >>> import breezy
8 >>> bzrlib_version = bzrlib.__version__8 >>> breezy_version = breezy.__version__
9 >>> bzrlib.__version__ = '0.92.0'9 >>> breezy.__version__ = '3.0.0'
1010
1111
12Check that the Bazaar home page works.12Check that the Code home page works.
1313
14 >>> browser.open('http://code.launchpad.test/')14 >>> browser.open('http://code.launchpad.test/')
15 >>> footer = find_tag_by_id(browser.contents, 'application-footer')15 >>> footer = find_tag_by_id(browser.contents, 'application-footer')
@@ -18,12 +18,12 @@ Check that the Bazaar home page works.
18 30 branches registered in18 30 branches registered in
19 6 projects19 6 projects
20 1 imported branches20 1 imported branches
21 Launchpad uses Bazaar 0.92.0.21 Launchpad uses Breezy 3.0.0.
2222
2323
24Restore the original Bazaar version:24Restore the original Breezy version:
2525
26 >>> bzrlib.__version__ = bzrlib_version26 >>> breezy.__version__ = breezy_version
2727
2828
29The main code home page now has a subset of the project tag cloud,29The main code home page now has a subset of the project tag cloud,
diff --git a/lib/lp/code/stories/webservice/xx-branch.txt b/lib/lp/code/stories/webservice/xx-branch.txt
index f198608..18c3ea0 100644
--- a/lib/lp/code/stories/webservice/xx-branch.txt
+++ b/lib/lp/code/stories/webservice/xx-branch.txt
@@ -3,7 +3,7 @@ Introduction
33
4Launchpad provides two ways to programmatically interact with your4Launchpad provides two ways to programmatically interact with your
5branches. You can either interact with the branches themselves using5branches. You can either interact with the branches themselves using
6`bzrlib`, or you can use Launchpad's webservice APIs to explore6`breezy`, or you can use Launchpad's webservice APIs to explore
7information about the branches and how they relate to the rest of7information about the branches and how they relate to the rest of
8the things on Launchpad.8the things on Launchpad.
99
diff --git a/lib/lp/code/templates/bazaar-index.pt b/lib/lp/code/templates/bazaar-index.pt
index cdd9bcd..b3ae707 100644
--- a/lib/lp/code/templates/bazaar-index.pt
+++ b/lib/lp/code/templates/bazaar-index.pt
@@ -128,8 +128,8 @@
128 </a>128 </a>
129 </div>129 </div>
130 <div>130 <div>
131 Launchpad uses <a href="http://bazaar.canonical.com/">Bazaar</a>131 Launchpad uses <a href="https://www.breezy-vcs.org/">Breezy</a>
132 <tal:version tal:content="view/bzr_version">2.0</tal:version>.132 <tal:version tal:content="view/brz_version">3.0.0</tal:version>.
133 </div>133 </div>
134 </div>134 </div>
135135
diff --git a/lib/lp/code/tests/helpers.py b/lib/lp/code/tests/helpers.py
index 1b9f7d7..2955528 100644
--- a/lib/lp/code/tests/helpers.py
+++ b/lib/lp/code/tests/helpers.py
@@ -26,7 +26,7 @@ from datetime import timedelta
26from difflib import unified_diff26from difflib import unified_diff
27from itertools import count27from itertools import count
2828
29from bzrlib.plugins.builder.recipe import RecipeParser29from breezy.plugins.builder.recipe import RecipeParser
30import fixtures30import fixtures
31import transaction31import transaction
32from zope.component import getUtility32from zope.component import getUtility
diff --git a/lib/lp/code/tests/test_bzr.py b/lib/lp/code/tests/test_bzr.py
index 37afc6c..6a62463 100644
--- a/lib/lp/code/tests/test_bzr.py
+++ b/lib/lp/code/tests/test_bzr.py
@@ -7,12 +7,13 @@ from __future__ import absolute_import, print_function, unicode_literals
77
8__metaclass__ = type8__metaclass__ = type
99
10from bzrlib.errors import NoSuchRevision10from breezy.errors import NoSuchRevision
11from bzrlib.revision import NULL_REVISION11from breezy.revision import NULL_REVISION
12from bzrlib.tests import (12from breezy.tests import (
13 TestCaseInTempDir,13 TestCaseInTempDir,
14 TestCaseWithTransport,14 TestCaseWithTransport,
15 )15 )
16import six
1617
17from lp.code.bzr import (18from lp.code.bzr import (
18 branch_revision_history,19 branch_revision_history,
@@ -49,7 +50,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
4950
50 def test_get_branch_format_2a(self):51 def test_get_branch_format_2a(self):
51 # Test the 2a branch format.52 # Test the 2a branch format.
52 branch = self.make_branch('test', '2a')53 branch = self.make_branch('test', six.ensure_str('2a'))
53 formats = get_branch_formats(branch)54 formats = get_branch_formats(branch)
54 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])55 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
55 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])56 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])
@@ -57,7 +58,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
5758
58 def test_get_branch_format_1_9(self):59 def test_get_branch_format_1_9(self):
59 # Test the 1.9 branch format.60 # Test the 1.9 branch format.
60 branch = self.make_branch('test', '1.9')61 branch = self.make_branch('test', six.ensure_str('1.9'))
61 formats = get_branch_formats(branch)62 formats = get_branch_formats(branch)
62 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])63 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
63 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])64 self.assertEqual(BranchFormat.BZR_BRANCH_7, formats[1])
@@ -65,7 +66,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
6566
66 def test_get_branch_format_packs(self):67 def test_get_branch_format_packs(self):
67 # Test the packs branch format.68 # Test the packs branch format.
68 branch = self.make_branch('test', 'pack-0.92')69 branch = self.make_branch('test', six.ensure_str('pack-0.92'))
69 formats = get_branch_formats(branch)70 formats = get_branch_formats(branch)
70 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])71 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
71 self.assertEqual(BranchFormat.BZR_BRANCH_6, formats[1])72 self.assertEqual(BranchFormat.BZR_BRANCH_6, formats[1])
@@ -73,7 +74,7 @@ class TestGetBranchFormats(TestCaseInTempDir):
7374
74 def test_get_branch_format_knits(self):75 def test_get_branch_format_knits(self):
75 # Test the knits branch format.76 # Test the knits branch format.
76 branch = self.make_branch('test', 'knit')77 branch = self.make_branch('test', six.ensure_str('knit'))
77 formats = get_branch_formats(branch)78 formats = get_branch_formats(branch)
78 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])79 self.assertEqual(ControlFormat.BZR_METADIR_1, formats[0])
79 self.assertEqual(BranchFormat.BZR_BRANCH_5, formats[1])80 self.assertEqual(BranchFormat.BZR_BRANCH_5, formats[1])
@@ -89,7 +90,7 @@ class TestBranchRevisionHistory(TestCaseWithTransport):
8990
90 def test_some_commits(self):91 def test_some_commits(self):
91 branch = self.make_branch('test')92 branch = self.make_branch('test')
92 tree = branch.bzrdir.create_workingtree()93 tree = branch.controldir.create_workingtree()
93 tree.commit('acommit', rev_id=b'A')94 tree.commit('acommit', rev_id=b'A')
94 tree.commit('bcommit', rev_id=b'B')95 tree.commit('bcommit', rev_id=b'B')
95 tree.commit('ccommit', rev_id=b'C')96 tree.commit('ccommit', rev_id=b'C')
@@ -109,7 +110,7 @@ class TestGetAncestry(TestCaseWithTransport):
109 def test_some(self):110 def test_some(self):
110 # Verify ancestors are included.111 # Verify ancestors are included.
111 branch = self.make_branch('test')112 branch = self.make_branch('test')
112 tree = branch.bzrdir.create_workingtree()113 tree = branch.controldir.create_workingtree()
113 tree.commit('msg a', rev_id=b'A')114 tree.commit('msg a', rev_id=b'A')
114 tree.commit('msg b', rev_id=b'B')115 tree.commit('msg b', rev_id=b'B')
115 tree.commit('msg c', rev_id=b'C')116 tree.commit('msg c', rev_id=b'C')
@@ -123,7 +124,7 @@ class TestGetAncestry(TestCaseWithTransport):
123 def test_children(self):124 def test_children(self):
124 # Verify non-mainline children are included.125 # Verify non-mainline children are included.
125 branch = self.make_branch('test')126 branch = self.make_branch('test')
126 tree = branch.bzrdir.create_workingtree()127 tree = branch.controldir.create_workingtree()
127 tree.commit('msg a', rev_id=b'A')128 tree.commit('msg a', rev_id=b'A')
128 branch.generate_revision_history(NULL_REVISION)129 branch.generate_revision_history(NULL_REVISION)
129 tree.set_parent_ids([])130 tree.set_parent_ids([])
diff --git a/lib/lp/code/xmlrpc/branch.py b/lib/lp/code/xmlrpc/branch.py
index ed0ce23..bd45c11 100644
--- a/lib/lp/code/xmlrpc/branch.py
+++ b/lib/lp/code/xmlrpc/branch.py
@@ -12,7 +12,7 @@ __all__ = [
1212
13from xmlrpclib import Fault13from xmlrpclib import Fault
1414
15from bzrlib import urlutils15from breezy import urlutils
16from zope.component import getUtility16from zope.component import getUtility
17from zope.interface import (17from zope.interface import (
18 implementer,18 implementer,
diff --git a/lib/lp/code/xmlrpc/codehosting.py b/lib/lp/code/xmlrpc/codehosting.py
index 107b1e6..3c09e78 100644
--- a/lib/lp/code/xmlrpc/codehosting.py
+++ b/lib/lp/code/xmlrpc/codehosting.py
@@ -13,7 +13,7 @@ __all__ = [
1313
14import datetime14import datetime
1515
16from bzrlib.urlutils import (16from breezy.urlutils import (
17 escape,17 escape,
18 unescape,18 unescape,
19 )19 )
diff --git a/lib/lp/code/xmlrpc/tests/test_branch.py b/lib/lp/code/xmlrpc/tests/test_branch.py
index 5b75b28..d035177 100644
--- a/lib/lp/code/xmlrpc/tests/test_branch.py
+++ b/lib/lp/code/xmlrpc/tests/test_branch.py
@@ -8,7 +8,7 @@ __metaclass__ = type
8import os8import os
9import xmlrpclib9import xmlrpclib
1010
11from bzrlib import urlutils11from breezy import urlutils
12from lazr.uri import URI12from lazr.uri import URI
13from zope.security.proxy import removeSecurityProxy13from zope.security.proxy import removeSecurityProxy
1414
diff --git a/lib/lp/code/xmlrpc/tests/test_codehosting.py b/lib/lp/code/xmlrpc/tests/test_codehosting.py
index 2491adc..c5ec059 100644
--- a/lib/lp/code/xmlrpc/tests/test_codehosting.py
+++ b/lib/lp/code/xmlrpc/tests/test_codehosting.py
@@ -8,8 +8,8 @@ __metaclass__ = type
8import datetime8import datetime
9import os9import os
1010
11from bzrlib import bzrdir11from breezy import controldir
12from bzrlib.urlutils import escape12from breezy.urlutils import escape
13import pytz13import pytz
14from testscenarios import (14from testscenarios import (
15 load_tests_apply_scenarios,15 load_tests_apply_scenarios,
@@ -659,7 +659,7 @@ class CodehostingTest(WithScenarios, TestCaseWithFactory):
659 branch, 'next_mirror_time', UTC_NOW)659 branch, 'next_mirror_time', UTC_NOW)
660660
661 def getFormatStringsForFormatName(self, format_name):661 def getFormatStringsForFormatName(self, format_name):
662 default_format = bzrdir.format_registry.get(format_name)()662 default_format = controldir.format_registry.get(format_name)()
663 control_string = default_format.get_format_string()663 control_string = default_format.get_format_string()
664 branch_string = default_format.get_branch_format().get_format_string()664 branch_string = default_format.get_branch_format().get_format_string()
665 repository_string = \665 repository_string = \
diff --git a/lib/lp/codehosting/__init__.py b/lib/lp/codehosting/__init__.py
index 261a3aa..bd097f9 100644
--- a/lib/lp/codehosting/__init__.py
+++ b/lib/lp/codehosting/__init__.py
@@ -9,16 +9,21 @@ all plugins in the bzrplugins/ directory underneath the rocketfuel checkout.
99
10__metaclass__ = type10__metaclass__ = type
11__all__ = [11__all__ = [
12 'get_bzr_path',12 'get_brz_path',
13 'get_BZR_PLUGIN_PATH_for_subprocess',13 'get_BZR_PLUGIN_PATH_for_subprocess',
14 ]14 ]
1515
1616
17import os17import os
1818
19import bzrlib19import breezy
20from bzrlib.branch import Branch20from breezy import ui as brz_ui
21from bzrlib.plugin import load_plugins21from breezy.branch import Branch
22from breezy.library_state import BzrLibraryState as BrzLibraryState
23from breezy.plugin import load_plugins as brz_load_plugins
24# This import is needed so that brz's logger gets registered.
25import breezy.trace
26from bzrlib.plugin import load_plugins as bzr_load_plugins
22# This import is needed so that bzr's logger gets registered.27# This import is needed so that bzr's logger gets registered.
23import bzrlib.trace28import bzrlib.trace
24from zope.security import checker29from zope.security import checker
@@ -26,9 +31,9 @@ from zope.security import checker
26from lp.services.config import config31from lp.services.config import config
2732
2833
29def get_bzr_path():34def get_brz_path():
30 """Find the path to the copy of Bazaar for this rocketfuel instance"""35 """Find the path to the copy of Breezy for this rocketfuel instance"""
31 return os.path.join(config.root, 'bin', 'bzr')36 return os.path.join(config.root, 'bin', 'brz')
3237
3338
34def _get_bzr_plugins_path():39def _get_bzr_plugins_path():
@@ -48,23 +53,50 @@ def get_BZR_PLUGIN_PATH_for_subprocess():
48 return ":".join((_get_bzr_plugins_path(), "-site"))53 return ":".join((_get_bzr_plugins_path(), "-site"))
4954
5055
51os.environ['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()56def _get_brz_plugins_path():
57 """Find the path to the Breezy plugins for this rocketfuel instance."""
58 return os.path.join(config.root, 'brzplugins')
5259
53# We want to have full access to Launchpad's Bazaar plugins throughout the
54# codehosting package.
55load_plugins([_get_bzr_plugins_path()])
5660
61def get_BRZ_PLUGIN_PATH_for_subprocess():
62 """Calculate the appropriate value for the BRZ_PLUGIN_PATH environment.
63
64 The '-site' token tells breezy not to include the 'site specific plugins
65 directory' (which is usually something like
66 /usr/lib/pythonX.Y/dist-packages/breezy/plugins/) in the plugin search
67 path, which would be inappropriate for Launchpad, which may have an
68 incompatible version of breezy in its virtualenv.
69 """
70 return ":".join((_get_brz_plugins_path(), "-site"))
5771
58def load_bundled_plugin(plugin_name):
59 """Load a plugin bundled with Bazaar."""
60 from bzrlib.plugin import get_core_plugin_path
61 from bzrlib import plugins
62 if get_core_plugin_path() not in plugins.__path__:
63 plugins.__path__.append(get_core_plugin_path())
64 __import__("bzrlib.plugins.%s" % plugin_name)
6572
73# We must explicitly initialize Breezy, as otherwise it will initialize
74# itself with a terminal-oriented UI.
75if breezy._global_state is None:
76 brz_state = BrzLibraryState(
77 ui=brz_ui.SilentUIFactory(), trace=breezy.trace.Config())
78 brz_state._start()
6679
67load_bundled_plugin("weave_fmt")80
81# XXX cjwatson 2019-06-13: Remove BZR_PLUGIN_PATH and supporting code once
82# all of Launchpad has been ported to Breezy.
83os.environ['BZR_PLUGIN_PATH'] = get_BZR_PLUGIN_PATH_for_subprocess()
84os.environ['BRZ_PLUGIN_PATH'] = get_BRZ_PLUGIN_PATH_for_subprocess()
85
86# Disable some Breezy plugins that are likely to cause trouble if used on
87# the server. (Unfortunately there doesn't seem to be a good way to load
88# only explicitly-specified plugins at the moment.)
89os.environ['BRZ_DISABLE_PLUGINS'] = ':'.join([
90 'cvs',
91 'darcs',
92 'email',
93 'mtn',
94 ])
95
96# We want to have full access to Launchpad's Bazaar plugins throughout the
97# codehosting package.
98bzr_load_plugins([_get_bzr_plugins_path()])
99brz_load_plugins()
68100
69101
70def dont_wrap_class_and_subclasses(cls):102def dont_wrap_class_and_subclasses(cls):
@@ -75,6 +107,6 @@ def dont_wrap_class_and_subclasses(cls):
75107
76# Don't wrap Branch or its subclasses in Zope security proxies. Make sure108# Don't wrap Branch or its subclasses in Zope security proxies. Make sure
77# the various LoomBranch classes are present first.109# the various LoomBranch classes are present first.
78import bzrlib.plugins.loom.branch110import breezy.plugins.loom.branch
79bzrlib.plugins.loom.branch111breezy.plugins.loom.branch
80dont_wrap_class_and_subclasses(Branch)112dont_wrap_class_and_subclasses(Branch)
diff --git a/lib/lp/codehosting/bzrutils.py b/lib/lp/codehosting/bzrutils.py
index 52dcd7b..bd1dc4b 100644
--- a/lib/lp/codehosting/bzrutils.py
+++ b/lib/lp/codehosting/bzrutils.py
@@ -1,10 +1,10 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Utilities for dealing with Bazaar.4"""Utilities for dealing with Breezy.
55
6Much of the code in here should be submitted upstream. The rest is code that6Much of the code in here should be submitted upstream. The rest is code that
7integrates between Bazaar's infrastructure and Launchpad's infrastructure.7integrates between Breezy's infrastructure and Launchpad's infrastructure.
8"""8"""
99
10__metaclass__ = type10__metaclass__ = type
@@ -28,30 +28,30 @@ from contextlib import contextmanager
28import os28import os
29import sys29import sys
3030
31from bzrlib import (31from breezy import (
32 config,32 config,
33 trace,33 trace,
34 )34 )
35from bzrlib.errors import (35from breezy.branch import UnstackableBranchFormat
36from breezy.bzr.remote import (
37 RemoteBranch,
38 RemoteBzrDir,
39 RemoteRepository,
40 )
41from breezy.errors import (
36 AppendRevisionsOnlyViolation,42 AppendRevisionsOnlyViolation,
37 ConnectionTimeout,43 ConnectionTimeout,
38 GhostRevisionsHaveNoRevno,44 GhostRevisionsHaveNoRevno,
39 NotStacked,45 NotStacked,
40 UnstackableBranchFormat,
41 UnstackableRepositoryFormat,46 UnstackableRepositoryFormat,
42 UnsupportedProtocol,47 UnsupportedProtocol,
43 )48 )
44from bzrlib.remote import (49from breezy.transport import (
45 RemoteBranch,
46 RemoteBzrDir,
47 RemoteRepository,
48 )
49from bzrlib.transport import (
50 get_transport,50 get_transport,
51 register_transport,51 register_transport,
52 unregister_transport,52 unregister_transport,
53 )53 )
54from bzrlib.transport.local import LocalTransport54from breezy.transport.local import LocalTransport
55from lazr.uri import URI55from lazr.uri import URI
5656
57from lp.services.webapp.errorlog import (57from lp.services.webapp.errorlog import (
@@ -221,7 +221,7 @@ class HttpAsLocalTransport(LocalTransport):
221 """A LocalTransport that works using http URLs.221 """A LocalTransport that works using http URLs.
222222
223 We have this because the Launchpad database has constraints on URLs for223 We have this because the Launchpad database has constraints on URLs for
224 branches, disallowing file:/// URLs. bzrlib itself disallows224 branches, disallowing file:/// URLs. breezy itself disallows
225 file://localhost/ URLs.225 file://localhost/ URLs.
226 """226 """
227227
@@ -287,7 +287,7 @@ def get_vfs_format_classes(branch):
287 if isinstance(repository, RemoteRepository):287 if isinstance(repository, RemoteRepository):
288 repository._ensure_real()288 repository._ensure_real()
289 repository = repository._real_repository289 repository = repository._real_repository
290 bzrdir = branch.bzrdir290 bzrdir = branch.controldir
291 if isinstance(bzrdir, RemoteBzrDir):291 if isinstance(bzrdir, RemoteBzrDir):
292 bzrdir._ensure_real()292 bzrdir._ensure_real()
293 bzrdir = bzrdir._real_bzrdir293 bzrdir = bzrdir._real_bzrdir
@@ -325,7 +325,7 @@ def get_branch_info(branch):
325 # XXX: Aaron Bentley 2008-06-13325 # XXX: Aaron Bentley 2008-06-13
326 # Bazaar does not provide a public API for learning about326 # Bazaar does not provide a public API for learning about
327 # format markers. Fix this in Bazaar, then here.327 # format markers. Fix this in Bazaar, then here.
328 info['control_string'] = branch.bzrdir._format.get_format_string()328 info['control_string'] = branch.controldir._format.get_format_string()
329 info['branch_string'] = branch._format.get_format_string()329 info['branch_string'] = branch._format.get_format_string()
330 info['repository_string'] = branch.repository._format.get_format_string()330 info['repository_string'] = branch.repository._format.get_format_string()
331 return info331 return info
diff --git a/lib/lp/codehosting/codeimport/tests/test_worker.py b/lib/lp/codehosting/codeimport/tests/test_worker.py
index 8bb5b7f..b414030 100644
--- a/lib/lp/codehosting/codeimport/tests/test_worker.py
+++ b/lib/lp/codehosting/codeimport/tests/test_worker.py
@@ -438,7 +438,7 @@ class TestImportDataStore(WorkerTest):
438 remote_name = '%08x.tar.gz' % (source_details.target_id,)438 remote_name = '%08x.tar.gz' % (source_details.target_id,)
439 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)439 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
440 transport = self.get_transport()440 transport = self.get_transport()
441 transport.put_bytes(remote_name, '')441 transport.put_bytes(remote_name, b'')
442 store = ImportDataStore(transport, source_details)442 store = ImportDataStore(transport, source_details)
443 ret = store.fetch(local_name)443 ret = store.fetch(local_name)
444 self.assertTrue(ret)444 self.assertTrue(ret)
@@ -496,7 +496,7 @@ class TestImportDataStore(WorkerTest):
496 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)496 local_name = '%s.tar.gz' % (self.factory.getUniqueString(),)
497 subdir_name = self.factory.getUniqueString()497 subdir_name = self.factory.getUniqueString()
498 source_details = self.factory.makeCodeImportSourceDetails()498 source_details = self.factory.makeCodeImportSourceDetails()
499 get_transport('.').put_bytes(local_name, '')499 get_transport('.').put_bytes(local_name, b'')
500 transport = self.get_transport()500 transport = self.get_transport()
501 store = ImportDataStore(transport.clone(subdir_name), source_details)501 store = ImportDataStore(transport.clone(subdir_name), source_details)
502 store.put(local_name)502 store.put(local_name)
diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
index bab222f..2873314 100644
--- a/lib/lp/codehosting/inmemory.py
+++ b/lib/lp/codehosting/inmemory.py
@@ -12,7 +12,7 @@ __all__ = [
12import operator12import operator
13from xmlrpclib import Fault13from xmlrpclib import Fault
1414
15from bzrlib.urlutils import (15from breezy.urlutils import (
16 escape,16 escape,
17 unescape,17 unescape,
18 )18 )
diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
index acbf014..35dd65b 100644
--- a/lib/lp/codehosting/puller/scheduler.py
+++ b/lib/lp/codehosting/puller/scheduler.py
@@ -320,7 +320,7 @@ class PullerMaster:
320 self.default_stacked_on_url]320 self.default_stacked_on_url]
321 self.logger.debug("executing %s", command)321 self.logger.debug("executing %s", command)
322 env = os.environ.copy()322 env = os.environ.copy()
323 env['BZR_EMAIL'] = get_lock_id_for_branch_id(self.branch_id)323 env['BRZ_EMAIL'] = get_lock_id_for_branch_id(self.branch_id)
324 reactor.spawnProcess(protocol, interpreter, command, env=env)324 reactor.spawnProcess(protocol, interpreter, command, env=env)
325 return deferred325 return deferred
326326
diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
index 716e2f5..59223a3 100644
--- a/lib/lp/codehosting/puller/tests/__init__.py
+++ b/lib/lp/codehosting/puller/tests/__init__.py
@@ -10,13 +10,13 @@ import shutil
10import socket10import socket
11from StringIO import StringIO11from StringIO import StringIO
1212
13from bzrlib.tests import TestCaseWithTransport13from breezy.tests import TestCaseWithTransport
14from bzrlib.tests.http_server import (14from breezy.tests.http_server import (
15 HttpServer,15 HttpServer,
16 TestingHTTPServer,16 TestingHTTPServer,
17 TestingThreadingHTTPServer,17 TestingThreadingHTTPServer,
18 )18 )
19from bzrlib.url_policy_open import AcceptAnythingPolicy19from breezy.url_policy_open import AcceptAnythingPolicy
2020
21from lp.codehosting.puller.worker import (21from lp.codehosting.puller.worker import (
22 BranchMirrorer,22 BranchMirrorer,
diff --git a/lib/lp/codehosting/puller/tests/test_acceptance.py b/lib/lp/codehosting/puller/tests/test_acceptance.py
index f835b65..305e52b 100644
--- a/lib/lp/codehosting/puller/tests/test_acceptance.py
+++ b/lib/lp/codehosting/puller/tests/test_acceptance.py
@@ -13,15 +13,15 @@ from subprocess import (
13 Popen,13 Popen,
14 )14 )
1515
16from bzrlib import errors16from breezy import errors
17from bzrlib.branch import Branch17from breezy.branch import Branch
18from bzrlib.bzrdir import BzrDir18from breezy.bzr.bzrdir import BzrDir
19from bzrlib.upgrade import upgrade19from breezy.upgrade import upgrade
20from bzrlib.urlutils import (20from breezy.urlutils import (
21 join as urljoin,21 join as urljoin,
22 local_path_from_url,22 local_path_from_url,
23 )23 )
24from bzrlib.workingtree import WorkingTree24from breezy.workingtree import WorkingTree
25from fixtures import TempDir25from fixtures import TempDir
26import transaction26import transaction
27from zope.component import getUtility27from zope.component import getUtility
@@ -284,7 +284,7 @@ class TestBranchPuller(PullerBranchTestCase, LoomTestMixin):
284 branch_url = urljoin(284 branch_url = urljoin(
285 config.launchpad.bzr_imports_root_url, '%08x' % db_branch.id)285 config.launchpad.bzr_imports_root_url, '%08x' % db_branch.id)
286 branch = BzrDir.create_branch_convenience(branch_url)286 branch = BzrDir.create_branch_convenience(branch_url)
287 tree = branch.bzrdir.open_workingtree()287 tree = branch.controldir.open_workingtree()
288 tree.commit('rev1')288 tree.commit('rev1')
289289
290 transaction.commit()290 transaction.commit()
diff --git a/lib/lp/codehosting/puller/tests/test_errors.py b/lib/lp/codehosting/puller/tests/test_errors.py
index 9416799..1819e95 100644
--- a/lib/lp/codehosting/puller/tests/test_errors.py
+++ b/lib/lp/codehosting/puller/tests/test_errors.py
@@ -11,14 +11,14 @@ import socket
11import tempfile11import tempfile
12import urllib212import urllib2
1313
14from bzrlib.errors import (14from breezy.errors import (
15 BzrError,15 BzrError,
16 NotBranchError,16 NotBranchError,
17 ParamikoNotPresent,17 ParamikoNotPresent,
18 UnknownFormatError,18 UnknownFormatError,
19 UnsupportedFormatError,19 UnsupportedFormatError,
20 )20 )
21from bzrlib.url_policy_open import (21from breezy.url_policy_open import (
22 BranchLoopError,22 BranchLoopError,
23 BranchReferenceForbidden,23 BranchReferenceForbidden,
24 )24 )
diff --git a/lib/lp/codehosting/puller/tests/test_scheduler.py b/lib/lp/codehosting/puller/tests/test_scheduler.py
index df1d0c9..2b08509 100644
--- a/lib/lp/codehosting/puller/tests/test_scheduler.py
+++ b/lib/lp/codehosting/puller/tests/test_scheduler.py
@@ -7,12 +7,10 @@ import logging
7import os7import os
8import textwrap8import textwrap
99
10from bzrlib.branch import Branch10from breezy.branch import Branch
11from bzrlib.bzrdir import (11from breezy.bzr.bzrdir import BzrDir
12 BzrDir,12from breezy.controldir import format_registry
13 format_registry,13from breezy.urlutils import join as urljoin
14 )
15from bzrlib.urlutils import join as urljoin
16from testtools.twistedsupport import (14from testtools.twistedsupport import (
17 assert_fails_with,15 assert_fails_with,
18 AsynchronousDeferredRunTest,16 AsynchronousDeferredRunTest,
@@ -545,7 +543,7 @@ parser = OptionParser()
545(options, arguments) = parser.parse_args()543(options, arguments) = parser.parse_args()
546(source_url, destination_url, branch_id, unique_name,544(source_url, destination_url, branch_id, unique_name,
547 branch_type_name, default_stacked_on_url) = arguments545 branch_type_name, default_stacked_on_url) = arguments
548from bzrlib import branch546from breezy import branch
549branch = branch.Branch.open(destination_url)547branch = branch.Branch.open(destination_url)
550protocol = PullerWorkerProtocol(sys.stdout)548protocol = PullerWorkerProtocol(sys.stdout)
551"""549"""
@@ -865,7 +863,7 @@ class TestPullerMasterIntegration(PullerBranchTestCase):
865 # We have to use a custom worker script to lower the time we wait for863 # We have to use a custom worker script to lower the time we wait for
866 # the lock for (the default is five minutes, too long for a test!)864 # the lock for (the default is five minutes, too long for a test!)
867 lower_timeout_script = """865 lower_timeout_script = """
868 from bzrlib import lockdir866 from breezy import lockdir
869 lockdir._DEFAULT_TIMEOUT_SECONDS = 2.0867 lockdir._DEFAULT_TIMEOUT_SECONDS = 2.0
870 from lp.code.enums import BranchType868 from lp.code.enums import BranchType
871 from lp.codehosting.puller.worker import (869 from lp.codehosting.puller.worker import (
diff --git a/lib/lp/codehosting/puller/tests/test_worker.py b/lib/lp/codehosting/puller/tests/test_worker.py
index d6cbaf3..addfcbb 100644
--- a/lib/lp/codehosting/puller/tests/test_worker.py
+++ b/lib/lp/codehosting/puller/tests/test_worker.py
@@ -8,21 +8,21 @@ __metaclass__ = type
8import gc8import gc
9from StringIO import StringIO9from StringIO import StringIO
1010
11import bzrlib.branch11import breezy.branch
12from bzrlib.branch import BranchReferenceFormat12from breezy.bzr.branch import BranchReferenceFormat
13from bzrlib.bzrdir import BzrDir13from breezy.bzr.bzrdir import BzrDir
14from bzrlib.errors import (14from breezy.errors import (
15 IncompatibleRepositories,15 IncompatibleRepositories,
16 NotBranchError,16 NotBranchError,
17 NotStacked,17 NotStacked,
18 )18 )
19from bzrlib.revision import NULL_REVISION19from breezy.revision import NULL_REVISION
20from bzrlib.tests import (20from breezy.tests import (
21 TestCaseInTempDir,21 TestCaseInTempDir,
22 TestCaseWithTransport,22 TestCaseWithTransport,
23 )23 )
24from bzrlib.transport import get_transport24from breezy.transport import get_transport
25from bzrlib.url_policy_open import (25from breezy.url_policy_open import (
26 AcceptAnythingPolicy,26 AcceptAnythingPolicy,
27 BadUrl,27 BadUrl,
28 BranchOpener,28 BranchOpener,
@@ -124,7 +124,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
124 source_tree.branch.base, self.get_url('dest'))124 source_tree.branch.base, self.get_url('dest'))
125 source_tree.commit('commit message')125 source_tree.commit('commit message')
126 to_mirror.mirrorWithoutChecks()126 to_mirror.mirrorWithoutChecks()
127 mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)127 mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
128 self.assertEqual(128 self.assertEqual(
129 source_tree.last_revision(), mirrored_branch.last_revision())129 source_tree.last_revision(), mirrored_branch.last_revision())
130130
@@ -134,7 +134,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
134 to_mirror = self.makePullerWorker(134 to_mirror = self.makePullerWorker(
135 source_branch.base, self.get_url('dest'))135 source_branch.base, self.get_url('dest'))
136 to_mirror.mirrorWithoutChecks()136 to_mirror.mirrorWithoutChecks()
137 mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)137 mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
138 self.assertEqual(NULL_REVISION, mirrored_branch.last_revision())138 self.assertEqual(NULL_REVISION, mirrored_branch.last_revision())
139139
140 def testCanMirrorWhenDestDirExists(self):140 def testCanMirrorWhenDestDirExists(self):
@@ -150,9 +150,9 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
150 dest.mkdir('.bzr')150 dest.mkdir('.bzr')
151 # 'dest' is not a branch.151 # 'dest' is not a branch.
152 self.assertRaises(152 self.assertRaises(
153 NotBranchError, bzrlib.branch.Branch.open, to_mirror.dest)153 NotBranchError, breezy.branch.Branch.open, to_mirror.dest)
154 to_mirror.mirrorWithoutChecks()154 to_mirror.mirrorWithoutChecks()
155 mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)155 mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
156 self.assertEqual(156 self.assertEqual(
157 source_tree.last_revision(), mirrored_branch.last_revision())157 source_tree.last_revision(), mirrored_branch.last_revision())
158158
@@ -179,7 +179,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
179 source_branch.base, self.get_url('destdir'),179 source_branch.base, self.get_url('destdir'),
180 policy=PrearrangedStackedBranchPolicy(stack_on.base))180 policy=PrearrangedStackedBranchPolicy(stack_on.base))
181 to_mirror.mirrorWithoutChecks()181 to_mirror.mirrorWithoutChecks()
182 dest = bzrlib.branch.Branch.open(self.get_url('destdir'))182 dest = breezy.branch.Branch.open(self.get_url('destdir'))
183 self.assertFalse(dest._format.supports_stacking())183 self.assertFalse(dest._format.supports_stacking())
184184
185 def test_defaultStackedOnBranchIncompatibleMirrorsOK(self):185 def test_defaultStackedOnBranchIncompatibleMirrorsOK(self):
@@ -192,7 +192,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
192 source_branch.base, self.get_url('destdir'),192 source_branch.base, self.get_url('destdir'),
193 policy=PrearrangedStackedBranchPolicy(stack_on.base))193 policy=PrearrangedStackedBranchPolicy(stack_on.base))
194 to_mirror.mirrorWithoutChecks()194 to_mirror.mirrorWithoutChecks()
195 dest = bzrlib.branch.Branch.open(self.get_url('destdir'))195 dest = breezy.branch.Branch.open(self.get_url('destdir'))
196 self.assertRaises(NotStacked, dest.get_stacked_on_url)196 self.assertRaises(NotStacked, dest.get_stacked_on_url)
197197
198 def testCanMirrorWithIncompatibleRepos(self):198 def testCanMirrorWithIncompatibleRepos(self):
@@ -212,7 +212,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
212 # IncompatibleRepositories.212 # IncompatibleRepositories.
213 self.assertRaises(213 self.assertRaises(
214 IncompatibleRepositories,214 IncompatibleRepositories,
215 bzrlib.branch.Branch.open, 'dest/stacked')215 breezy.branch.Branch.open, 'dest/stacked')
216 source_branch = self.make_branch(216 source_branch = self.make_branch(
217 'source-branch', format='2a')217 'source-branch', format='2a')
218 to_mirror = self.makePullerWorker(218 to_mirror = self.makePullerWorker(
@@ -220,7 +220,7 @@ class TestPullerWorker(TestCaseWithTransport, PullerWorkerMixin):
220 # The branch can be mirrored without errors and the destionation220 # The branch can be mirrored without errors and the destionation
221 # location is upgraded to match the source format.221 # location is upgraded to match the source format.
222 to_mirror.mirrorWithoutChecks()222 to_mirror.mirrorWithoutChecks()
223 mirrored_branch = bzrlib.branch.Branch.open(to_mirror.dest)223 mirrored_branch = breezy.branch.Branch.open(to_mirror.dest)
224 self.assertEqual(224 self.assertEqual(
225 source_branch.repository._format,225 source_branch.repository._format,
226 mirrored_branch.repository._format)226 mirrored_branch.repository._format)
@@ -286,7 +286,7 @@ class TestReferenceOpener(TestCaseWithTransport):
286 :return: file url to the created pure branch reference.286 :return: file url to the created pure branch reference.
287 """287 """
288 # XXX DavidAllouche 2007-09-12 bug=139109:288 # XXX DavidAllouche 2007-09-12 bug=139109:
289 # We do this manually because the bzrlib API does not support creating289 # We do this manually because the breezy API does not support creating
290 # a branch reference without opening it.290 # a branch reference without opening it.
291 t = get_transport(self.get_url('.'))291 t = get_transport(self.get_url('.'))
292 t.mkdir('reference')292 t.mkdir('reference')
@@ -314,7 +314,7 @@ class TestReferenceOpener(TestCaseWithTransport):
314314
315 # Open the branch reference and check that the result is indeed the315 # Open the branch reference and check that the result is indeed the
316 # branch we wanted it to point at.316 # branch we wanted it to point at.
317 opened_branch = bzrlib.branch.Branch.open(reference_url)317 opened_branch = breezy.branch.Branch.open(reference_url)
318 self.assertEqual(opened_branch.base, target_branch.base)318 self.assertEqual(opened_branch.base, target_branch.base)
319319
320 def testFollowReferenceValue(self):320 def testFollowReferenceValue(self):
@@ -496,9 +496,9 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
496 def setUp(self):496 def setUp(self):
497 super(TestWorkerProgressReporting, self).setUp()497 super(TestWorkerProgressReporting, self).setUp()
498 BranchOpener.install_hook()498 BranchOpener.install_hook()
499 self.saved_factory = bzrlib.ui.ui_factory499 self.saved_factory = breezy.ui.ui_factory
500 self.disable_directory_isolation()500 self.disable_directory_isolation()
501 self.addCleanup(setattr, bzrlib.ui, 'ui_factory', self.saved_factory)501 self.addCleanup(setattr, breezy.ui, 'ui_factory', self.saved_factory)
502502
503 def getHttpServerForCwd(self):503 def getHttpServerForCwd(self):
504 """Get an `HttpServer` instance that serves from '.'."""504 """Get an `HttpServer` instance that serves from '.'."""
@@ -530,7 +530,7 @@ class TestWorkerProgressReporting(TestCaseWithTransport):
530530
531 p = self.StubProtocol()531 p = self.StubProtocol()
532 install_worker_ui_factory(p)532 install_worker_ui_factory(p)
533 b2_http = bzrlib.branch.Branch.open(533 b2_http = breezy.branch.Branch.open(
534 http_server.get_url() + 'some-other-branch')534 http_server.get_url() + 'some-other-branch')
535 b1.pull(b2_http)535 b1.pull(b2_http)
536 self.assertSubset([WORKER_ACTIVITY_NETWORK], p.calls)536 self.assertSubset([WORKER_ACTIVITY_NETWORK], p.calls)
diff --git a/lib/lp/codehosting/puller/tests/test_worker_formats.py b/lib/lp/codehosting/puller/tests/test_worker_formats.py
index 3cc8873..b065ffa 100644
--- a/lib/lp/codehosting/puller/tests/test_worker_formats.py
+++ b/lib/lp/codehosting/puller/tests/test_worker_formats.py
@@ -5,19 +5,19 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib.branch import Branch8from breezy.branch import Branch
9from bzrlib.bzrdir import BzrDirMetaFormat19from breezy.bzr.bzrdir import BzrDirMetaFormat1
10from bzrlib.plugins.weave_fmt.bzrdir import BzrDirFormat610from breezy.bzr.knitpack_repo import RepositoryFormatKnitPack5
11from bzrlib.plugins.weave_fmt.repository import (11from breezy.bzr.knitrepo import RepositoryFormatKnit1
12from breezy.plugins.weave_fmt.bzrdir import BzrDirFormat6
13from breezy.plugins.weave_fmt.repository import (
12 RepositoryFormat6,14 RepositoryFormat6,
13 RepositoryFormat7,15 RepositoryFormat7,
14 )16 )
15from bzrlib.repofmt.knitpack_repo import RepositoryFormatKnitPack517from breezy.tests.per_repository import TestCaseWithRepository
16from bzrlib.repofmt.knitrepo import RepositoryFormatKnit118from breezy.url_policy_open import BranchOpener
17from bzrlib.tests.per_repository import TestCaseWithRepository
18from bzrlib.url_policy_open import BranchOpener
1919
20import lp.codehosting # For bzr plugins.20import lp.codehosting # For brz plugins.
21from lp.codehosting.puller.tests import PullerWorkerMixin21from lp.codehosting.puller.tests import PullerWorkerMixin
22from lp.codehosting.tests.helpers import LoomTestMixin22from lp.codehosting.tests.helpers import LoomTestMixin
2323
@@ -27,7 +27,7 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
2727
28 def setUp(self):28 def setUp(self):
29 TestCaseWithRepository.setUp(self)29 TestCaseWithRepository.setUp(self)
30 # make_bzrdir relies on this being a relative filesystem path.30 # make_controldir relies on this being a relative filesystem path.
31 self._source_branch_path = 'source-branch'31 self._source_branch_path = 'source-branch'
32 BranchOpener.install_hook()32 BranchOpener.install_hook()
33 self.worker = self.makePullerWorker(33 self.worker = self.makePullerWorker(
@@ -39,7 +39,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
39 """Make a source branch with the given formats."""39 """Make a source branch with the given formats."""
40 if branch_format is not None:40 if branch_format is not None:
41 bzrdir_format.set_branch_format(branch_format)41 bzrdir_format.set_branch_format(branch_format)
42 bd = self.make_bzrdir(self._source_branch_path, format=bzrdir_format)42 bd = self.make_controldir(
43 self._source_branch_path, format=bzrdir_format)
43 repository_format.initialize(bd)44 repository_format.initialize(bd)
44 branch = bd.create_branch()45 branch = bd.create_branch()
45 tree = branch.create_checkout('source-checkout')46 tree = branch.create_checkout('source-checkout')
@@ -58,8 +59,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
58 source_branch.repository._format.get_format_description(),59 source_branch.repository._format.get_format_description(),
59 dest_branch.repository._format.get_format_description())60 dest_branch.repository._format.get_format_description())
60 self.assertEqual(61 self.assertEqual(
61 source_branch.bzrdir._format.get_format_description(),62 source_branch.controldir._format.get_format_description(),
62 dest_branch.bzrdir._format.get_format_description())63 dest_branch.controldir._format.get_format_description())
6364
64 def _testMirrorWithFormats(self, repository_format, bzrdir_format):65 def _testMirrorWithFormats(self, repository_format, bzrdir_format):
65 """Make a branch with certain formats, mirror it and check the mirror.66 """Make a branch with certain formats, mirror it and check the mirror.
@@ -85,9 +86,8 @@ class TestPullerWorkerFormats(TestCaseWithRepository, PullerWorkerMixin,
85 self.assertMirrored(branch, mirrored_branch)86 self.assertMirrored(branch, mirrored_branch)
8687
87 # XXX: JonathanLange 2008-06-25: These next three tests should be88 # XXX: JonathanLange 2008-06-25: These next three tests should be
88 # implemented against all supported repository formats using bzrlib's test89 # implemented against all supported repository formats using breezy's test
89 # adaptation APIs. Unfortunately, this API changes between 1.5 and 1.6, so90 # adaptation APIs.
90 # it'd be a bit silly to do the work now.
91 def testMirrorKnitAsKnit(self):91 def testMirrorKnitAsKnit(self):
92 # Create a source branch in knit format, and check that the mirror is92 # Create a source branch in knit format, and check that the mirror is
93 # in knit format.93 # in knit format.
diff --git a/lib/lp/codehosting/puller/worker.py b/lib/lp/codehosting/puller/worker.py
index e0ff5b4..d0ed4ca 100644
--- a/lib/lp/codehosting/puller/worker.py
+++ b/lib/lp/codehosting/puller/worker.py
@@ -12,22 +12,25 @@ import urllib2
12# line below this comment.12# line below this comment.
13import lp.codehosting13import lp.codehosting
1414
15from bzrlib import (15from breezy import (
16 errors,16 errors,
17 urlutils,17 urlutils,
18 )18 )
19from bzrlib.branch import Branch19from breezy.branch import (
20from bzrlib.plugins.loom.branch import LoomSupport20 Branch,
21from bzrlib.plugins.weave_fmt.branch import BzrBranchFormat421 UnstackableBranchFormat,
22from bzrlib.plugins.weave_fmt.repository import (22 )
23from breezy.plugins.loom.branch import LoomSupport
24from breezy.plugins.weave_fmt.branch import BzrBranchFormat4
25from breezy.plugins.weave_fmt.repository import (
23 RepositoryFormat4,26 RepositoryFormat4,
24 RepositoryFormat5,27 RepositoryFormat5,
25 RepositoryFormat6,28 RepositoryFormat6,
26 )29 )
27from bzrlib.transport import get_transport30from breezy.transport import get_transport
28import bzrlib.ui31import breezy.ui
29from bzrlib.ui import SilentUIFactory32from breezy.ui import SilentUIFactory
30from bzrlib.url_policy_open import (33from breezy.url_policy_open import (
31 BadUrl,34 BadUrl,
32 BranchLoopError,35 BranchLoopError,
33 BranchOpener,36 BranchOpener,
@@ -158,7 +161,7 @@ class BranchMirrorerPolicy(BranchOpenPolicy):
158 revision_id = None161 revision_id = None
159 else:162 else:
160 revision_id = 'null:'163 revision_id = 'null:'
161 source_branch.bzrdir.clone_on_transport(164 source_branch.controldir.clone_on_transport(
162 dest_transport, revision_id=revision_id)165 dest_transport, revision_id=revision_id)
163 return Branch.open(destination_url)166 return Branch.open(destination_url)
164167
@@ -251,7 +254,7 @@ class BranchMirrorer(object):
251 try:254 try:
252 dest_branch.set_stacked_on_url(stacked_on_url)255 dest_branch.set_stacked_on_url(stacked_on_url)
253 except (errors.UnstackableRepositoryFormat,256 except (errors.UnstackableRepositoryFormat,
254 errors.UnstackableBranchFormat,257 UnstackableBranchFormat,
255 errors.IncompatibleRepositories):258 errors.IncompatibleRepositories):
256 stacked_on_url = None259 stacked_on_url = None
257 if stacked_on_url is None:260 if stacked_on_url is None:
@@ -448,7 +451,7 @@ class PullerWorker:
448 # XXX: Aaron Bentley 2008-06-13451 # XXX: Aaron Bentley 2008-06-13
449 # Bazaar does not provide a public API for learning about452 # Bazaar does not provide a public API for learning about
450 # format markers. Fix this in Bazaar, then here.453 # format markers. Fix this in Bazaar, then here.
451 control_string = dest_branch.bzrdir._format.get_format_string()454 control_string = dest_branch.controldir._format.get_format_string()
452 if dest_branch._format.__class__ is BzrBranchFormat4:455 if dest_branch._format.__class__ is BzrBranchFormat4:
453 branch_string = BranchFormat.BZR_BRANCH_4.title456 branch_string = BranchFormat.BZR_BRANCH_4.title
454 else:457 else:
@@ -488,8 +491,10 @@ class PullerWorkerUIFactory(SilentUIFactory):
488 def confirm_action(self, prompt, confirmation_id, args):491 def confirm_action(self, prompt, confirmation_id, args):
489 """If we're asked to break a lock like a stale lock of ours, say yes.492 """If we're asked to break a lock like a stale lock of ours, say yes.
490 """493 """
491 assert confirmation_id == 'bzrlib.lockdir.break', \494 if confirmation_id not in (
492 "Didn't expect confirmation id %r" % (confirmation_id,)495 'bzrlib.lockdir.break', 'breezy.lockdir.break'):
496 raise AssertionError(
497 "Didn't expect confirmation id %r" % (confirmation_id,))
493 branch_id = self.puller_worker_protocol.branch_id498 branch_id = self.puller_worker_protocol.branch_id
494 prompt = prompt % args499 prompt = prompt % args
495 if get_lock_id_for_branch_id(branch_id) in prompt:500 if get_lock_id_for_branch_id(branch_id) in prompt:
@@ -518,7 +523,7 @@ def install_worker_ui_factory(puller_worker_protocol):
518 2) Break locks if and only if they appear to be stale locks523 2) Break locks if and only if they appear to be stale locks
519 created by another puller worker process.524 created by another puller worker process.
520 """525 """
521 bzrlib.ui.ui_factory = PullerWorkerUIFactory(puller_worker_protocol)526 breezy.ui.ui_factory = PullerWorkerUIFactory(puller_worker_protocol)
522527
523528
524class MirroredBranchPolicy(BranchMirrorerPolicy):529class MirroredBranchPolicy(BranchMirrorerPolicy):
@@ -600,7 +605,7 @@ class ImportedBranchPolicy(BranchMirrorerPolicy):
600 Because we control the process that creates import branches, a605 Because we control the process that creates import branches, a
601 vfs-level copy is safe and more efficient than a bzr fetch.606 vfs-level copy is safe and more efficient than a bzr fetch.
602 """607 """
603 source_transport = source_branch.bzrdir.root_transport608 source_transport = source_branch.controldir.root_transport
604 dest_transport = get_transport(destination_url)609 dest_transport = get_transport(destination_url)
605 while True:610 while True:
606 # We loop until the remote file list before and after the copy is611 # We loop until the remote file list before and after the copy is
diff --git a/lib/lp/codehosting/rewrite.py b/lib/lp/codehosting/rewrite.py
index c6e204d..f59520b 100644
--- a/lib/lp/codehosting/rewrite.py
+++ b/lib/lp/codehosting/rewrite.py
@@ -6,7 +6,7 @@
66
7import time7import time
88
9from bzrlib import urlutils9from breezy import urlutils
10from zope.component import getUtility10from zope.component import getUtility
11from zope.security.interfaces import Unauthorized11from zope.security.interfaces import Unauthorized
1212
diff --git a/lib/lp/codehosting/scanner/buglinks.py b/lib/lp/codehosting/scanner/buglinks.py
index 539bd93..95d8eaa 100644
--- a/lib/lp/codehosting/scanner/buglinks.py
+++ b/lib/lp/codehosting/scanner/buglinks.py
@@ -10,7 +10,7 @@ __all__ = [
1010
11import urlparse11import urlparse
1212
13from bzrlib.errors import InvalidBugStatus13from breezy.bugtracker import InvalidBugStatus
14from zope.component import getUtility14from zope.component import getUtility
1515
16from lp.app.errors import NotFoundError16from lp.app.errors import NotFoundError
diff --git a/lib/lp/codehosting/scanner/bzrsync.py b/lib/lp/codehosting/scanner/bzrsync.py
index 0161972..4eab1a9 100755
--- a/lib/lp/codehosting/scanner/bzrsync.py
+++ b/lib/lp/codehosting/scanner/bzrsync.py
@@ -16,8 +16,8 @@ __all__ = [
1616
17import logging17import logging
1818
19from bzrlib.graph import DictParentsProvider19from breezy.graph import DictParentsProvider
20from bzrlib.revision import NULL_REVISION20from breezy.revision import NULL_REVISION
21import pytz21import pytz
22import six22import six
23from storm.locals import Store23from storm.locals import Store
@@ -91,7 +91,7 @@ class BzrSync:
91 self.logger.info(" from %s", bzr_branch.base)91 self.logger.info(" from %s", bzr_branch.base)
92 # Get the history and ancestry from the branch first, to fail early92 # Get the history and ancestry from the branch first, to fail early
93 # if something is wrong with the branch.93 # if something is wrong with the branch.
94 self.logger.info("Retrieving history from bzrlib.")94 self.logger.info("Retrieving history from breezy.")
95 bzr_history = branch_revision_history(bzr_branch)95 bzr_history = branch_revision_history(bzr_branch)
96 # The BranchRevision, Revision and RevisionParent tables are only96 # The BranchRevision, Revision and RevisionParent tables are only
97 # written to by the branch-scanner, so they are not subject to97 # written to by the branch-scanner, so they are not subject to
@@ -197,7 +197,7 @@ class BzrSync:
197197
198 def planDatabaseChanges(self, bzr_branch, bzr_history, db_ancestry,198 def planDatabaseChanges(self, bzr_branch, bzr_history, db_ancestry,
199 db_history):199 db_history):
200 """Plan database changes to synchronize with bzrlib data.200 """Plan database changes to synchronize with breezy data.
201201
202 Use the data retrieved by `retrieveDatabaseAncestry` and202 Use the data retrieved by `retrieveDatabaseAncestry` and
203 `retrieveBranchDetails` to plan the changes to apply to the database.203 `retrieveBranchDetails` to plan the changes to apply to the database.
@@ -240,7 +240,7 @@ class BzrSync:
240 def getBazaarRevisions(self, bzr_branch, revisions):240 def getBazaarRevisions(self, bzr_branch, revisions):
241 """Like ``get_revisions(revisions)`` but filter out ghosts first.241 """Like ``get_revisions(revisions)`` but filter out ghosts first.
242242
243 :param revisions: the set of Bazaar revision IDs to return bzrlib243 :param revisions: the set of Breezy revision IDs to return breezy
244 Revision objects for.244 Revision objects for.
245 """245 """
246 revisions = bzr_branch.repository.get_parent_map(revisions)246 revisions = bzr_branch.repository.get_parent_map(revisions)
@@ -249,9 +249,9 @@ class BzrSync:
249 def syncRevisions(self, bzr_branch, bzr_revisions, revids_to_insert):249 def syncRevisions(self, bzr_branch, bzr_revisions, revids_to_insert):
250 """Import the supplied revisions.250 """Import the supplied revisions.
251251
252 :param bzr_branch: The Bazaar branch that's being scanned.252 :param bzr_branch: The Breezy branch that's being scanned.
253 :param bzr_revisions: the revisions to import253 :param bzr_revisions: the revisions to import
254 :type bzr_revision: bzrlib.revision.Revision254 :type bzr_revision: breezy.revision.Revision
255 :param revids_to_insert: a dict of revision ids to integer255 :param revids_to_insert: a dict of revision ids to integer
256 revno. Non-mainline revisions will be mapped to None.256 revno. Non-mainline revisions will be mapped to None.
257 """257 """
diff --git a/lib/lp/codehosting/scanner/mergedetection.py b/lib/lp/codehosting/scanner/mergedetection.py
index db23fdb..0e5dcd5 100644
--- a/lib/lp/codehosting/scanner/mergedetection.py
+++ b/lib/lp/codehosting/scanner/mergedetection.py
@@ -9,7 +9,7 @@ __all__ = [
9 'auto_merge_proposals',9 'auto_merge_proposals',
10 ]10 ]
1111
12from bzrlib.revision import NULL_REVISION12from breezy.revision import NULL_REVISION
13from zope.component import getUtility13from zope.component import getUtility
1414
15from lp.code.adapters.branch import BranchMergeProposalNoPreviewDiffDelta15from lp.code.adapters.branch import BranchMergeProposalNoPreviewDiffDelta
diff --git a/lib/lp/codehosting/scanner/tests/test_buglinks.py b/lib/lp/codehosting/scanner/tests/test_buglinks.py
index bfa2981..935af50 100644
--- a/lib/lp/codehosting/scanner/tests/test_buglinks.py
+++ b/lib/lp/codehosting/scanner/tests/test_buglinks.py
@@ -1,11 +1,11 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for creating BugBranch items based on Bazaar revisions."""4"""Tests for creating BugBranch items based on Breezy revisions."""
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib.revision import Revision8from breezy.revision import Revision
9from zope.component import getUtility9from zope.component import getUtility
10from zope.event import notify10from zope.event import notify
1111
@@ -192,7 +192,7 @@ class TestBugLinking(BzrSyncTestCase):
192 author = self.factory.getUniqueString()192 author = self.factory.getUniqueString()
193 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is193 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
194 # required to generate the revision-id.194 # required to generate the revision-id.
195 with override_environ(BZR_EMAIL='me@example.com'):195 with override_environ(BRZ_EMAIL='me@example.com'):
196 self.bzr_tree.commit(196 self.bzr_tree.commit(
197 u'common parent', committer=author, rev_id='r1',197 u'common parent', committer=author, rev_id='r1',
198 allow_pointless=True)198 allow_pointless=True)
@@ -253,7 +253,7 @@ class TestSubscription(TestCaseWithFactory):
253 switch_dbuser("branchscanner")253 switch_dbuser("branchscanner")
254 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is254 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
255 # required to generate the revision-id.255 # required to generate the revision-id.
256 with override_environ(BZR_EMAIL='me@example.com'):256 with override_environ(BRZ_EMAIL='me@example.com'):
257 revision_id = tree.commit('fix revision',257 revision_id = tree.commit('fix revision',
258 revprops={258 revprops={
259 'bugs': 'https://launchpad.net/bugs/%d fixed' % bug.id})259 'bugs': 'https://launchpad.net/bugs/%d fixed' % bug.id})
diff --git a/lib/lp/codehosting/scanner/tests/test_bzrsync.py b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
index 660d101..9ddc355 100644
--- a/lib/lp/codehosting/scanner/tests/test_bzrsync.py
+++ b/lib/lp/codehosting/scanner/tests/test_bzrsync.py
@@ -8,13 +8,13 @@ import os
8import random8import random
9import time9import time
1010
11from bzrlib.revision import (11from breezy.revision import (
12 NULL_REVISION,12 NULL_REVISION,
13 Revision as BzrRevision,13 Revision as BzrRevision,
14 )14 )
15from bzrlib.tests import TestCaseWithTransport15from breezy.tests import TestCaseWithTransport
16from bzrlib.uncommit import uncommit16from breezy.uncommit import uncommit
17from bzrlib.url_policy_open import BranchOpener17from breezy.url_policy_open import BranchOpener
18from fixtures import (18from fixtures import (
19 FakeLogger,19 FakeLogger,
20 TempDir,20 TempDir,
@@ -191,7 +191,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
191 self.bzr_tree.add_pending_merge(*extra_parents)191 self.bzr_tree.add_pending_merge(*extra_parents)
192 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is192 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
193 # required to generate the revision-id.193 # required to generate the revision-id.
194 with override_environ(BZR_EMAIL='me@example.com'):194 with override_environ(BRZ_EMAIL='me@example.com'):
195 return self.bzr_tree.commit(195 return self.bzr_tree.commit(
196 message, committer=committer, rev_id=rev_id,196 message, committer=committer, rev_id=rev_id,
197 timestamp=timestamp, timezone=timezone, allow_pointless=True,197 timestamp=timestamp, timezone=timezone, allow_pointless=True,
@@ -240,7 +240,7 @@ class BzrSyncTestCase(TestCaseWithTransport, TestCaseWithFactory):
240 db_branch=db_branch)240 db_branch=db_branch)
241 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is241 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
242 # required to generate the revision-id.242 # required to generate the revision-id.
243 with override_environ(BZR_EMAIL='me@example.com'):243 with override_environ(BRZ_EMAIL='me@example.com'):
244 trunk_tree.commit(u'base revision', rev_id=base_rev_id)244 trunk_tree.commit(u'base revision', rev_id=base_rev_id)
245245
246 # Branch from the base revision.246 # Branch from the base revision.
@@ -572,7 +572,8 @@ class TestPlanDatabaseChanges(BzrSyncTestCase):
572 # deletion anyway.572 # deletion anyway.
573 rev1_id = self.bzr_tree.commit(573 rev1_id = self.bzr_tree.commit(
574 'initial commit', committer='me@example.org')574 'initial commit', committer='me@example.org')
575 merge_tree = self.bzr_tree.bzrdir.sprout('merge').open_workingtree()575 merge_tree = self.bzr_tree.controldir.sprout(
576 'merge').open_workingtree()
576 merge_id = merge_tree.commit(577 merge_id = merge_tree.commit(
577 'mergeable commit', committer='me@example.org')578 'mergeable commit', committer='me@example.org')
578 self.bzr_tree.merge_from_branch(merge_tree.branch)579 self.bzr_tree.merge_from_branch(merge_tree.branch)
diff --git a/lib/lp/codehosting/scanner/tests/test_email.py b/lib/lp/codehosting/scanner/tests/test_email.py
index 39ccec3..a403251 100644
--- a/lib/lp/codehosting/scanner/tests/test_email.py
+++ b/lib/lp/codehosting/scanner/tests/test_email.py
@@ -8,7 +8,7 @@ __metaclass__ = type
8import email8import email
9import os9import os
1010
11from bzrlib.uncommit import uncommit11from breezy.uncommit import uncommit
12from zope.component import getUtility12from zope.component import getUtility
13from zope.event import notify13from zope.event import notify
1414
diff --git a/lib/lp/codehosting/scanner/tests/test_mergedetection.py b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
index 3d4508e..c0cb7ad 100644
--- a/lib/lp/codehosting/scanner/tests/test_mergedetection.py
+++ b/lib/lp/codehosting/scanner/tests/test_mergedetection.py
@@ -7,7 +7,7 @@ __metaclass__ = type
77
8import logging8import logging
99
10from bzrlib.revision import NULL_REVISION10from breezy.revision import NULL_REVISION
11from lazr.lifecycle.event import ObjectModifiedEvent11from lazr.lifecycle.event import ObjectModifiedEvent
12import transaction12import transaction
13from zope.component import getUtility13from zope.component import getUtility
@@ -143,7 +143,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
143143
144 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is144 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
145 # required to generate the revision-id.145 # required to generate the revision-id.
146 with override_environ(BZR_EMAIL='me@example.com'):146 with override_environ(BRZ_EMAIL='me@example.com'):
147 branch_tree.commit(u'another revision', rev_id='another-rev')147 branch_tree.commit(u'another revision', rev_id='another-rev')
148 current_proposal_status = proposal.queue_status148 current_proposal_status = proposal.queue_status
149 self.assertNotEqual(149 self.assertNotEqual(
@@ -164,7 +164,7 @@ class TestAutoMergeDetectionForMergeProposals(BzrSyncTestCase):
164164
165 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is165 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
166 # required to generate the revision-id.166 # required to generate the revision-id.
167 with override_environ(BZR_EMAIL='me@example.com'):167 with override_environ(BRZ_EMAIL='me@example.com'):
168 branch_tree.commit(u'another revision', rev_id='another-rev')168 branch_tree.commit(u'another revision', rev_id='another-rev')
169 current_proposal_status = proposal.queue_status169 current_proposal_status = proposal.queue_status
170 self.assertNotEqual(170 self.assertNotEqual(
diff --git a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
index b820539..5f9443f 100644
--- a/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
+++ b/lib/lp/codehosting/scripts/tests/test_upgrade_all_branches.py
@@ -8,7 +8,7 @@ import logging
8import os8import os
9from os.path import dirname9from os.path import dirname
1010
11from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a11from breezy.bzr.groupcompress_repo import RepositoryFormat2a
12from fixtures import TempDir12from fixtures import TempDir
13import transaction13import transaction
1414
diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py
index 4c7e7fb..51d42e7 100644
--- a/lib/lp/codehosting/sftp.py
+++ b/lib/lp/codehosting/sftp.py
@@ -24,12 +24,12 @@ import errno
24import os24import os
25import stat25import stat
2626
27from bzrlib import (27from breezy import (
28 errors as bzr_errors,28 errors as bzr_errors,
29 osutils,29 osutils,
30 urlutils,30 urlutils,
31 )31 )
32from bzrlib.transport.local import LocalTransport32from breezy.transport.local import LocalTransport
33from lazr.sshserver.sftp import FileIsADirectory33from lazr.sshserver.sftp import FileIsADirectory
34from twisted.conch.interfaces import (34from twisted.conch.interfaces import (
35 ISFTPFile,35 ISFTPFile,
@@ -160,7 +160,7 @@ class TransportSFTPFile:
160 def _truncateFile(self):160 def _truncateFile(self):
161 """Truncate this file."""161 """Truncate this file."""
162 self._written = True162 self._written = True
163 return self.transport.put_bytes(self._escaped_path, '')163 return self.transport.put_bytes(self._escaped_path, b'')
164164
165 @with_sftp_error165 @with_sftp_error
166 def writeChunk(self, offset, data):166 def writeChunk(self, offset, data):
@@ -198,7 +198,7 @@ class TransportSFTPFile:
198198
199 Doing things this way around, by trying to read all the data199 Doing things this way around, by trying to read all the data
200 requested and then handling the short read error, might be a bit200 requested and then handling the short read error, might be a bit
201 inefficient, but the bzrlib sftp transport doesn't read past the201 inefficient, but the breezy sftp transport doesn't read past the
202 end of files, so we don't need to worry too much about performance202 end of files, so we don't need to worry too much about performance
203 here.203 here.
204 """204 """
diff --git a/lib/lp/codehosting/sshserver/session.py b/lib/lp/codehosting/sshserver/session.py
index 64567fe..91d31e4 100644
--- a/lib/lp/codehosting/sshserver/session.py
+++ b/lib/lp/codehosting/sshserver/session.py
@@ -26,7 +26,7 @@ from twisted.python import log
26from zope.event import notify26from zope.event import notify
27from zope.interface import implementer27from zope.interface import implementer
2828
29from lp.codehosting import get_bzr_path29from lp.codehosting import get_brz_path
30from lp.services.config import config30from lp.services.config import config
3131
3232
@@ -141,16 +141,17 @@ class ForkedProcessTransport(process.BaseProcess):
141141
142 :return: The pid, communication directory, and request socket.142 :return: The pid, communication directory, and request socket.
143 """143 """
144 assert executable == 'bzr', executable # Maybe .endswith()144 assert executable == 'brz', executable # Maybe .endswith()
145 assert args[0] == 'bzr', args[0]145 assert args[0] == 'brz', args[0]
146 message = ['fork-env %s\n' % (' '.join(args[1:]),)]146 message = ['fork-env %s\n' % (' '.join(args[1:]),)]
147 for key, value in environment.iteritems():147 for key, value in environment.iteritems():
148 # XXX: Currently we only pass BZR_EMAIL, should we be passing148 # XXX: Currently we only pass BRZ_EMAIL, should we be passing
149 # everything else? Note that many won't be handled properly,149 # everything else? Note that many won't be handled properly,
150 # since the process is already running.150 # since the process is already running.
151 if key != 'BZR_EMAIL':151 if key in ('BZR_EMAIL', 'BRZ_EMAIL'):
152 continue152 # Map both of these to BRZ_EMAIL, since we run brz on the
153 message.append('%s: %s\n' % (key, value))153 # server.
154 message.append('BRZ_EMAIL: %s\n' % (value,))
154 message.append('end\n')155 message.append('end\n')
155 message = ''.join(message)156 message = ''.join(message)
156 response, sock = self._sendMessageToService(message)157 response, sock = self._sendMessageToService(message)
@@ -418,7 +419,7 @@ class ForkingRestrictedExecOnlySession(RestrictedExecOnlySession):
418 def _simplifyEnvironment(self, env):419 def _simplifyEnvironment(self, env):
419 """Pull out the bits of the environment we want to pass along."""420 """Pull out the bits of the environment we want to pass along."""
420 env = {}421 env = {}
421 for env_var in ['BZR_EMAIL']:422 for env_var in ['BRZ_EMAIL']:
422 if env_var in self.environment:423 if env_var in self.environment:
423 env[env_var] = self.environment[env_var]424 env[env_var] = self.environment[env_var]
424 return env425 return env
@@ -426,15 +427,15 @@ class ForkingRestrictedExecOnlySession(RestrictedExecOnlySession):
426 def getCommandToFork(self, executable, arguments, env):427 def getCommandToFork(self, executable, arguments, env):
427 assert executable.endswith('/bin/py')428 assert executable.endswith('/bin/py')
428 assert arguments[0] == executable429 assert arguments[0] == executable
429 assert arguments[1].endswith('/bzr')430 assert arguments[1].endswith('/brz')
430 executable = 'bzr'431 executable = 'brz'
431 arguments = arguments[1:]432 arguments = arguments[1:]
432 arguments[0] = 'bzr'433 arguments[0] = 'brz'
433 env = self._simplifyEnvironment(env)434 env = self._simplifyEnvironment(env)
434 return executable, arguments, env435 return executable, arguments, env
435436
436 def _spawn(self, protocol, executable, arguments, env):437 def _spawn(self, protocol, executable, arguments, env):
437 # When spawning, adapt the idea of "bin/py .../bzr" to just using "bzr"438 # When spawning, adapt the idea of "bin/py .../brz" to just using "brz"
438 # and the executable439 # and the executable
439 executable, arguments, env = self.getCommandToFork(executable,440 executable, arguments, env = self.getCommandToFork(executable,
440 arguments, env)441 arguments, env)
@@ -449,16 +450,18 @@ def lookup_command_template(command):
449 :return: Command template450 :return: Command template
450 :raise ForbiddenCommand: Raised when command isn't allowed451 :raise ForbiddenCommand: Raised when command isn't allowed
451 """452 """
452 python_command = "%(root)s/bin/py %(bzr)s" % {453 python_command = "%(root)s/bin/py %(brz)s" % {
453 'root': config.root,454 'root': config.root,
454 'bzr': get_bzr_path(),455 'brz': get_brz_path(),
455 }456 }
456 args = " lp-serve --inet %(user_id)s"457 args = " lp-serve --inet %(user_id)s"
457 command_template = python_command + args458 command_template = python_command + args
458459
459 if command == 'bzr serve --inet --directory=/ --allow-writes':460 if command in (
461 'bzr serve --inet --directory=/ --allow-writes',
462 'brz serve --inet --directory=/ --allow-writes'):
460 return command_template463 return command_template
461 # At the moment, only bzr branch serving is allowed.464 # At the moment, only bzr/brz branch serving is allowed.
462 raise ForbiddenCommand("Not allowed to execute %r." % (command,))465 raise ForbiddenCommand("Not allowed to execute %r." % (command,))
463466
464467
@@ -469,7 +472,7 @@ def launch_smart_server(avatar):
469472
470 # Extract the hostname from the supermirror root config.473 # Extract the hostname from the supermirror root config.
471 hostname = urlparse.urlparse(config.codehosting.supermirror_root)[1]474 hostname = urlparse.urlparse(config.codehosting.supermirror_root)[1]
472 environment['BZR_EMAIL'] = '%s@%s' % (avatar.username, hostname)475 environment['BRZ_EMAIL'] = '%s@%s' % (avatar.username, hostname)
473 # TODO: Use a FeatureFlag to enable this in a more fine-grained approach.476 # TODO: Use a FeatureFlag to enable this in a more fine-grained approach.
474 # If the forking daemon has been spawned, then we can use it if the477 # If the forking daemon has been spawned, then we can use it if the
475 # feature is set to true for the given user, etc.478 # feature is set to true for the given user, etc.
diff --git a/lib/lp/codehosting/sshserver/tests/test_session.py b/lib/lp/codehosting/sshserver/tests/test_session.py
index 7b1ad2f..a212873 100644
--- a/lib/lp/codehosting/sshserver/tests/test_session.py
+++ b/lib/lp/codehosting/sshserver/tests/test_session.py
@@ -13,8 +13,8 @@ from twisted.internet.process import ProcessExitedAlready
13from twisted.internet.protocol import ProcessProtocol13from twisted.internet.protocol import ProcessProtocol
1414
15from lp.codehosting import (15from lp.codehosting import (
16 get_bzr_path,16 get_brz_path,
17 get_BZR_PLUGIN_PATH_for_subprocess,17 get_BRZ_PLUGIN_PATH_for_subprocess,
18 )18 )
19from lp.codehosting.sshserver.daemon import CodehostingAvatar19from lp.codehosting.sshserver.daemon import CodehostingAvatar
20from lp.codehosting.sshserver.session import (20from lp.codehosting.sshserver.session import (
@@ -382,18 +382,18 @@ class TestSessionIntegration(AvatarTestCase):
382 "ISession(avatar) doesn't adapt to ExecOnlySession. "382 "ISession(avatar) doesn't adapt to ExecOnlySession. "
383 "Got %r instead." % (session,))383 "Got %r instead." % (session,))
384 self.assertEqual(384 self.assertEqual(
385 get_BZR_PLUGIN_PATH_for_subprocess(),385 get_BRZ_PLUGIN_PATH_for_subprocess(),
386 session.environment['BZR_PLUGIN_PATH'])386 session.environment['BRZ_PLUGIN_PATH'])
387 self.assertEqual(387 self.assertEqual(
388 '%s@bazaar.launchpad.test' % self.avatar.username,388 '%s@bazaar.launchpad.test' % self.avatar.username,
389 session.environment['BZR_EMAIL'])389 session.environment['BRZ_EMAIL'])
390390
391 executable, arguments = session.getCommandToRun(391 executable, arguments = session.getCommandToRun(
392 'bzr serve --inet --directory=/ --allow-writes')392 'bzr serve --inet --directory=/ --allow-writes')
393 interpreter = '%s/bin/py' % config.root393 interpreter = '%s/bin/py' % config.root
394 self.assertEqual(interpreter, executable)394 self.assertEqual(interpreter, executable)
395 self.assertEqual(395 self.assertEqual(
396 [interpreter, get_bzr_path(), 'lp-serve',396 [interpreter, get_brz_path(), 'lp-serve',
397 '--inet', str(self.avatar.user_id)],397 '--inet', str(self.avatar.user_id)],
398 list(arguments))398 list(arguments))
399 self.assertRaises(399 self.assertRaises(
@@ -422,9 +422,9 @@ class TestSessionIntegration(AvatarTestCase):
422 'bzr serve --inet --directory=/ --allow-writes')422 'bzr serve --inet --directory=/ --allow-writes')
423 executable, arguments, env = session.getCommandToFork(423 executable, arguments, env = session.getCommandToFork(
424 executable, arguments, session.environment)424 executable, arguments, session.environment)
425 self.assertEqual('bzr', executable)425 self.assertEqual('brz', executable)
426 self.assertEqual(426 self.assertEqual(
427 ['bzr', 'lp-serve',427 ['brz', 'lp-serve',
428 '--inet', str(self.avatar.user_id)],428 '--inet', str(self.avatar.user_id)],
429 list(arguments))429 list(arguments))
430430
@@ -436,7 +436,14 @@ class TestLookupCommand(TestCase):
436436
437 def test_bzr(self):437 def test_bzr(self):
438 self.assertEqual(438 self.assertEqual(
439 config.root + '/bin/py ' + get_bzr_path() +439 config.root + '/bin/py ' + get_brz_path() +
440 ' lp-serve --inet %(user_id)s',440 ' lp-serve --inet %(user_id)s',
441 lookup_command_template(441 lookup_command_template(
442 'bzr serve --inet --directory=/ --allow-writes'))442 'bzr serve --inet --directory=/ --allow-writes'))
443
444 def test_brz(self):
445 self.assertEqual(
446 config.root + '/bin/py ' + get_brz_path() +
447 ' lp-serve --inet %(user_id)s',
448 lookup_command_template(
449 'brz serve --inet --directory=/ --allow-writes'))
diff --git a/lib/lp/codehosting/tests/helpers.py b/lib/lp/codehosting/tests/helpers.py
index e278e53..71d4a52 100644
--- a/lib/lp/codehosting/tests/helpers.py
+++ b/lib/lp/codehosting/tests/helpers.py
@@ -15,10 +15,9 @@ __all__ = [
1515
16import os16import os
1717
18from bzrlib.bzrdir import BzrDir18from breezy.errors import FileExists
19from bzrlib.errors import FileExists19from breezy.plugins.loom import branch as loom_branch
20from bzrlib.plugins.loom import branch as loom_branch20from breezy.tests import (
21from bzrlib.tests import (
22 TestNotApplicable,21 TestNotApplicable,
23 TestSkipped,22 TestSkipped,
24 )23 )
@@ -60,7 +59,7 @@ class LoomTestMixin:
60 loom_branch.loomify(tree.branch)59 loom_branch.loomify(tree.branch)
61 finally:60 finally:
62 tree.unlock()61 tree.unlock()
63 loom_tree = tree.bzrdir.open_workingtree()62 loom_tree = tree.controldir.open_workingtree()
64 loom_tree.lock_write()63 loom_tree.lock_write()
65 loom_tree.branch.new_thread('bottom-thread')64 loom_tree.branch.new_thread('bottom-thread')
66 loom_tree.commit('this is a commit', rev_id='commit-1')65 loom_tree.commit('this is a commit', rev_id='commit-1')
@@ -78,7 +77,7 @@ class LoomTestMixin:
78 loom_branch.loomify(tree.branch)77 loom_branch.loomify(tree.branch)
79 finally:78 finally:
80 tree.unlock()79 tree.unlock()
81 loom_tree = tree.bzrdir.open_workingtree()80 loom_tree = tree.controldir.open_workingtree()
82 loom_tree.lock_write()81 loom_tree.lock_write()
83 loom_tree.branch.new_thread('bottom-thread')82 loom_tree.branch.new_thread('bottom-thread')
84 loom_tree.commit('this is a commit', rev_id='commit-1')83 loom_tree.commit('this is a commit', rev_id='commit-1')
@@ -100,6 +99,9 @@ def make_bazaar_branch_and_tree(db_branch):
10099
101def create_branch_with_one_revision(branch_dir, format=None):100def create_branch_with_one_revision(branch_dir, format=None):
102 """Create a dummy Bazaar branch at the given directory."""101 """Create a dummy Bazaar branch at the given directory."""
102 # XXX cjwatson 2019-06-13: This still uses bzrlib until such time as the
103 # code import workers are ported to Breezy.
104 from bzrlib.bzrdir import BzrDir
103 if not os.path.exists(branch_dir):105 if not os.path.exists(branch_dir):
104 os.makedirs(branch_dir)106 os.makedirs(branch_dir)
105 try:107 try:
@@ -124,7 +126,7 @@ def force_stacked_on_url(branch, url):
124126
125127
126class TestResultWrapper:128class TestResultWrapper:
127 """A wrapper for `TestResult` that knows about bzrlib's `TestSkipped`."""129 """A wrapper for `TestResult` that knows about breezy's `TestSkipped`."""
128130
129 def __init__(self, result):131 def __init__(self, result):
130 self.result = result132 self.result = result
diff --git a/lib/lp/codehosting/tests/servers.py b/lib/lp/codehosting/tests/servers.py
index 99006c0..68c4a73 100644
--- a/lib/lp/codehosting/tests/servers.py
+++ b/lib/lp/codehosting/tests/servers.py
@@ -15,7 +15,7 @@ import os
15import shutil15import shutil
16import tempfile16import tempfile
1717
18from bzrlib.transport import (18from breezy.transport import (
19 get_transport,19 get_transport,
20 Server,20 Server,
21 )21 )
diff --git a/lib/lp/codehosting/tests/test_acceptance.py b/lib/lp/codehosting/tests/test_acceptance.py
index d840ebf..1b4e1bf 100644
--- a/lib/lp/codehosting/tests/test_acceptance.py
+++ b/lib/lp/codehosting/tests/test_acceptance.py
@@ -14,11 +14,11 @@ import time
14import urllib214import urllib2
15import xmlrpclib15import xmlrpclib
1616
17import bzrlib.branch17import breezy.branch
18from bzrlib.tests import TestCaseWithTransport18from breezy.tests import TestCaseWithTransport
19from bzrlib.tests.per_repository import all_repository_format_scenarios19from breezy.tests.per_repository import all_repository_format_scenarios
20from bzrlib.urlutils import local_path_from_url20from breezy.urlutils import local_path_from_url
21from bzrlib.workingtree import WorkingTree21from breezy.workingtree import WorkingTree
22from testscenarios import (22from testscenarios import (
23 load_tests_apply_scenarios,23 load_tests_apply_scenarios,
24 WithScenarios,24 WithScenarios,
@@ -37,8 +37,8 @@ from lp.code.tests.helpers import (
37 get_non_existant_source_package_branch_unique_name,37 get_non_existant_source_package_branch_unique_name,
38 )38 )
39from lp.codehosting import (39from lp.codehosting import (
40 get_bzr_path,40 get_brz_path,
41 get_BZR_PLUGIN_PATH_for_subprocess,41 get_BRZ_PLUGIN_PATH_for_subprocess,
42 )42 )
43from lp.codehosting.bzrutils import DenyingServer43from lp.codehosting.bzrutils import DenyingServer
44from lp.codehosting.tests.helpers import LoomTestMixin44from lp.codehosting.tests.helpers import LoomTestMixin
@@ -64,10 +64,10 @@ class ForkingServerForTests(object):
64 self.socket_path = None64 self.socket_path = None
6565
66 def setUp(self):66 def setUp(self):
67 bzr_path = get_bzr_path()67 brz_path = get_brz_path()
68 BZR_PLUGIN_PATH = get_BZR_PLUGIN_PATH_for_subprocess()68 BRZ_PLUGIN_PATH = get_BRZ_PLUGIN_PATH_for_subprocess()
69 env = os.environ.copy()69 env = os.environ.copy()
70 env['BZR_PLUGIN_PATH'] = BZR_PLUGIN_PATH70 env['BRZ_PLUGIN_PATH'] = BRZ_PLUGIN_PATH
71 # TODO: We probably want to use a random disk path for71 # TODO: We probably want to use a random disk path for
72 # forking_daemon_socket, but we need to update config so that72 # forking_daemon_socket, but we need to update config so that
73 # the CodeHosting service can find it.73 # the CodeHosting service can find it.
@@ -77,7 +77,7 @@ class ForkingServerForTests(object):
77 # settings, we have to somehow pass it a new config-on-disk to77 # settings, we have to somehow pass it a new config-on-disk to
78 # use.78 # use.
79 self.socket_path = config.codehosting.forking_daemon_socket79 self.socket_path = config.codehosting.forking_daemon_socket
80 command = [sys.executable, bzr_path, 'launchpad-forking-service',80 command = [sys.executable, brz_path, 'launchpad-forking-service',
81 '--path', self.socket_path, '-Derror']81 '--path', self.socket_path, '-Derror']
82 process = subprocess.Popen(82 process = subprocess.Popen(
83 command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)83 command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
@@ -110,12 +110,12 @@ class ForkingServerForTests(object):
110 print process.stderr.read()110 print process.stderr.read()
111 print "-" * 70111 print "-" * 70
112 raise RuntimeError(112 raise RuntimeError(
113 'Bzr server did not start correctly. See stdout and stderr '113 'Breezy server did not start correctly. See stdout and '
114 'reported above. Command was "%s". PYTHONPATH was "%s". '114 'stderr reported above. Command was "%s". PYTHONPATH was '
115 'BZR_PLUGIN_PATH was "%s".' %115 '"%s". BRZ_PLUGIN_PATH was "%s".' %
116 (' '.join(command),116 (' '.join(command),
117 env.get('PYTHONPATH'),117 env.get('PYTHONPATH'),
118 env.get('BZR_PLUGIN_PATH')))118 env.get('BRZ_PLUGIN_PATH')))
119119
120 def tearDown(self):120 def tearDown(self):
121 # SIGTERM is the graceful exit request, potentially we could wait a121 # SIGTERM is the graceful exit request, potentially we could wait a
@@ -234,8 +234,8 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
234 """234 """
235 return self.run_bzr_subprocess(235 return self.run_bzr_subprocess(
236 args, env_changes={236 args, env_changes={
237 'BZR_SSH': 'paramiko',237 'BRZ_SSH': 'paramiko',
238 'BZR_PLUGIN_PATH': get_BZR_PLUGIN_PATH_for_subprocess()238 'BRZ_PLUGIN_PATH': get_BRZ_PLUGIN_PATH_for_subprocess()
239 },239 },
240 allow_plugins=True, retcode=retcode)240 allow_plugins=True, retcode=retcode)
241241
@@ -244,7 +244,7 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
244 """244 """
245 output, error = self._run_bzr(args, retcode=3)245 output, error = self._run_bzr(args, retcode=3)
246 for line in error.splitlines():246 for line in error.splitlines():
247 if line.startswith("bzr: ERROR"):247 if line.startswith("brz: ERROR"):
248 return line248 return line
249 raise AssertionError(249 raise AssertionError(
250 "Didn't find error line in output:\n\n%s\n" % error)250 "Didn't find error line in output:\n\n%s\n" % error)
@@ -253,12 +253,12 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
253 """Branch from the given URL to a local directory."""253 """Branch from the given URL to a local directory."""
254 self._run_bzr(['branch', remote_url, local_directory])254 self._run_bzr(['branch', remote_url, local_directory])
255255
256 def get_bzr_path(self):256 def get_brz_path(self):
257 """See `bzrlib.tests.TestCase.get_bzr_path`.257 """See `breezy.tests.TestCase.get_brz_path`.
258258
259 We override this to return the 'bzr' executable from sourcecode.259 We override this to return our own 'brz' executable.
260 """260 """
261 return get_bzr_path()261 return get_brz_path()
262262
263 def push(self, local_directory, remote_url, extra_args=None):263 def push(self, local_directory, remote_url, extra_args=None):
264 """Push the local branch to the given URL."""264 """Push the local branch to the given URL."""
@@ -271,19 +271,19 @@ class SSHTestCase(TestCaseWithTransport, LoomTestMixin, TestCaseWithFactory):
271 """Check that we cannot push from 'local_directory' to 'remote_url'.271 """Check that we cannot push from 'local_directory' to 'remote_url'.
272272
273 In addition, if a list of messages is supplied as the error_messages273 In addition, if a list of messages is supplied as the error_messages
274 argument, check that the bzr client printed one of these messages274 argument, check that the brz client printed one of these messages
275 which shouldn't include the 'bzr: ERROR:' part of the message.275 which shouldn't include the 'brz: ERROR:' part of the message.
276276
277 :return: The last line of the stderr from the subprocess, which will277 :return: The last line of the stderr from the subprocess, which will
278 be the 'bzr: ERROR: <repr of Exception>' line.278 be the 'brz: ERROR: <repr of Exception>' line.
279 """279 """
280 error_line = self._run_bzr_error(280 error_line = self._run_bzr_error(
281 ['push', '-d', local_directory, remote_url])281 ['push', '-d', local_directory, remote_url])
282 # This will be the will be the 'bzr: ERROR: <repr of Exception>' line.282 # This will be the 'brz: ERROR: <repr of Exception>' line.
283 if not error_messages:283 if not error_messages:
284 return error_line284 return error_line
285 for msg in error_messages:285 for msg in error_messages:
286 if error_line.startswith('bzr: ERROR: ' + msg):286 if error_line.startswith('brz: ERROR: ' + msg):
287 return error_line287 return error_line
288 self.fail(288 self.fail(
289 "Error message %r didn't match any of those supplied."289 "Error message %r didn't match any of those supplied."
@@ -340,11 +340,11 @@ class SmokeTest(WithScenarios, SSHTestCase):
340 """Smoke test for repository support."""340 """Smoke test for repository support."""
341341
342 excluded_scenarios = [342 excluded_scenarios = [
343 # RepositoryFormat4 is not initializable (bzrlib raises TestSkipped343 # RepositoryFormat4 is not initializable (breezy raises TestSkipped
344 # when you try).344 # when you try).
345 'RepositoryFormat4',345 'RepositoryFormat4',
346 # Fetching weave formats from the smart server is known to be broken.346 # Fetching weave formats from the smart server is known to be broken.
347 # See bug 173807 and bzrlib.tests.test_repository.347 # See bug 173807 and breezy.tests.test_repository.
348 'RepositoryFormat5',348 'RepositoryFormat5',
349 'RepositoryFormat6',349 'RepositoryFormat6',
350 'RepositoryFormat7',350 'RepositoryFormat7',
@@ -364,14 +364,14 @@ class SmokeTest(WithScenarios, SSHTestCase):
364 self.second_tree = 'second'364 self.second_tree = 'second'
365365
366 def make_branch_specifying_repo_format(self, relpath, repo_format):366 def make_branch_specifying_repo_format(self, relpath, repo_format):
367 bd = self.make_bzrdir(relpath, format=self.bzrdir_format)367 bd = self.make_controldir(relpath, format=self.bzrdir_format)
368 repo_format.initialize(bd)368 repo_format.initialize(bd)
369 return bd.create_branch()369 return bd.create_branch()
370370
371 def make_branch_and_tree(self, relpath):371 def make_branch_and_tree(self, relpath):
372 b = self.make_branch_specifying_repo_format(372 b = self.make_branch_specifying_repo_format(
373 relpath, self.repository_format)373 relpath, self.repository_format)
374 return b.bzrdir.create_workingtree()374 return b.controldir.create_workingtree()
375375
376 def test_smoke(self):376 def test_smoke(self):
377 # Make a new branch377 # Make a new branch
@@ -411,7 +411,7 @@ class AcceptanceTests(WithScenarios, SSHTestCase):
411 error_line = self._run_bzr_error(411 error_line = self._run_bzr_error(
412 ['cat-revision', '-r', 'branch:' + url])412 ['cat-revision', '-r', 'branch:' + url])
413 self.assertTrue(413 self.assertTrue(
414 error_line.startswith('bzr: ERROR: Not a branch:'),414 error_line.startswith('brz: ERROR: Not a branch:'),
415 'Expected "Not a branch", found %r' % error_line)415 'Expected "Not a branch", found %r' % error_line)
416416
417 def makeDatabaseBranch(self, owner_name, product_name, branch_name,417 def makeDatabaseBranch(self, owner_name, product_name, branch_name,
@@ -693,7 +693,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
693 # We can get information from a read-only branch.693 # We can get information from a read-only branch.
694 ro_branch_url = self.createBazaarBranch(694 ro_branch_url = self.createBazaarBranch(
695 'mark', '+junk', 'ro-branch')695 'mark', '+junk', 'ro-branch')
696 revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()696 revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
697 remote_revision = self.getLastRevision(697 remote_revision = self.getLastRevision(
698 self.getTransportURL('~mark/+junk/ro-branch'))698 self.getTransportURL('~mark/+junk/ro-branch'))
699 self.assertEqual(revision, remote_revision)699 self.assertEqual(revision, remote_revision)
@@ -715,7 +715,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
715 # Added to catch bug 126245.715 # Added to catch bug 126245.
716 ro_branch_url = self.makeMirroredBranch(716 ro_branch_url = self.makeMirroredBranch(
717 'testuser', 'firefox', 'mirror')717 'testuser', 'firefox', 'mirror')
718 revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()718 revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
719 remote_revision = self.getLastRevision(719 remote_revision = self.getLastRevision(
720 self.getTransportURL('~testuser/firefox/mirror'))720 self.getTransportURL('~testuser/firefox/mirror'))
721 self.assertEqual(revision, remote_revision)721 self.assertEqual(revision, remote_revision)
@@ -724,7 +724,7 @@ class SmartserverTests(WithScenarios, SSHTestCase):
724 # Users should be able to read mirrored branches even if they don't724 # Users should be able to read mirrored branches even if they don't
725 # own those branches.725 # own those branches.
726 ro_branch_url = self.makeMirroredBranch('mark', 'firefox', 'mirror')726 ro_branch_url = self.makeMirroredBranch('mark', 'firefox', 'mirror')
727 revision = bzrlib.branch.Branch.open(ro_branch_url).last_revision()727 revision = breezy.branch.Branch.open(ro_branch_url).last_revision()
728 remote_revision = self.getLastRevision(728 remote_revision = self.getLastRevision(
729 self.getTransportURL('~mark/firefox/mirror'))729 self.getTransportURL('~mark/firefox/mirror'))
730 self.assertEqual(revision, remote_revision)730 self.assertEqual(revision, remote_revision)
diff --git a/lib/lp/codehosting/tests/test_bzrlib.py b/lib/lp/codehosting/tests/test_breezy.py
731similarity index 58%731similarity index 58%
732rename from lib/lp/codehosting/tests/test_bzrlib.py732rename from lib/lp/codehosting/tests/test_bzrlib.py
733rename to lib/lp/codehosting/tests/test_breezy.py733rename to lib/lp/codehosting/tests/test_breezy.py
index 35f44aa..c9cf83d 100644
--- a/lib/lp/codehosting/tests/test_bzrlib.py
+++ b/lib/lp/codehosting/tests/test_breezy.py
@@ -1,17 +1,17 @@
1# Copyright 2009 Canonical Ltd. This software is licensed under the1# Copyright 2009 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Launchpad specific tests of bzrlib behaviour."""4"""Launchpad-specific tests of Breezy behaviour."""
55
6__metaclass__ = type6__metaclass__ = type
77
8from lp.testing import TestCase8from lp.testing import TestCase
99
1010
11class TestBzrlib(TestCase):11class TestBreezy(TestCase):
12 def test_has_cextensions(self):12 def test_has_cextensions(self):
13 """Ensure Bazaar C extensions are being used."""13 """Ensure Breezy C extensions are being used."""
14 try:14 try:
15 import bzrlib._dirstate_helpers_pyx15 import breezy.bzr._dirstate_helpers_pyx
16 except ImportError:16 except ImportError:
17 self.fail("Bzr not built with C extensions.")17 self.fail("Breezy not built with C extensions.")
diff --git a/lib/lp/codehosting/tests/test_bzrutils.py b/lib/lp/codehosting/tests/test_bzrutils.py
index e05c14d..a78d35f 100644
--- a/lib/lp/codehosting/tests/test_bzrutils.py
+++ b/lib/lp/codehosting/tests/test_bzrutils.py
@@ -8,20 +8,23 @@ __metaclass__ = type
8import gc8import gc
9import sys9import sys
1010
11from bzrlib import (11from breezy import (
12 errors,12 errors,
13 trace,13 trace,
14 )14 )
15from bzrlib.branch import Branch15from breezy.branch import (
16from bzrlib.bzrdir import format_registry16 Branch,
17from bzrlib.errors import AppendRevisionsOnlyViolation17 UnstackableBranchFormat,
18from bzrlib.remote import RemoteBranch18 )
19from bzrlib.tests import (19from breezy.bzr.remote import RemoteBranch
20from breezy.controldir import format_registry
21from breezy.errors import AppendRevisionsOnlyViolation
22from breezy.tests import (
20 test_server,23 test_server,
21 TestCaseWithTransport,24 TestCaseWithTransport,
22 TestNotApplicable,25 TestNotApplicable,
23 )26 )
24from bzrlib.tests.per_branch import (27from breezy.tests.per_branch import (
25 branch_scenarios,28 branch_scenarios,
26 TestCaseWithControlDir,29 TestCaseWithControlDir,
27 )30 )
@@ -80,14 +83,14 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
80 stacked_branch = self.make_branch('stacked')83 stacked_branch = self.make_branch('stacked')
81 try:84 try:
82 stacked_branch.set_stacked_on_url('../stacked-on')85 stacked_branch.set_stacked_on_url('../stacked-on')
83 except errors.UnstackableBranchFormat:86 except UnstackableBranchFormat:
84 raise TestNotApplicable('This format does not support stacking.')87 raise TestNotApplicable('This format does not support stacking.')
85 # Deleting the stacked-on branch ensures that Bazaar will raise an88 # Deleting the stacked-on branch ensures that Bazaar will raise an
86 # error if it tries to open the stacked-on branch.89 # error if it tries to open the stacked-on branch.
87 self.get_transport('.').delete_tree('stacked-on')90 self.get_transport('.').delete_tree('stacked-on')
88 self.assertEqual(91 self.assertEqual(
89 '../stacked-on',92 '../stacked-on',
90 get_branch_stacked_on_url(stacked_branch.bzrdir))93 get_branch_stacked_on_url(stacked_branch.controldir))
9194
92 def testGetBranchStackedOnUrlUnstackable(self):95 def testGetBranchStackedOnUrlUnstackable(self):
93 # get_branch_stacked_on_url raises UnstackableBranchFormat if it's96 # get_branch_stacked_on_url raises UnstackableBranchFormat if it's
@@ -97,11 +100,11 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
97 branch.get_stacked_on_url()100 branch.get_stacked_on_url()
98 except errors.NotStacked:101 except errors.NotStacked:
99 raise TestNotApplicable('This format supports stacked branches.')102 raise TestNotApplicable('This format supports stacked branches.')
100 except errors.UnstackableBranchFormat:103 except UnstackableBranchFormat:
101 pass104 pass
102 self.assertRaises(105 self.assertRaises(
103 errors.UnstackableBranchFormat,106 UnstackableBranchFormat,
104 get_branch_stacked_on_url, branch.bzrdir)107 get_branch_stacked_on_url, branch.controldir)
105108
106 def testGetBranchStackedOnUrlNotStacked(self):109 def testGetBranchStackedOnUrlNotStacked(self):
107 # get_branch_stacked_on_url raises NotStacked if it's called on the110 # get_branch_stacked_on_url raises NotStacked if it's called on the
@@ -111,16 +114,16 @@ class TestGetBranchStackedOnURL(WithScenarios, TestCaseWithControlDir):
111 branch.get_stacked_on_url()114 branch.get_stacked_on_url()
112 except errors.NotStacked:115 except errors.NotStacked:
113 pass116 pass
114 except errors.UnstackableBranchFormat:117 except UnstackableBranchFormat:
115 raise TestNotApplicable(118 raise TestNotApplicable(
116 'This format does not support stacked branches')119 'This format does not support stacked branches')
117 self.assertRaises(120 self.assertRaises(
118 errors.NotStacked, get_branch_stacked_on_url, branch.bzrdir)121 errors.NotStacked, get_branch_stacked_on_url, branch.controldir)
119122
120 def testGetBranchStackedOnUrlNoBranch(self):123 def testGetBranchStackedOnUrlNoBranch(self):
121 # get_branch_stacked_on_url raises a NotBranchError if it's called on124 # get_branch_stacked_on_url raises a NotBranchError if it's called on
122 # a bzrdir that's not got a branch.125 # a bzrdir that's not got a branch.
123 a_bzrdir = self.make_bzrdir('source')126 a_bzrdir = self.make_controldir('source')
124 if a_bzrdir.has_branch():127 if a_bzrdir.has_branch():
125 raise TestNotApplicable(128 raise TestNotApplicable(
126 'This format does not support branchless bzrdirs.')129 'This format does not support branchless bzrdirs.')
diff --git a/lib/lp/codehosting/tests/test_format_comparison.py b/lib/lp/codehosting/tests/test_format_comparison.py
index 0346af7..de06e64 100644
--- a/lib/lp/codehosting/tests/test_format_comparison.py
+++ b/lib/lp/codehosting/tests/test_format_comparison.py
@@ -45,7 +45,7 @@ class StubObjectWithFormat:
45class StubBranch:45class StubBranch:
46 """A stub branch object that just has formats."""46 """A stub branch object that just has formats."""
47 def __init__(self, bzrdir_format, repo_format, branch_format):47 def __init__(self, bzrdir_format, repo_format, branch_format):
48 self.bzrdir = StubObjectWithFormat(bzrdir_format)48 self.controldir = StubObjectWithFormat(bzrdir_format)
49 self.repository = StubObjectWithFormat(repo_format)49 self.repository = StubObjectWithFormat(repo_format)
50 self._format = branch_format50 self._format = branch_format
5151
diff --git a/lib/lp/codehosting/tests/test_lpserve.py b/lib/lp/codehosting/tests/test_lpserve.py
index 2655e7e..81294cc 100644
--- a/lib/lp/codehosting/tests/test_lpserve.py
+++ b/lib/lp/codehosting/tests/test_lpserve.py
@@ -5,10 +5,10 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib import errors8from breezy import errors
9from bzrlib.plugins.lpserve.test_lpserve import TestCaseWithSubprocess9from breezy.bzr.smart import medium
10from bzrlib.smart import medium10from breezy.plugins.lpserve.test_lpserve import TestCaseWithSubprocess
11from bzrlib.transport import remote11from breezy.transport import remote
1212
13from lp.testing.fixture import CaptureOops13from lp.testing.fixture import CaptureOops
14from lp.testing.layers import LaunchpadLayer14from lp.testing.layers import LaunchpadLayer
@@ -112,8 +112,8 @@ class TestLaunchpadServe(TestCaseWithSubprocess):
112112
113113
114def test_suite():114def test_suite():
115 from bzrlib import tests115 from breezy import tests
116 from bzrlib.plugins import lpserve116 from breezy.plugins import lpserve
117117
118 loader = tests.TestLoader()118 loader = tests.TestLoader()
119 suite = loader.loadTestsFromName(__name__)119 suite = loader.loadTestsFromName(__name__)
diff --git a/lib/lp/codehosting/tests/test_sftp.py b/lib/lp/codehosting/tests/test_sftp.py
index 7539dd6..3ea1309 100644
--- a/lib/lp/codehosting/tests/test_sftp.py
+++ b/lib/lp/codehosting/tests/test_sftp.py
@@ -6,13 +6,13 @@
6from contextlib import closing6from contextlib import closing
7import os7import os
88
9from bzrlib import (9from breezy import (
10 errors as bzr_errors,10 errors as bzr_errors,
11 urlutils,11 urlutils,
12 )12 )
13from bzrlib.tests import TestCaseInTempDir13from breezy.tests import TestCaseInTempDir
14from bzrlib.transport import get_transport14from breezy.transport import get_transport
15from bzrlib.transport.memory import MemoryTransport15from breezy.transport.memory import MemoryTransport
16from lazr.sshserver.sftp import FileIsADirectory16from lazr.sshserver.sftp import FileIsADirectory
17from testtools.twistedsupport import (17from testtools.twistedsupport import (
18 assert_fails_with,18 assert_fails_with,
@@ -70,7 +70,7 @@ class TestFatLocalTransport(TestCaseInTempDir):
70 def test_writeChunk(self):70 def test_writeChunk(self):
71 # writeChunk writes a chunk of data to a file at a given offset.71 # writeChunk writes a chunk of data to a file at a given offset.
72 filename = 'foo'72 filename = 'foo'
73 self.transport.put_bytes(filename, 'content')73 self.transport.put_bytes(filename, b'content')
74 self.transport.writeChunk(filename, 1, 'razy')74 self.transport.writeChunk(filename, 1, 'razy')
75 self.assertEqual('crazynt', self.transport.get_bytes(filename))75 self.assertEqual('crazynt', self.transport.get_bytes(filename))
7676
@@ -612,7 +612,7 @@ class TestSFTPServer(TestCaseInTempDir, SFTPTestMixin):
612 def test_openDirectoryMemory(self):612 def test_openDirectoryMemory(self):
613 """openDirectory works on MemoryTransport."""613 """openDirectory works on MemoryTransport."""
614 transport = MemoryTransport()614 transport = MemoryTransport()
615 transport.put_bytes('hello', 'hello')615 transport.put_bytes('hello', b'hello')
616 sftp_server = TransportSFTPServer(AsyncTransport(transport))616 sftp_server = TransportSFTPServer(AsyncTransport(transport))
617 deferred = sftp_server.openDirectory('.')617 deferred = sftp_server.openDirectory('.')
618618
diff --git a/lib/lp/codehosting/tests/test_upgrade.py b/lib/lp/codehosting/tests/test_upgrade.py
index 8d53d28..3326d16 100644
--- a/lib/lp/codehosting/tests/test_upgrade.py
+++ b/lib/lp/codehosting/tests/test_upgrade.py
@@ -7,18 +7,16 @@ __metaclass__ = type
7import logging7import logging
8from os.path import dirname8from os.path import dirname
99
10from bzrlib.branch import Branch10from breezy.branch import Branch
11from bzrlib.bzrdir import (11from breezy.bzr.bzrdir import BzrDir
12 BzrDir,12from breezy.bzr.groupcompress_repo import (
13 format_registry,
14 )
15from bzrlib.plugins.loom.branch import loomify
16from bzrlib.repofmt.groupcompress_repo import (
17 RepositoryFormat2a,13 RepositoryFormat2a,
18 RepositoryFormat2aSubtree,14 RepositoryFormat2aSubtree,
19 )15 )
20from bzrlib.revision import NULL_REVISION16from breezy.controldir import format_registry
21from bzrlib.transport import get_transport17from breezy.plugins.loom.branch import loomify
18from breezy.revision import NULL_REVISION
19from breezy.transport import get_transport
22from fixtures import TempDir20from fixtures import TempDir
2321
24from lp.code.bzr import (22from lp.code.bzr import (
@@ -51,7 +49,7 @@ class TestUpgrader(TestCaseWithFactory):
51 'foo', rev_id='prepare-commit', committer='jrandom@example.com')49 'foo', rev_id='prepare-commit', committer='jrandom@example.com')
52 if loomify_branch:50 if loomify_branch:
53 loomify(tree.branch)51 loomify(tree.branch)
54 bzr_branch = tree.bzrdir.open_branch()52 bzr_branch = tree.controldir.open_branch()
55 else:53 else:
56 bzr_branch = tree.branch54 bzr_branch = tree.branch
57 return self.getUpgrader(bzr_branch, branch)55 return self.getUpgrader(bzr_branch, branch)
@@ -76,8 +74,8 @@ class TestUpgrader(TestCaseWithFactory):
76 :param tree: A Bazaar WorkingTree to add a tree to.74 :param tree: A Bazaar WorkingTree to add a tree to.
77 """75 """
78 sub_branch = BzrDir.create_branch_convenience(76 sub_branch = BzrDir.create_branch_convenience(
79 tree.bzrdir.root_transport.clone('sub').base)77 tree.controldir.root_transport.clone('sub').base)
80 tree.add_reference(sub_branch.bzrdir.open_workingtree())78 tree.add_reference(sub_branch.controldir.open_workingtree())
81 tree.commit('added tree reference', committer='jrandom@example.com')79 tree.commit('added tree reference', committer='jrandom@example.com')
8280
83 def check_branch(self, upgraded, branch_format=BranchFormat.BZR_BRANCH_7,81 def check_branch(self, upgraded, branch_format=BranchFormat.BZR_BRANCH_7,
@@ -128,7 +126,7 @@ class TestUpgrader(TestCaseWithFactory):
128 def test_subtree_format_repo_format(self):126 def test_subtree_format_repo_format(self):
129 """Even subtree formats use 2a if they don't have tree references."""127 """Even subtree formats use 2a if they don't have tree references."""
130 self.useBzrBranches(direct_database=True)128 self.useBzrBranches(direct_database=True)
131 format = format_registry.make_bzrdir('pack-0.92-subtree')129 format = format_registry.make_controldir('pack-0.92-subtree')
132 branch, tree = self.create_branch_and_tree(format=format)130 branch, tree = self.create_branch_and_tree(format=format)
133 upgrader = self.getUpgrader(tree.branch, branch)131 upgrader = self.getUpgrader(tree.branch, branch)
134 with read_locked(upgrader.bzr_branch):132 with read_locked(upgrader.bzr_branch):
@@ -139,7 +137,7 @@ class TestUpgrader(TestCaseWithFactory):
139 def test_tree_reference_repo_format(self):137 def test_tree_reference_repo_format(self):
140 """Repos with tree references get 2aSubtree."""138 """Repos with tree references get 2aSubtree."""
141 self.useBzrBranches(direct_database=True)139 self.useBzrBranches(direct_database=True)
142 format = format_registry.make_bzrdir('pack-0.92-subtree')140 format = format_registry.make_controldir('pack-0.92-subtree')
143 branch, tree = self.create_branch_and_tree(format=format)141 branch, tree = self.create_branch_and_tree(format=format)
144 upgrader = self.getUpgrader(tree.branch, branch)142 upgrader = self.getUpgrader(tree.branch, branch)
145 self.addTreeReference(tree)143 self.addTreeReference(tree)
@@ -186,7 +184,7 @@ class TestUpgrader(TestCaseWithFactory):
186 def test_has_tree_references(self):184 def test_has_tree_references(self):
187 """Detects whether repo contains actual tree references."""185 """Detects whether repo contains actual tree references."""
188 self.useBzrBranches(direct_database=True)186 self.useBzrBranches(direct_database=True)
189 format = format_registry.make_bzrdir('pack-0.92-subtree')187 format = format_registry.make_controldir('pack-0.92-subtree')
190 branch, tree = self.create_branch_and_tree(format=format)188 branch, tree = self.create_branch_and_tree(format=format)
191 upgrader = self.getUpgrader(tree.branch, branch)189 upgrader = self.getUpgrader(tree.branch, branch)
192 with read_locked(tree.branch.repository):190 with read_locked(tree.branch.repository):
@@ -198,11 +196,11 @@ class TestUpgrader(TestCaseWithFactory):
198 def test_use_subtree_format_for_tree_references(self):196 def test_use_subtree_format_for_tree_references(self):
199 """Subtree references cause RepositoryFormat2aSubtree to be used."""197 """Subtree references cause RepositoryFormat2aSubtree to be used."""
200 self.useBzrBranches(direct_database=True)198 self.useBzrBranches(direct_database=True)
201 format = format_registry.make_bzrdir('pack-0.92-subtree')199 format = format_registry.make_controldir('pack-0.92-subtree')
202 branch, tree = self.create_branch_and_tree(format=format)200 branch, tree = self.create_branch_and_tree(format=format)
203 sub_branch = BzrDir.create_branch_convenience(201 sub_branch = BzrDir.create_branch_convenience(
204 tree.bzrdir.root_transport.clone('sub').base, format=format)202 tree.controldir.root_transport.clone('sub').base, format=format)
205 tree.add_reference(sub_branch.bzrdir.open_workingtree())203 tree.add_reference(sub_branch.controldir.open_workingtree())
206 tree.commit('added tree reference', committer='jrandom@example.org')204 tree.commit('added tree reference', committer='jrandom@example.org')
207 upgrader = self.getUpgrader(tree.branch, branch)205 upgrader = self.getUpgrader(tree.branch, branch)
208 with read_locked(tree.branch):206 with read_locked(tree.branch):
diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py
index 43e592f..2159871 100755
--- a/lib/lp/codehosting/upgrade.py
+++ b/lib/lp/codehosting/upgrade.py
@@ -18,18 +18,16 @@ import os
18from shutil import rmtree18from shutil import rmtree
19from tempfile import mkdtemp19from tempfile import mkdtemp
2020
21from bzrlib.bzrdir import (21from breezy.bzr.bzrdir import BzrDir
22 BzrDir,22from breezy.bzr.groupcompress_repo import RepositoryFormat2aSubtree
23 format_registry,23from breezy.controldir import format_registry
24 )24from breezy.errors import UpToDateFormat
25from bzrlib.errors import UpToDateFormat25from breezy.plugins.loom import (
26from bzrlib.plugins.loom import (
27 NotALoom,26 NotALoom,
28 require_loom_branch,27 require_loom_branch,
29 )28 )
30from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2aSubtree29from breezy.upgrade import upgrade
31from bzrlib.upgrade import upgrade30from breezy.url_policy_open import (
32from bzrlib.url_policy_open import (
33 BranchOpener,31 BranchOpener,
34 SingleSchemePolicy,32 SingleSchemePolicy,
35 )33 )
@@ -75,7 +73,7 @@ class Upgrader:
75 :param branch: The bzr branch to upgrade73 :param branch: The bzr branch to upgrade
76 :return: A Metadir format instance.74 :return: A Metadir format instance.
77 """75 """
78 format = format_registry.make_bzrdir('2a')76 format = format_registry.make_controldir('2a')
79 try:77 try:
80 require_loom_branch(self.bzr_branch)78 require_loom_branch(self.bzr_branch)
81 except NotALoom:79 except NotALoom:
@@ -205,5 +203,5 @@ class Upgrader:
205 def mirror_branch(self, bzr_branch, target_bd):203 def mirror_branch(self, bzr_branch, target_bd):
206 """Mirror the actual branch from a bzr_branch to a target bzrdir."""204 """Mirror the actual branch from a bzr_branch to a target bzrdir."""
207 target = target_bd.get_branch_transport(bzr_branch._format)205 target = target_bd.get_branch_transport(bzr_branch._format)
208 source = bzr_branch.bzrdir.get_branch_transport(bzr_branch._format)206 source = bzr_branch.controldir.get_branch_transport(bzr_branch._format)
209 source.copy_tree_to_transport(target)207 source.copy_tree_to_transport(target)
diff --git a/lib/lp/codehosting/vfs/branchfs.py b/lib/lp/codehosting/vfs/branchfs.py
index a928855..92d4b3f 100644
--- a/lib/lp/codehosting/vfs/branchfs.py
+++ b/lib/lp/codehosting/vfs/branchfs.py
@@ -29,7 +29,7 @@ the `IBranchFileSystem` interface and passing what that returns to a
29`ITransportDispatch` object.29`ITransportDispatch` object.
3030
31We hook the `LaunchpadServer` into Bazaar by implementing a31We hook the `LaunchpadServer` into Bazaar by implementing a
32`AsyncVirtualTransport`, a `bzrlib.transport.Transport` that wraps all of its32`AsyncVirtualTransport`, a `breezy.transport.Transport` that wraps all of its
33operations so that they are translated by an object that implements33operations so that they are translated by an object that implements
34`translateVirtualPath`. See transport.py for more information.34`translateVirtualPath`. See transport.py for more information.
3535
@@ -58,20 +58,18 @@ import os.path
58import sys58import sys
59import xmlrpclib59import xmlrpclib
6060
61from bzrlib import urlutils61from breezy import urlutils
62from bzrlib.bzrdir import (62from breezy.bzr.bzrdir import BzrDir
63 BzrDir,63from breezy.bzr.smart.request import jail_info
64 BzrDirFormat,64from breezy.config import TransportConfig
65 )65from breezy.controldir import ControlDirFormat
66from bzrlib.config import TransportConfig66from breezy.errors import (
67from bzrlib.errors import (
68 NoSuchFile,67 NoSuchFile,
69 PermissionDenied,68 PermissionDenied,
70 TransportNotPossible,69 TransportNotPossible,
71 )70 )
72from bzrlib.smart.request import jail_info71from breezy.transport import get_transport
73from bzrlib.transport import get_transport72from breezy.transport.memory import MemoryServer
74from bzrlib.transport.memory import MemoryServer
75from lazr.uri import URI73from lazr.uri import URI
76import six74import six
77from twisted.internet import (75from twisted.internet import (
@@ -224,7 +222,7 @@ class ITransportDispatch(Interface):
224222
225 :return: A transport and a path on that transport that point to a223 :return: A transport and a path on that transport that point to a
226 place that matches the one described in transport_tuple.224 place that matches the one described in transport_tuple.
227 :rtype: (`bzrlib.transport.Transport`, str)225 :rtype: (`breezy.transport.Transport`, str)
228 """226 """
229227
230228
@@ -333,7 +331,7 @@ class TransportDispatch:
333 transport = get_transport(memory_server.get_url())331 transport = get_transport(memory_server.get_url())
334 if default_stack_on == '':332 if default_stack_on == '':
335 return transport333 return transport
336 format = BzrDirFormat.get_default_format()334 format = ControlDirFormat.get_default_format()
337 bzrdir = format.initialize_on_transport(transport)335 bzrdir = format.initialize_on_transport(transport)
338 bzrdir.get_config().set_default_stack_on(336 bzrdir.get_config().set_default_stack_on(
339 urlutils.unescape(default_stack_on))337 urlutils.unescape(default_stack_on))
diff --git a/lib/lp/codehosting/vfs/tests/test_branchfs.py b/lib/lp/codehosting/vfs/tests/test_branchfs.py
index 30c08d4..eba8732 100644
--- a/lib/lp/codehosting/vfs/tests/test_branchfs.py
+++ b/lib/lp/codehosting/vfs/tests/test_branchfs.py
@@ -12,29 +12,27 @@ from StringIO import StringIO
12import sys12import sys
13import xmlrpclib13import xmlrpclib
1414
15from bzrlib import errors15from breezy import errors
16from bzrlib.bzrdir import (16from breezy.bzr.bzrdir import BzrDir
17 BzrDir,17from breezy.controldir import format_registry
18 format_registry,18from breezy.tests import (
19 )
20from bzrlib.tests import (
21 TestCase as BzrTestCase,19 TestCase as BzrTestCase,
22 TestCaseInTempDir,20 TestCaseInTempDir,
23 TestCaseWithTransport,21 TestCaseWithTransport,
24 )22 )
25from bzrlib.transport import (23from breezy.transport import (
26 _get_protocol_handlers,24 _get_protocol_handlers,
27 get_transport,25 get_transport,
28 register_transport,26 register_transport,
29 Server,27 Server,
30 unregister_transport,28 unregister_transport,
31 )29 )
32from bzrlib.transport.chroot import ChrootTransport30from breezy.transport.chroot import ChrootTransport
33from bzrlib.transport.memory import (31from breezy.transport.memory import (
34 MemoryServer,32 MemoryServer,
35 MemoryTransport,33 MemoryTransport,
36 )34 )
37from bzrlib.urlutils import (35from breezy.urlutils import (
38 escape,36 escape,
39 local_path_to_url,37 local_path_to_url,
40 )38 )
@@ -142,7 +140,7 @@ class TestTransportDispatch(TestCase):
142 default_stack_on='/~foo/bar/baz')140 default_stack_on='/~foo/bar/baz')
143 self.assertRaises(141 self.assertRaises(
144 errors.TransportNotPossible,142 errors.TransportNotPossible,
145 transport.put_bytes, '.bzr/control.conf', 'data')143 transport.put_bytes, '.bzr/control.conf', b'data')
146144
147 def test_control_conf_with_stacking(self):145 def test_control_conf_with_stacking(self):
148 transport = self.factory._makeControlTransport(146 transport = self.factory._makeControlTransport(
@@ -159,7 +157,7 @@ class TestTransportDispatch(TestCase):
159 transport = self.factory._makeBranchTransport(id=5, writable=False)157 transport = self.factory._makeBranchTransport(id=5, writable=False)
160 self.assertRaises(158 self.assertRaises(
161 errors.TransportNotPossible, transport.put_bytes,159 errors.TransportNotPossible, transport.put_bytes,
162 '.bzr/README', 'data')160 '.bzr/README', b'data')
163161
164 def test_writable_implies_writable(self):162 def test_writable_implies_writable(self):
165 transport = self.factory._makeBranchTransport(id=5, writable=True)163 transport = self.factory._makeBranchTransport(id=5, writable=True)
@@ -559,7 +557,7 @@ class LaunchpadTransportTests:
559 transport.put_bytes,557 transport.put_bytes,
560 '~%s/%s/.bzr/control.conf' % (558 '~%s/%s/.bzr/control.conf' % (
561 branch.owner.name, branch.product.name),559 branch.owner.name, branch.product.name),
562 'hello nurse!')560 b'hello nurse!')
563561
564 def _makeOnBackingTransport(self, branch):562 def _makeOnBackingTransport(self, branch):
565 """Make directories for 'branch' on the backing transport.563 """Make directories for 'branch' on the backing transport.
@@ -578,7 +576,7 @@ class LaunchpadTransportTests:
578 branch = self.factory.makeAnyBranch(576 branch = self.factory.makeAnyBranch(
579 branch_type=BranchType.HOSTED, owner=self.requester)577 branch_type=BranchType.HOSTED, owner=self.requester)
580 backing_transport = self._makeOnBackingTransport(branch)578 backing_transport = self._makeOnBackingTransport(branch)
581 backing_transport.put_bytes('hello.txt', 'Hello World!')579 backing_transport.put_bytes('hello.txt', b'Hello World!')
582 deferred = self._ensureDeferred(580 deferred = self._ensureDeferred(
583 transport.get_bytes, '%s/.bzr/hello.txt' % branch.unique_name)581 transport.get_bytes, '%s/.bzr/hello.txt' % branch.unique_name)
584 return deferred.addCallback(self.assertEqual, 'Hello World!')582 return deferred.addCallback(self.assertEqual, 'Hello World!')
@@ -589,7 +587,7 @@ class LaunchpadTransportTests:
589 branch = self.factory.makeAnyBranch(587 branch = self.factory.makeAnyBranch(
590 branch_type=BranchType.HOSTED, owner=self.requester)588 branch_type=BranchType.HOSTED, owner=self.requester)
591 backing_transport = self._makeOnBackingTransport(branch)589 backing_transport = self._makeOnBackingTransport(branch)
592 backing_transport.put_bytes('hello.txt', 'Hello World!')590 backing_transport.put_bytes('hello.txt', b'Hello World!')
593 url = escape('%s/.bzr/hello.txt' % branch.unique_name)591 url = escape('%s/.bzr/hello.txt' % branch.unique_name)
594 transport = self.getTransport()592 transport = self.getTransport()
595 deferred = self._ensureDeferred(transport.get_bytes, url)593 deferred = self._ensureDeferred(transport.get_bytes, url)
@@ -601,7 +599,7 @@ class LaunchpadTransportTests:
601 branch = self.factory.makeAnyBranch(599 branch = self.factory.makeAnyBranch(
602 branch_type=BranchType.HOSTED, owner=self.requester)600 branch_type=BranchType.HOSTED, owner=self.requester)
603 backing_transport = self._makeOnBackingTransport(branch)601 backing_transport = self._makeOnBackingTransport(branch)
604 data = 'Hello World!'602 data = b'Hello World!'
605 backing_transport.put_bytes('hello.txt', data)603 backing_transport.put_bytes('hello.txt', data)
606 transport = self.getTransport()604 transport = self.getTransport()
607 deferred = self._ensureDeferred(605 deferred = self._ensureDeferred(
@@ -622,7 +620,7 @@ class LaunchpadTransportTests:
622 backing_transport = self._makeOnBackingTransport(branch)620 backing_transport = self._makeOnBackingTransport(branch)
623 deferred = self._ensureDeferred(621 deferred = self._ensureDeferred(
624 transport.put_bytes,622 transport.put_bytes,
625 '%s/.bzr/goodbye.txt' % branch.unique_name, "Goodbye")623 '%s/.bzr/goodbye.txt' % branch.unique_name, b"Goodbye")
626624
627 def check_bytes_written(ignored):625 def check_bytes_written(ignored):
628 self.assertEqual(626 self.assertEqual(
@@ -659,7 +657,7 @@ class LaunchpadTransportTests:
659 branch = self.factory.makeAnyBranch(657 branch = self.factory.makeAnyBranch(
660 branch_type=BranchType.HOSTED, owner=self.requester)658 branch_type=BranchType.HOSTED, owner=self.requester)
661 backing_transport = self._makeOnBackingTransport(branch)659 backing_transport = self._makeOnBackingTransport(branch)
662 backing_transport.put_bytes('hello.txt', 'Hello World!')660 backing_transport.put_bytes('hello.txt', b'Hello World!')
663 transport = transport.clone('~%s' % branch.owner.name)661 transport = transport.clone('~%s' % branch.owner.name)
664 deferred = self._ensureDeferred(662 deferred = self._ensureDeferred(
665 transport.get_bytes,663 transport.get_bytes,
@@ -696,7 +694,7 @@ class LaunchpadTransportTests:
696 branch = self.factory.makeAnyBranch(694 branch = self.factory.makeAnyBranch(
697 branch_type=BranchType.HOSTED, owner=self.requester)695 branch_type=BranchType.HOSTED, owner=self.requester)
698 backing_transport = self._makeOnBackingTransport(branch)696 backing_transport = self._makeOnBackingTransport(branch)
699 backing_transport.put_bytes('hello.txt', 'Hello World!')697 backing_transport.put_bytes('hello.txt', b'Hello World!')
700698
701 transport = self.getTransport().clone(branch.unique_name)699 transport = self.getTransport().clone(branch.unique_name)
702700
@@ -735,7 +733,7 @@ class LaunchpadTransportTests:
735 branch = self.factory.makeAnyBranch(733 branch = self.factory.makeAnyBranch(
736 branch_type=BranchType.HOSTED, owner=self.requester)734 branch_type=BranchType.HOSTED, owner=self.requester)
737 backing_transport = self._makeOnBackingTransport(branch)735 backing_transport = self._makeOnBackingTransport(branch)
738 backing_transport.put_bytes('hello.txt', 'Hello World!')736 backing_transport.put_bytes('hello.txt', b'Hello World!')
739 transport = self.getTransport().clone(branch.unique_name)737 transport = self.getTransport().clone(branch.unique_name)
740 backing_transport = self.backing_transport.clone(738 backing_transport = self.backing_transport.clone(
741 branch_to_path(branch))739 branch_to_path(branch))
@@ -985,7 +983,7 @@ class TestBranchChangedNotification(TestCaseWithTransport):
985983
986 def assertFormatStringsPassed(self, branch):984 def assertFormatStringsPassed(self, branch):
987 self.assertEqual(1, len(self._branch_changed_log))985 self.assertEqual(1, len(self._branch_changed_log))
988 control_string = branch.bzrdir._format.get_format_string()986 control_string = branch.controldir._format.get_format_string()
989 branch_string = branch._format.get_format_string()987 branch_string = branch._format.get_format_string()
990 repository_string = branch.repository._format.get_format_string()988 repository_string = branch.repository._format.get_format_string()
991 self.assertEqual(989 self.assertEqual(
@@ -1130,7 +1128,7 @@ class TestLaunchpadTransportReadOnly(BzrTestCase):
1130 self.requester.id, codehosting_api, backing_transport)1128 self.requester.id, codehosting_api, backing_transport)
1131 self.lp_transport = get_transport(self.lp_server.get_url())1129 self.lp_transport = get_transport(self.lp_server.get_url())
1132 self.lp_transport.mkdir(os.path.dirname(self.writable_file))1130 self.lp_transport.mkdir(os.path.dirname(self.writable_file))
1133 self.lp_transport.put_bytes(self.writable_file, 'Hello World!')1131 self.lp_transport.put_bytes(self.writable_file, b'Hello World!')
11341132
1135 def _setUpMemoryServer(self):1133 def _setUpMemoryServer(self):
1136 memory_server = MemoryServer()1134 memory_server = MemoryServer()
diff --git a/lib/lp/codehosting/vfs/tests/test_filesystem.py b/lib/lp/codehosting/vfs/tests/test_filesystem.py
index 467ec2a..3e03e94 100644
--- a/lib/lp/codehosting/vfs/tests/test_filesystem.py
+++ b/lib/lp/codehosting/vfs/tests/test_filesystem.py
@@ -7,12 +7,12 @@ __metaclass__ = type
77
8import stat8import stat
99
10from bzrlib import errors10from breezy import errors
11from bzrlib.bzrdir import BzrDir11from breezy.bzr.bzrdir import BzrDir
12from bzrlib.tests import TestCaseWithTransport12from breezy.tests import TestCaseWithTransport
13from bzrlib.transport import get_transport13from breezy.transport import get_transport
14from bzrlib.transport.memory import MemoryTransport14from breezy.transport.memory import MemoryTransport
15from bzrlib.urlutils import escape15from breezy.urlutils import escape
1616
17from lp.code.interfaces.branchtarget import IBranchTarget17from lp.code.interfaces.branchtarget import IBranchTarget
18from lp.code.interfaces.codehosting import branch_id_alias18from lp.code.interfaces.codehosting import branch_id_alias
@@ -218,7 +218,7 @@ class TestFilesystem(TestCaseWithTransport):
218 transport.mkdir(branch_path)218 transport.mkdir(branch_path)
219 self.assertRaises(219 self.assertRaises(
220 errors.PermissionDenied,220 errors.PermissionDenied,
221 transport.put_bytes, '%s/README' % branch_path, 'Hello!')221 transport.put_bytes, '%s/README' % branch_path, b'Hello!')
222222
223 def test_rename_to_non_bzr_directory_fails(self):223 def test_rename_to_non_bzr_directory_fails(self):
224 # Users cannot create an allowed directory (e.g. '.bzr' or224 # Users cannot create an allowed directory (e.g. '.bzr' or
@@ -296,7 +296,7 @@ class TestFilesystem(TestCaseWithTransport):
296 # unescape(path).encode('utf-8') != path.296 # unescape(path).encode('utf-8') != path.
297 path = '%41%42%43'297 path = '%41%42%43'
298 escaped_path = escape(path)298 escaped_path = escape(path)
299 content = 'content'299 content = b'content'
300 transport.put_bytes(escaped_path, content)300 transport.put_bytes(escaped_path, content)
301301
302 # We can use the escaped path to reach the file.302 # We can use the escaped path to reach the file.
diff --git a/lib/lp/codehosting/vfs/tests/test_transport.py b/lib/lp/codehosting/vfs/tests/test_transport.py
index e4bc291..45c155a 100644
--- a/lib/lp/codehosting/vfs/tests/test_transport.py
+++ b/lib/lp/codehosting/vfs/tests/test_transport.py
@@ -5,14 +5,14 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib.tests import per_transport8from breezy.tests import per_transport
9from bzrlib.transport import (9from breezy.transport import (
10 chroot,10 chroot,
11 get_transport,11 get_transport,
12 Transport,12 Transport,
13 )13 )
14from bzrlib.transport.local import LocalTransport14from breezy.transport.local import LocalTransport
15from bzrlib.urlutils import local_path_to_url15from breezy.urlutils import local_path_to_url
1616
17from lp.codehosting.inmemory import InMemoryFrontend17from lp.codehosting.inmemory import InMemoryFrontend
18from lp.codehosting.tests.helpers import TestResultWrapper18from lp.codehosting.tests.helpers import TestResultWrapper
diff --git a/lib/lp/codehosting/vfs/tests/test_transport_extensions.py b/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
index 31c07a1..56b587f 100644
--- a/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
+++ b/lib/lp/codehosting/vfs/tests/test_transport_extensions.py
@@ -5,7 +5,7 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8from bzrlib.transport.memory import MemoryTransport8from breezy.transport.memory import MemoryTransport
99
10from lp.codehosting.vfs.transport import get_readonly_transport10from lp.codehosting.vfs.transport import get_readonly_transport
11from lp.testing import TestCase11from lp.testing import TestCase
diff --git a/lib/lp/codehosting/vfs/transport.py b/lib/lp/codehosting/vfs/transport.py
index db67847..f53b49a 100644
--- a/lib/lp/codehosting/vfs/transport.py
+++ b/lib/lp/codehosting/vfs/transport.py
@@ -5,7 +5,7 @@
55
6The code hosting filesystem is implemented using Bazaar transports. This6The code hosting filesystem is implemented using Bazaar transports. This
7module contains utilities for implementing virtual filesystems using7module contains utilities for implementing virtual filesystems using
8bzrlib.transport classes.8breezy.transport classes.
9"""9"""
1010
11__metaclass__ = type11__metaclass__ = type
@@ -19,14 +19,14 @@ __all__ = [
19 ]19 ]
2020
2121
22from bzrlib import urlutils22from breezy import urlutils
23from bzrlib.errors import (23from breezy.errors import (
24 BzrError,24 BzrError,
25 InProcessTransport,25 InProcessTransport,
26 NoSuchFile,26 NoSuchFile,
27 TransportNotPossible,27 TransportNotPossible,
28 )28 )
29from bzrlib.transport import (29from breezy.transport import (
30 chroot,30 chroot,
31 get_transport,31 get_transport,
32 register_transport,32 register_transport,
@@ -113,7 +113,7 @@ class AsyncVirtualTransport(Transport):
113 This method is called as an errback by `_call`. Use it to translate113 This method is called as an errback by `_call`. Use it to translate
114 errors from the server into something that users of the transport114 errors from the server into something that users of the transport
115 might expect. This could include translating vfs-specific errors into115 might expect. This could include translating vfs-specific errors into
116 bzrlib errors (e.g. "couldn\'t translate" into `NoSuchFile`) or116 breezy errors (e.g. "couldn\'t translate" into `NoSuchFile`) or
117 translating underlying paths into virtual paths.117 translating underlying paths into virtual paths.
118118
119 :param failure: A `twisted.python.failure.Failure`.119 :param failure: A `twisted.python.failure.Failure`.
@@ -276,105 +276,105 @@ class SynchronousAdapter(Transport):
276 return self._async_transport.set_segment_parameter(name, value)276 return self._async_transport.set_segment_parameter(name, value)
277277
278 def clone(self, offset=None):278 def clone(self, offset=None):
279 """See `bzrlib.transport.Transport`."""279 """See `breezy.transport.Transport`."""
280 cloned_async = self._async_transport.clone(offset)280 cloned_async = self._async_transport.clone(offset)
281 return SynchronousAdapter(cloned_async)281 return SynchronousAdapter(cloned_async)
282282
283 def external_url(self):283 def external_url(self):
284 """See `bzrlib.transport.Transport`."""284 """See `breezy.transport.Transport`."""
285 raise InProcessTransport(self)285 raise InProcessTransport(self)
286286
287 def abspath(self, relpath):287 def abspath(self, relpath):
288 """See `bzrlib.transport.Transport`."""288 """See `breezy.transport.Transport`."""
289 return self._async_transport.abspath(relpath)289 return self._async_transport.abspath(relpath)
290290
291 def append_file(self, relpath, f, mode=None):291 def append_file(self, relpath, f, mode=None):
292 """See `bzrlib.transport.Transport`."""292 """See `breezy.transport.Transport`."""
293 return extract_result(293 return extract_result(
294 self._async_transport.append_file(relpath, f, mode))294 self._async_transport.append_file(relpath, f, mode))
295295
296 def delete(self, relpath):296 def delete(self, relpath):
297 """See `bzrlib.transport.Transport`."""297 """See `breezy.transport.Transport`."""
298 return extract_result(self._async_transport.delete(relpath))298 return extract_result(self._async_transport.delete(relpath))
299299
300 def delete_tree(self, relpath):300 def delete_tree(self, relpath):
301 """See `bzrlib.transport.Transport`."""301 """See `breezy.transport.Transport`."""
302 return extract_result(self._async_transport.delete_tree(relpath))302 return extract_result(self._async_transport.delete_tree(relpath))
303303
304 def get(self, relpath):304 def get(self, relpath):
305 """See `bzrlib.transport.Transport`."""305 """See `breezy.transport.Transport`."""
306 return extract_result(self._async_transport.get(relpath))306 return extract_result(self._async_transport.get(relpath))
307307
308 def get_bytes(self, relpath):308 def get_bytes(self, relpath):
309 """See `bzrlib.transport.Transport`."""309 """See `breezy.transport.Transport`."""
310 return extract_result(self._async_transport.get_bytes(relpath))310 return extract_result(self._async_transport.get_bytes(relpath))
311311
312 def has(self, relpath):312 def has(self, relpath):
313 """See `bzrlib.transport.Transport`."""313 """See `breezy.transport.Transport`."""
314 return extract_result(self._async_transport.has(relpath))314 return extract_result(self._async_transport.has(relpath))
315315
316 def iter_files_recursive(self):316 def iter_files_recursive(self):
317 """See `bzrlib.transport.Transport`."""317 """See `breezy.transport.Transport`."""
318 return extract_result(318 return extract_result(
319 self._async_transport.iter_files_recursive())319 self._async_transport.iter_files_recursive())
320320
321 def listable(self):321 def listable(self):
322 """See `bzrlib.transport.Transport`."""322 """See `breezy.transport.Transport`."""
323 return extract_result(self._async_transport.listable())323 return extract_result(self._async_transport.listable())
324324
325 def list_dir(self, relpath):325 def list_dir(self, relpath):
326 """See `bzrlib.transport.Transport`."""326 """See `breezy.transport.Transport`."""
327 return extract_result(self._async_transport.list_dir(relpath))327 return extract_result(self._async_transport.list_dir(relpath))
328328
329 def lock_read(self, relpath):329 def lock_read(self, relpath):
330 """See `bzrlib.transport.Transport`."""330 """See `breezy.transport.Transport`."""
331 return extract_result(self._async_transport.lock_read(relpath))331 return extract_result(self._async_transport.lock_read(relpath))
332332
333 def lock_write(self, relpath):333 def lock_write(self, relpath):
334 """See `bzrlib.transport.Transport`."""334 """See `breezy.transport.Transport`."""
335 return extract_result(self._async_transport.lock_write(relpath))335 return extract_result(self._async_transport.lock_write(relpath))
336336
337 def mkdir(self, relpath, mode=None):337 def mkdir(self, relpath, mode=None):
338 """See `bzrlib.transport.Transport`."""338 """See `breezy.transport.Transport`."""
339 return extract_result(self._async_transport.mkdir(relpath, mode))339 return extract_result(self._async_transport.mkdir(relpath, mode))
340340
341 def open_write_stream(self, relpath, mode=None):341 def open_write_stream(self, relpath, mode=None):
342 """See `bzrlib.transport.Transport`."""342 """See `breezy.transport.Transport`."""
343 return extract_result(343 return extract_result(
344 self._async_transport.open_write_stream(relpath, mode))344 self._async_transport.open_write_stream(relpath, mode))
345345
346 def put_file(self, relpath, f, mode=None):346 def put_file(self, relpath, f, mode=None):
347 """See `bzrlib.transport.Transport`."""347 """See `breezy.transport.Transport`."""
348 return extract_result(348 return extract_result(
349 self._async_transport.put_file(relpath, f, mode))349 self._async_transport.put_file(relpath, f, mode))
350350
351 def local_realPath(self, relpath):351 def local_realPath(self, relpath):
352 """See `bzrlib.transport.Transport`."""352 """See `lp.codehosting.sftp.FatLocalTransport`."""
353 return extract_result(353 return extract_result(
354 self._async_transport.local_realPath(relpath))354 self._async_transport.local_realPath(relpath))
355355
356 def readv(self, relpath, offsets, adjust_for_latency=False,356 def readv(self, relpath, offsets, adjust_for_latency=False,
357 upper_limit=None):357 upper_limit=None):
358 """See `bzrlib.transport.Transport`."""358 """See `breezy.transport.Transport`."""
359 return extract_result(359 return extract_result(
360 self._async_transport.readv(360 self._async_transport.readv(
361 relpath, offsets, adjust_for_latency, upper_limit))361 relpath, offsets, adjust_for_latency, upper_limit))
362362
363 def rename(self, rel_from, rel_to):363 def rename(self, rel_from, rel_to):
364 """See `bzrlib.transport.Transport`."""364 """See `breezy.transport.Transport`."""
365 return extract_result(365 return extract_result(
366 self._async_transport.rename(rel_from, rel_to))366 self._async_transport.rename(rel_from, rel_to))
367367
368 def rmdir(self, relpath):368 def rmdir(self, relpath):
369 """See `bzrlib.transport.Transport`."""369 """See `breezy.transport.Transport`."""
370 return extract_result(self._async_transport.rmdir(relpath))370 return extract_result(self._async_transport.rmdir(relpath))
371371
372 def stat(self, relpath):372 def stat(self, relpath):
373 """See `bzrlib.transport.Transport`."""373 """See `breezy.transport.Transport`."""
374 return extract_result(self._async_transport.stat(relpath))374 return extract_result(self._async_transport.stat(relpath))
375375
376 def writeChunk(self, relpath, offset, data):376 def writeChunk(self, relpath, offset, data):
377 """See `bzrlib.transport.Transport`."""377 """See `lp.codehosting.sftp.FatLocalTransport`."""
378 return extract_result(378 return extract_result(
379 self._async_transport.writeChunk(relpath, offset, data))379 self._async_transport.writeChunk(relpath, offset, data))
380380
@@ -394,7 +394,7 @@ class AsyncVirtualServer(Server):
394394
395 :param scheme: The URL scheme to use.395 :param scheme: The URL scheme to use.
396 """396 """
397 # bzrlib's Server class does not have a constructor, so we cannot397 # breezy's Server class does not have a constructor, so we cannot
398 # safely upcall it.398 # safely upcall it.
399 self._scheme = scheme399 self._scheme = scheme
400 self._is_started = False400 self._is_started = False
diff --git a/lib/lp/scripts/runlaunchpad.py b/lib/lp/scripts/runlaunchpad.py
index 60332e6..b66e26f 100644
--- a/lib/lp/scripts/runlaunchpad.py
+++ b/lib/lp/scripts/runlaunchpad.py
@@ -202,13 +202,13 @@ class ForkingSessionService(Service):
202 # service.202 # service.
203 if not self.should_launch:203 if not self.should_launch:
204 return204 return
205 from lp.codehosting import get_bzr_path205 from lp.codehosting import get_brz_path
206 command = [config.root + '/bin/py', get_bzr_path(),206 command = [config.root + '/bin/py', get_brz_path(),
207 'launchpad-forking-service',207 'launchpad-forking-service',
208 '--path', config.codehosting.forking_daemon_socket,208 '--path', config.codehosting.forking_daemon_socket,
209 ]209 ]
210 env = dict(os.environ)210 env = dict(os.environ)
211 env['BZR_PLUGIN_PATH'] = config.root + '/bzrplugins'211 env['BRZ_PLUGIN_PATH'] = config.root + '/brzplugins'
212 logfile = self.logfile212 logfile = self.logfile
213 if logfile == '-':213 if logfile == '-':
214 # This process uses a different logging infrastructure from the214 # This process uses a different logging infrastructure from the
@@ -216,7 +216,7 @@ class ForkingSessionService(Service):
216 # as the logfile. So we just ignore this setting.216 # as the logfile. So we just ignore this setting.
217 pass217 pass
218 else:218 else:
219 env['BZR_LOG'] = logfile219 env['BRZ_LOG'] = logfile
220 process = subprocess.Popen(command, env=env, stdin=subprocess.PIPE)220 process = subprocess.Popen(command, env=env, stdin=subprocess.PIPE)
221 self.addCleanup(stop_process, process)221 self.addCleanup(stop_process, process)
222 process.stdin.close()222 process.stdin.close()
diff --git a/lib/lp/testing/__init__.py b/lib/lp/testing/__init__.py
index f4277be..c3cf774 100644
--- a/lib/lp/testing/__init__.py
+++ b/lib/lp/testing/__init__.py
@@ -81,12 +81,13 @@ import tempfile
81import time81import time
82import unittest82import unittest
8383
84from bzrlib import trace84from breezy import trace
85from bzrlib.bzrdir import (85from breezy.controldir import (
86 BzrDir,86 ControlDir,
87 format_registry,87 format_registry,
88 )88 )
89from bzrlib.transport import get_transport89from breezy.transport import get_transport
90from bzrlib import trace as bzr_trace
90import fixtures91import fixtures
91from lazr.restful.testing.tales import test_tales92from lazr.restful.testing.tales import test_tales
92from lazr.restful.testing.webservice import FakeRequest93from lazr.restful.testing.webservice import FakeRequest
@@ -846,11 +847,12 @@ class TestCaseWithFactory(TestCase):
846 self._use_bzr_branch_called = False847 self._use_bzr_branch_called = False
847 # XXX: JonathanLange 2010-12-24 bug=694140: Because of Launchpad's848 # XXX: JonathanLange 2010-12-24 bug=694140: Because of Launchpad's
848 # messing with global log state (see849 # messing with global log state (see
849 # lp.services.scripts.logger), trace._bzr_logger does not850 # lp.services.scripts.logger), trace._brz_logger does not
850 # necessarily equal logging.getLogger('bzr'), so we have to explicitly851 # necessarily equal logging.getLogger('brz'), so we have to explicitly
851 # make it so in order to avoid "No handlers for "bzr" logger'852 # make it so in order to avoid "No handlers for "brz" logger'
852 # messages.853 # messages.
853 trace._bzr_logger = logging.getLogger('bzr')854 trace._brz_logger = logging.getLogger('brz')
855 bzr_trace._bzr_logger = logging.getLogger('bzr')
854856
855 def getUserBrowser(self, url=None, user=None):857 def getUserBrowser(self, url=None, user=None):
856 """Return a Browser logged in as a fresh user, maybe opened at `url`.858 """Return a Browser logged in as a fresh user, maybe opened at `url`.
@@ -887,8 +889,7 @@ class TestCaseWithFactory(TestCase):
887 """889 """
888 if format is not None and isinstance(format, basestring):890 if format is not None and isinstance(format, basestring):
889 format = format_registry.get(format)()891 format = format_registry.get(format)()
890 return BzrDir.create_branch_convenience(892 return ControlDir.create_branch_convenience(branch_url, format=format)
891 branch_url, format=format)
892893
893 def create_branch_and_tree(self, tree_location=None, product=None,894 def create_branch_and_tree(self, tree_location=None, product=None,
894 db_branch=None, format=None,895 db_branch=None, format=None,
@@ -948,6 +949,7 @@ class TestCaseWithFactory(TestCase):
948 self.useTempDir()949 self.useTempDir()
949 # Avoid leaking local user configuration into tests.950 # Avoid leaking local user configuration into tests.
950 self.useContext(override_environ(951 self.useContext(override_environ(
952 BRZ_HOME=os.getcwd(), BRZ_EMAIL=None,
951 BZR_HOME=os.getcwd(), BZR_EMAIL=None, EMAIL=None,953 BZR_HOME=os.getcwd(), BZR_EMAIL=None, EMAIL=None,
952 ))954 ))
953955
@@ -1405,7 +1407,7 @@ def map_branch_contents(branch):
1405 for entry in entries:1407 for entry in entries:
1406 file_path, file_name, file_type = entry[:3]1408 file_path, file_name, file_type = entry[:3]
1407 if file_type == 'file':1409 if file_type == 'file':
1408 stored_file = tree.get_file_by_path(file_path)1410 stored_file = tree.get_file(file_path)
1409 contents[file_path] = stored_file.read()1411 contents[file_path] = stored_file.read()
1410 finally:1412 finally:
1411 tree.unlock()1413 tree.unlock()
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index f0310f3..a03bdfd 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -46,8 +46,8 @@ from types import InstanceType
46import uuid46import uuid
47import warnings47import warnings
4848
49from bzrlib.plugins.builder.recipe import BaseRecipeBranch49from breezy.plugins.builder.recipe import BaseRecipeBranch
50from bzrlib.revision import Revision as BzrRevision50from breezy.revision import Revision as BzrRevision
51from cryptography.utils import int_to_bytes51from cryptography.utils import int_to_bytes
52from lazr.jobrunner.jobrunner import SuspendJobException52from lazr.jobrunner.jobrunner import SuspendJobException
53import pytz53import pytz
@@ -3036,7 +3036,7 @@ class BareLaunchpadObjectFactory(ObjectFactory):
3036 If no branches are passed, return a recipe text that references an3036 If no branches are passed, return a recipe text that references an
3037 arbitrary branch.3037 arbitrary branch.
3038 """3038 """
3039 from bzrlib.plugins.builder.recipe import RecipeParser3039 from breezy.plugins.builder.recipe import RecipeParser
3040 parser = RecipeParser(self.makeRecipeText(*branches))3040 parser = RecipeParser(self.makeRecipeText(*branches))
3041 return parser.parse()3041 return parser.parse()
30423042
diff --git a/lib/lp/translations/browser/productseries.py b/lib/lp/translations/browser/productseries.py
index a5a6588..499e515 100644
--- a/lib/lp/translations/browser/productseries.py
+++ b/lib/lp/translations/browser/productseries.py
@@ -18,7 +18,7 @@ __all__ = [
1818
19import os.path19import os.path
2020
21from bzrlib.revision import NULL_REVISION21from breezy.revision import NULL_REVISION
22from zope.component import getUtility22from zope.component import getUtility
23from zope.publisher.browser import FileUpload23from zope.publisher.browser import FileUpload
2424
diff --git a/lib/lp/translations/pottery/detect_intltool.py b/lib/lp/translations/pottery/detect_intltool.py
index ae7d8e3..81eb352 100644
--- a/lib/lp/translations/pottery/detect_intltool.py
+++ b/lib/lp/translations/pottery/detect_intltool.py
@@ -26,7 +26,7 @@ def is_intltool_structure(tree):
2626
27 Currently this just checks for the existence of POTFILES.in.27 Currently this just checks for the existence of POTFILES.in.
2828
29 :param tree: A bzrlib.Tree object to search for the intltool structure.29 :param tree: A breezy.Tree object to search for the intltool structure.
30 :returns: True if signs of an intltool structure were found.30 :returns: True if signs of an intltool structure were found.
31 """31 """
32 with read_lock_tree(tree):32 with read_lock_tree(tree):
diff --git a/lib/lp/translations/pottery/tests/test_detect_intltool.py b/lib/lp/translations/pottery/tests/test_detect_intltool.py
index 152fb8a..cc0d5d7 100644
--- a/lib/lp/translations/pottery/tests/test_detect_intltool.py
+++ b/lib/lp/translations/pottery/tests/test_detect_intltool.py
@@ -7,7 +7,7 @@ import errno
7import os7import os
8import tarfile8import tarfile
99
10from bzrlib.bzrdir import BzrDir10from breezy.controldir import ControlDir
1111
12from lp.testing import TestCase12from lp.testing import TestCase
13from lp.translations.pottery.detect_intltool import is_intltool_structure13from lp.translations.pottery.detect_intltool import is_intltool_structure
@@ -56,7 +56,7 @@ class SetupTestPackageMixin:
56class TestDetectIntltoolInBzrTree(TestCase, SetupTestPackageMixin):56class TestDetectIntltoolInBzrTree(TestCase, SetupTestPackageMixin):
5757
58 def prepare_tree(self):58 def prepare_tree(self):
59 return BzrDir.create_standalone_workingtree(".")59 return ControlDir.create_standalone_workingtree(".")
6060
61 def test_detect_intltool_structure(self):61 def test_detect_intltool_structure(self):
62 # Detect a simple intltool structure.62 # Detect a simple intltool structure.
diff --git a/lib/lp/translations/scripts/tests/test_translations_to_branch.py b/lib/lp/translations/scripts/tests/test_translations_to_branch.py
index ec201fe..248b2e0 100644
--- a/lib/lp/translations/scripts/tests/test_translations_to_branch.py
+++ b/lib/lp/translations/scripts/tests/test_translations_to_branch.py
@@ -7,7 +7,7 @@ import datetime
7import re7import re
8from textwrap import dedent8from textwrap import dedent
99
10from bzrlib.errors import NotBranchError10from breezy.errors import NotBranchError
11import pytz11import pytz
12from testtools.matchers import MatchesRegex12from testtools.matchers import MatchesRegex
13import transaction13import transaction
@@ -193,7 +193,7 @@ class TestExportTranslationsToBranch(TestCaseWithFactory):
193 self.assertTrue("GruesomeException" in message)193 self.assertTrue("GruesomeException" in message)
194194
195 def test_exportToBranches_handles_unpushed_branches(self):195 def test_exportToBranches_handles_unpushed_branches(self):
196 # bzrlib raises NotBranchError when accessing a nonexistent196 # breezy raises NotBranchError when accessing a nonexistent
197 # branch. The exporter deals with that by calling197 # branch. The exporter deals with that by calling
198 # _handleUnpushedBranch.198 # _handleUnpushedBranch.
199 exporter = ExportTranslationsToBranch(test_args=[])199 exporter = ExportTranslationsToBranch(test_args=[])
diff --git a/lib/lp/translations/scripts/translations_to_branch.py b/lib/lp/translations/scripts/translations_to_branch.py
index 973b45f..5f7a64f 100644
--- a/lib/lp/translations/scripts/translations_to_branch.py
+++ b/lib/lp/translations/scripts/translations_to_branch.py
@@ -17,8 +17,8 @@ import os.path
17# line below this comment.17# line below this comment.
18import lp.codehosting18import lp.codehosting
1919
20from bzrlib.errors import NotBranchError20from breezy.errors import NotBranchError
21from bzrlib.revision import NULL_REVISION21from breezy.revision import NULL_REVISION
22import pytz22import pytz
23from storm.expr import (23from storm.expr import (
24 And,24 And,
diff --git a/lib/lp/translations/tests/test_rosetta_branches_script.py b/lib/lp/translations/tests/test_rosetta_branches_script.py
index 1d332d4..1d140cd 100644
--- a/lib/lp/translations/tests/test_rosetta_branches_script.py
+++ b/lib/lp/translations/tests/test_rosetta_branches_script.py
@@ -9,7 +9,7 @@ provisions to handle Bazaar branches.
99
10__metaclass__ = type10__metaclass__ = type
1111
12from bzrlib.revision import NULL_REVISION12from breezy.revision import NULL_REVISION
13import transaction13import transaction
14from zope.component import getUtility14from zope.component import getUtility
1515
@@ -43,11 +43,11 @@ class TestRosettaBranchesScript(TestCaseWithFactory):
43 self.useBzrBranches()43 self.useBzrBranches()
44 pot_content = self.factory.getUniqueString()44 pot_content = self.factory.getUniqueString()
45 branch, tree = self.create_branch_and_tree()45 branch, tree = self.create_branch_and_tree()
46 tree.bzrdir.root_transport.put_bytes(pot_path, pot_content)46 tree.controldir.root_transport.put_bytes(pot_path, pot_content)
47 tree.add(pot_path)47 tree.add(pot_path)
48 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is48 # XXX: AaronBentley 2010-08-06 bug=614404: a bzr username is
49 # required to generate the revision-id.49 # required to generate the revision-id.
50 with override_environ(BZR_EMAIL='me@example.com'):50 with override_environ(BRZ_EMAIL='me@example.com'):
51 revision_id = tree.commit("first commit")51 revision_id = tree.commit("first commit")
52 branch.last_scanned_id = revision_id52 branch.last_scanned_id = revision_id
53 branch.last_mirrored_id = revision_id53 branch.last_mirrored_id = revision_id
diff --git a/lib/lp_sitecustomize.py b/lib/lp_sitecustomize.py
index 67c0030..d23cd74 100644
--- a/lib/lp_sitecustomize.py
+++ b/lib/lp_sitecustomize.py
@@ -77,11 +77,12 @@ def silence_amqp_logger():
77 amqp_logger.propagate = False77 amqp_logger.propagate = False
7878
7979
80def silence_bzr_logger():80def silence_bzr_loggers():
81 """Install the NullHandler on the bzr logger to silence logs."""81 """Install the NullHandler on the bzr/brz loggers to silence logs."""
82 bzr_logger = logging.getLogger('bzr')82 for logger_name in ('bzr', 'brz'):
83 bzr_logger.addHandler(logging.NullHandler())83 logger = logging.getLogger(logger_name)
84 bzr_logger.propagate = False84 logger.addHandler(logging.NullHandler())
85 logger.propagate = False
8586
8687
87def silence_swiftclient_logger():88def silence_swiftclient_logger():
@@ -154,7 +155,7 @@ def customize_logger():
154 logging between tests.155 logging between tests.
155 """156 """
156 silence_amqp_logger()157 silence_amqp_logger()
157 silence_bzr_logger()158 silence_bzr_loggers()
158 silence_zcml_logger()159 silence_zcml_logger()
159 silence_transaction_logger()160 silence_transaction_logger()
160 silence_swiftclient_logger()161 silence_swiftclient_logger()
@@ -185,3 +186,9 @@ def main(instance_name=None):
185 # through actually using itertools.groupby.186 # through actually using itertools.groupby.
186 grouper = type(list(itertools.groupby([0]))[0][1])187 grouper = type(list(itertools.groupby([0]))[0][1])
187 checker.BasicTypes[grouper] = checker._iteratorChecker188 checker.BasicTypes[grouper] = checker._iteratorChecker
189
190 # XXX 2019-09-17: git must be disabled until codeimport is upgraded,
191 # since the required dulwich versions for our current version of bzr-git
192 # and for Breezy are incompatible in both directions.
193 import types
194 sys.modules['breezy.git'] = types.ModuleType('breezy.git')
diff --git a/scripts/mirror-branch.py b/scripts/mirror-branch.py
index a493cf0..90f8cef 100755
--- a/scripts/mirror-branch.py
+++ b/scripts/mirror-branch.py
@@ -33,7 +33,7 @@ import os
33import resource33import resource
34import sys34import sys
3535
36import bzrlib.repository36import breezy.repository
3737
38from lp.code.enums import BranchType38from lp.code.enums import BranchType
39from lp.codehosting.puller.worker import (39from lp.codehosting.puller.worker import (
@@ -54,24 +54,7 @@ def shut_up_deprecation_warning():
54 # XXX DavidAllouche 2006-01-29:54 # XXX DavidAllouche 2006-01-29:
55 # Quick hack to disable the deprecation warning for old repository55 # Quick hack to disable the deprecation warning for old repository
56 # formats.56 # formats.
57 bzrlib.repository._deprecation_warning_done = True57 breezy.repository._deprecation_warning_done = True
58
59
60def force_bzr_to_use_urllib():
61 # These lines prevent bzr from using pycurl to connect to http: urls. We
62 # want this for two reasons:
63 # 1) pycurl rejects self signed certificates, which prevents a significant
64 # number of mirror branchs from updating, and
65 # 2) the script sometimes hangs inside pycurl, preventing all mirrors from
66 # being updated until the script is restarted.
67 # There is no test for this (it would involve a great number of moving
68 # parts) but it has been verified to work on production. Also see
69 # https://bugs.launchpad.net/bzr/+bug/82086
70 from bzrlib.transport import register_lazy_transport
71 register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
72 'HttpTransport_urllib')
73 register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
74 'HttpTransport_urllib')
7558
7659
77if __name__ == '__main__':60if __name__ == '__main__':
@@ -86,7 +69,6 @@ if __name__ == '__main__':
86 section_name = 'supermirror_%s_puller' % branch_type_map[branch_type]69 section_name = 'supermirror_%s_puller' % branch_type_map[branch_type]
87 globalErrorUtility.configure(section_name)70 globalErrorUtility.configure(section_name)
88 shut_up_deprecation_warning()71 shut_up_deprecation_warning()
89 force_bzr_to_use_urllib()
9072
91 resource.setrlimit(resource.RLIMIT_AS, (1500000000, 1500000000))73 resource.setrlimit(resource.RLIMIT_AS, (1500000000, 1500000000))
9274
diff --git a/scripts/update-stacked-on.py b/scripts/update-stacked-on.py
index 41e11fa..dda181d 100755
--- a/scripts/update-stacked-on.py
+++ b/scripts/update-stacked-on.py
@@ -23,9 +23,10 @@ import _pythonpath
23from collections import namedtuple23from collections import namedtuple
24import sys24import sys
2525
26from bzrlib import errors26from breezy import errors
27from bzrlib.bzrdir import BzrDir27from breezy.branch import UnstackableBranchFormat
28from bzrlib.config import TransportConfig28from breezy.bzr.bzrdir import BzrDir
29from breezy.config import TransportConfig
2930
30from lp.code.interfaces.codehosting import branch_id_alias31from lp.code.interfaces.codehosting import branch_id_alias
31from lp.codehosting.bzrutils import get_branch_stacked_on_url32from lp.codehosting.bzrutils import get_branch_stacked_on_url
@@ -109,7 +110,7 @@ class UpdateStackedBranches(LaunchpadScript):
109 self.logger.warn(110 self.logger.warn(
110 "Branch for %r at %r is not stacked at all. Giving up."111 "Branch for %r at %r is not stacked at all. Giving up."
111 % (branch_id, bzr_branch_url))112 % (branch_id, bzr_branch_url))
112 except errors.UnstackableBranchFormat:113 except UnstackableBranchFormat:
113 self.logger.error(114 self.logger.error(
114 "Branch for %r at %r is unstackable. Giving up."115 "Branch for %r at %r is unstackable. Giving up."
115 % (branch_id, bzr_branch_url))116 % (branch_id, bzr_branch_url))
diff --git a/setup.py b/setup.py
index 2f9ab7a..3f7b6b3 100644
--- a/setup.py
+++ b/setup.py
@@ -149,6 +149,7 @@ setup(
149 'backports.lzma',149 'backports.lzma',
150 'BeautifulSoup',150 'BeautifulSoup',
151 'beautifulsoup4[lxml]',151 'beautifulsoup4[lxml]',
152 'breezy',
152 'bzr',153 'bzr',
153 'celery',154 'celery',
154 'cssselect',155 'cssselect',
@@ -283,6 +284,7 @@ setup(
283 'zope.vocabularyregistry',284 'zope.vocabularyregistry',
284 # Loggerhead dependencies. These should be removed once285 # Loggerhead dependencies. These should be removed once
285 # bug 383360 is fixed and we include it as a source dist.286 # bug 383360 is fixed and we include it as a source dist.
287 'bleach',
286 'Paste',288 'Paste',
287 'PasteDeploy',289 'PasteDeploy',
288 'SimpleTAL',290 'SimpleTAL',
diff --git a/utilities/create-lp-wadl-and-apidoc.py b/utilities/create-lp-wadl-and-apidoc.py
index 808c991..4894943 100755
--- a/utilities/create-lp-wadl-and-apidoc.py
+++ b/utilities/create-lp-wadl-and-apidoc.py
@@ -18,8 +18,8 @@ import os
18import subprocess18import subprocess
19import sys19import sys
2020
21import bzrlib21import breezy
22from bzrlib.branch import Branch22from breezy.branch import Branch
23from lazr.restful.interfaces import IWebServiceConfiguration23from lazr.restful.interfaces import IWebServiceConfiguration
24from z3c.ptcompat import PageTemplateFile24from z3c.ptcompat import PageTemplateFile
25from zope.component import getUtility25from zope.component import getUtility
@@ -144,7 +144,7 @@ def main(directory, force=False):
144 ["git", "log", "-1", "--format=%ct", "HEAD"],144 ["git", "log", "-1", "--format=%ct", "HEAD"],
145 universal_newlines=True))145 universal_newlines=True))
146 else:146 else:
147 with bzrlib.initialize():147 with breezy.get_global_state():
148 branch = Branch.open(top)148 branch = Branch.open(top)
149 timestamp = branch.repository.get_revision(149 timestamp = branch.repository.get_revision(
150 branch.last_revision()).timestamp150 branch.last_revision()).timestamp
diff --git a/utilities/sourcedeps.cache b/utilities/sourcedeps.cache
index 1360489..59ec12b 100644
--- a/utilities/sourcedeps.cache
+++ b/utilities/sourcedeps.cache
@@ -1,16 +1,16 @@
1{1{
2 "bzr-builder": [2 "brz-builder": [
3 70, 3 180,
4 "launchpad@pqm.canonical.com-20111114140506-6bmt9isw6lcud7yt"4 "jelmer@jelmer.uk-20180624153632-1f0weftl0pawz6wj"
5 ],
6 "brz-loom": [
7 166,
8 "jelmer@jelmer.uk-20190822193925-ydrq7fgdi78lpgm7"
5 ], 9 ],
6 "bzr-git": [10 "bzr-git": [
7 280, 11 280,
8 "launchpad@pqm.canonical.com-20171222005919-u98ut0f5z2g618um"12 "launchpad@pqm.canonical.com-20171222005919-u98ut0f5z2g618um"
9 ], 13 ],
10 "bzr-loom": [
11 55,
12 "launchpad@pqm.canonical.com-20120830090804-cg49kky93htwax7s"
13 ],
14 "bzr-svn": [14 "bzr-svn": [
15 2725, 15 2725,
16 "launchpad@pqm.canonical.com-20130816045016-wzr810hu2z459t4y"16 "launchpad@pqm.canonical.com-20130816045016-wzr810hu2z459t4y"
@@ -24,8 +24,8 @@
24 "cjwatson@canonical.com-20190614154330-091l9edcnubsjmsx"24 "cjwatson@canonical.com-20190614154330-091l9edcnubsjmsx"
25 ], 25 ],
26 "loggerhead": [26 "loggerhead": [
27 493, 27 494,
28 "cjwatson@canonical.com-20190621112125-3aaxj3hrmty19lr6"28 "cjwatson@canonical.com-20190919081036-q1symc2h2iedtlh3"
29 ], 29 ],
30 "mailman": [30 "mailman": [
31 977, 31 977,
diff --git a/utilities/sourcedeps.conf b/utilities/sourcedeps.conf
index d1dc1df..f21c98f 100644
--- a/utilities/sourcedeps.conf
+++ b/utilities/sourcedeps.conf
@@ -7,13 +7,13 @@
7#### DEPRECATED. NO NEW ITEMS. NO NO NO NO NO NONONONONO7#### DEPRECATED. NO NEW ITEMS. NO NO NO NO NO NONONONONO
8#########################################################8#########################################################
99
10bzr-builder lp:~launchpad-pqm/bzr-builder/trunk;revno=7010brz-builder lp:~jelmer/brz-builder/trunk;revno=180
11brz-loom lp:~jelmer/brz-loom/trunk;revno=166
11bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=28012bzr-git lp:~launchpad-pqm/bzr-git/devel;revno=280
12bzr-loom lp:~launchpad-pqm/bzr-loom/trunk;revno=55
13bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=272513bzr-svn lp:~launchpad-pqm/bzr-svn/devel;revno=2725
14cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=43314cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=433
15difftacular lp:~launchpad/difftacular/trunk;revno=1115difftacular lp:~launchpad/difftacular/trunk;revno=11
16loggerhead lp:~loggerhead-team/loggerhead/trunk-rich;revno=49316loggerhead lp:~loggerhead-team/loggerhead/trunk-rich;revno=494
17mailman lp:~launchpad-pqm/mailman/2.1;revno=97717mailman lp:~launchpad-pqm/mailman/2.1;revno=977
18old_xmlplus lp:~launchpad-pqm/dtdparser/trunk;revno=418old_xmlplus lp:~launchpad-pqm/dtdparser/trunk;revno=4
19pygettextpo lp:~launchpad-pqm/pygettextpo/trunk;revno=2519pygettextpo lp:~launchpad-pqm/pygettextpo/trunk;revno=25

Subscribers

People subscribed via source and target branches

to status/vote changes: