Merge lp:~jelmer/brz/default-format-git into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/default-format-git
Merge into: lp:brz
Diff against target: 194 lines (+37/-18)
7 files modified
breezy/bzr/bzrdir.py (+2/-0)
breezy/bzr/tests/test_bzrdir.py (+5/-2)
breezy/tests/blackbox/test_send.py (+12/-11)
breezy/tests/per_branch/test_pull.py (+5/-1)
breezy/tests/per_branch/test_push.py (+5/-1)
breezy/tests/per_merger.py (+5/-1)
setup.py (+3/-2)
To merge this branch: bzr merge lp:~jelmer/brz/default-format-git
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+413492@code.launchpad.net

Commit message

Some more improvements to handle git as default format.

Description of the change

Some more improvements to handle git as default format.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/bzr/bzrdir.py'
--- breezy/bzr/bzrdir.py 2021-11-17 20:30:19 +0000
+++ breezy/bzr/bzrdir.py 2021-12-27 23:17:52 +0000
@@ -780,6 +780,8 @@
780 if cls is not BzrDir:780 if cls is not BzrDir:
781 raise AssertionError("BzrDir.create always creates the "781 raise AssertionError("BzrDir.create always creates the "
782 "default format, not one of %r" % cls)782 "default format, not one of %r" % cls)
783 if format is None:
784 format = BzrDirFormat.get_default_format()
783 return controldir.ControlDir.create(785 return controldir.ControlDir.create(
784 base, format=format, possible_transports=possible_transports)786 base, format=format, possible_transports=possible_transports)
785787
786788
=== modified file 'breezy/bzr/tests/test_bzrdir.py'
--- breezy/bzr/tests/test_bzrdir.py 2020-12-26 18:24:48 +0000
+++ breezy/bzr/tests/test_bzrdir.py 2021-12-27 23:17:52 +0000
@@ -80,13 +80,16 @@
80 old_format = bzrdir.BzrDirFormat.get_default_format()80 old_format = bzrdir.BzrDirFormat.get_default_format()
81 # default is BzrDirMetaFormat181 # default is BzrDirMetaFormat1
82 self.assertIsInstance(old_format, bzrdir.BzrDirMetaFormat1)82 self.assertIsInstance(old_format, bzrdir.BzrDirMetaFormat1)
83 controldir.ControlDirFormat._set_default_format(SampleBzrDirFormat())83 current_default = controldir.format_registry.aliases()['bzr']
84 controldir.format_registry.register('sample', SampleBzrDirFormat, help='Sample')
85 self.addCleanup(controldir.format_registry.remove, 'sample')
86 controldir.format_registry.register_alias('bzr', 'sample')
84 # creating a bzr dir should now create an instrumented dir.87 # creating a bzr dir should now create an instrumented dir.
85 try:88 try:
86 result = bzrdir.BzrDir.create('memory:///')89 result = bzrdir.BzrDir.create('memory:///')
87 self.assertIsInstance(result, SampleBzrDir)90 self.assertIsInstance(result, SampleBzrDir)
88 finally:91 finally:
89 controldir.ControlDirFormat._set_default_format(old_format)92 controldir.format_registry.register_alias('bzr', current_default)
90 self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())93 self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())
9194
9295
9396
=== modified file 'breezy/tests/blackbox/test_send.py'
--- breezy/tests/blackbox/test_send.py 2020-06-19 21:26:53 +0000
+++ breezy/tests/blackbox/test_send.py 2021-12-27 23:17:52 +0000
@@ -282,16 +282,17 @@
282 self.parent_tree = ControlDir.create_standalone_workingtree('parent')282 self.parent_tree = ControlDir.create_standalone_workingtree('parent')
283 self.build_tree_contents([('parent/file', b'parent')])283 self.build_tree_contents([('parent/file', b'parent')])
284 self.parent_tree.add('file')284 self.parent_tree.add('file')
285 self.parent_tree.commit('first commit', rev_id=b'parent')285 parent = self.parent_tree.commit('first commit')
286 # Branch 'local' from parent and do a change286 # Branch 'local' from parent and do a change
287 local_bzrdir = self.parent_tree.controldir.sprout('local')287 local_bzrdir = self.parent_tree.controldir.sprout('local')
288 self.local_tree = local_bzrdir.open_workingtree()288 self.local_tree = local_bzrdir.open_workingtree()
289 self.build_tree_contents([('local/file', b'local')])289 self.build_tree_contents([('local/file', b'local')])
290 self.local_tree.commit('second commit', rev_id=b'local')290 local = self.local_tree.commit('second commit')
291 return parent, local
291292
292 _default_command = ['send', '-o-', '../parent']293 _default_command = ['send', '-o-', '../parent']
293 _default_wd = 'local'294 _default_wd = 'local'
294 _default_sent_revs = [b'local']295 _default_sent_revs = None
295 _default_errors = ['Working tree ".*/local/" has uncommitted '296 _default_errors = ['Working tree ".*/local/" has uncommitted '
296 'changes \\(See brz status\\)\\.', ]297 'changes \\(See brz status\\)\\.', ]
297 _default_additional_error = 'Use --no-strict to force the send.\n'298 _default_additional_error = 'Use --no-strict to force the send.\n'
@@ -311,7 +312,7 @@
311 else:312 else:
312 err_re = []313 err_re = []
313 if revs is None:314 if revs is None:
314 revs = self._default_sent_revs315 revs = self._default_sent_revs or [self.local]
315 out, err = self.run_send(args, err_re=err_re)316 out, err = self.run_send(args, err_re=err_re)
316 if len(revs) == 1:317 if len(revs) == 1:
317 bundling_revs = 'Bundling %d revision.\n' % len(revs)318 bundling_revs = 'Bundling %d revision.\n' % len(revs)
@@ -324,7 +325,7 @@
324 self.assertEqual(bundling_revs, err)325 self.assertEqual(bundling_revs, err)
325 md = merge_directive.MergeDirective.from_lines(326 md = merge_directive.MergeDirective.from_lines(
326 BytesIO(out.encode('utf-8')))327 BytesIO(out.encode('utf-8')))
327 self.assertEqual(b'parent', md.base_revision_id)328 self.assertEqual(self.parent, md.base_revision_id)
328 br = serializer.read_bundle(BytesIO(md.get_raw_bundle()))329 br = serializer.read_bundle(BytesIO(md.get_raw_bundle()))
329 self.assertEqual(set(revs), set(r.revision_id for r in br.revisions))330 self.assertEqual(set(revs), set(r.revision_id for r in br.revisions))
330331
@@ -334,7 +335,7 @@
334335
335 def setUp(self):336 def setUp(self):
336 super(TestSendStrictWithoutChanges, self).setUp()337 super(TestSendStrictWithoutChanges, self).setUp()
337 self.make_parent_and_local_branches()338 self.parent, self.local = self.make_parent_and_local_branches()
338339
339 def test_send_without_workingtree(self):340 def test_send_without_workingtree(self):
340 ControlDir.open("local").destroy_workingtree()341 ControlDir.open("local").destroy_workingtree()
@@ -383,12 +384,12 @@
383 do_changes_func()384 do_changes_func()
384385
385 def _uncommitted_changes(self):386 def _uncommitted_changes(self):
386 self.make_parent_and_local_branches()387 self.parent, self.local = self.make_parent_and_local_branches()
387 # Make a change without committing it388 # Make a change without committing it
388 self.build_tree_contents([('local/file', b'modified')])389 self.build_tree_contents([('local/file', b'modified')])
389390
390 def _pending_merges(self):391 def _pending_merges(self):
391 self.make_parent_and_local_branches()392 self.parent, self.local = self.make_parent_and_local_branches()
392 # Create 'other' branch containing a new file393 # Create 'other' branch containing a new file
393 other_bzrdir = self.parent_tree.controldir.sprout('other')394 other_bzrdir = self.parent_tree.controldir.sprout('other')
394 other_tree = other_bzrdir.open_workingtree()395 other_tree = other_bzrdir.open_workingtree()
@@ -400,7 +401,7 @@
400 self.local_tree.revert(filenames=['other-file'], backups=False)401 self.local_tree.revert(filenames=['other-file'], backups=False)
401402
402 def _out_of_sync_trees(self):403 def _out_of_sync_trees(self):
403 self.make_parent_and_local_branches()404 self.parent, self.local = self.make_parent_and_local_branches()
404 self.run_bzr(['checkout', '--lightweight', 'local', 'checkout'])405 self.run_bzr(['checkout', '--lightweight', 'local', 'checkout'])
405 # Make a change and commit it406 # Make a change and commit it
406 self.build_tree_contents([('local/file', b'modified in local')])407 self.build_tree_contents([('local/file', b'modified in local')])
@@ -409,13 +410,13 @@
409 self._default_wd = 'checkout'410 self._default_wd = 'checkout'
410 self._default_errors = ["Working tree is out of date, please run"411 self._default_errors = ["Working tree is out of date, please run"
411 " 'brz update'\\.", ]412 " 'brz update'\\.", ]
412 self._default_sent_revs = [b'modified-in-local', b'local']413 self._default_sent_revs = [b'modified-in-local', self.local]
413414
414 def test_send_default(self):415 def test_send_default(self):
415 self.assertSendSucceeds([], with_warning=True)416 self.assertSendSucceeds([], with_warning=True)
416417
417 def test_send_with_revision(self):418 def test_send_with_revision(self):
418 self.assertSendSucceeds(['-r', 'revid:local'], revs=[b'local'])419 self.assertSendSucceeds(['-r', 'revid:' + self.local.decode('utf-8')], revs=[self.local])
419420
420 def test_send_no_strict(self):421 def test_send_no_strict(self):
421 self.assertSendSucceeds(['--no-strict'])422 self.assertSendSucceeds(['--no-strict'])
422423
=== modified file 'breezy/tests/per_branch/test_pull.py'
--- breezy/tests/per_branch/test_pull.py 2021-12-25 14:55:24 +0000
+++ breezy/tests/per_branch/test_pull.py 2021-12-27 23:17:52 +0000
@@ -300,7 +300,11 @@
300 # branch of the default type, which does allow binding.300 # branch of the default type, which does allow binding.
301 # See https://bugs.launchpad.net/bzr/+bug/112020301 # See https://bugs.launchpad.net/bzr/+bug/112020
302 local = controldir.ControlDir.create_branch_convenience('local2')302 local = controldir.ControlDir.create_branch_convenience('local2')
303 local.bind(target)303 try:
304 local.bind(target)
305 except branch.BindingUnsupported:
306 raise TestNotApplicable(
307 'default format does not support binding')
304 source = self.make_branch('source')308 source = self.make_branch('source')
305 branch.Branch.hooks.install_named_hook(309 branch.Branch.hooks.install_named_hook(
306 'post_pull', self.capture_post_pull_hook, None)310 'post_pull', self.capture_post_pull_hook, None)
307311
=== modified file 'breezy/tests/per_branch/test_push.py'
--- breezy/tests/per_branch/test_push.py 2021-12-25 14:55:24 +0000
+++ breezy/tests/per_branch/test_push.py 2021-12-27 23:17:52 +0000
@@ -351,7 +351,11 @@
351 # branch of the default type, which does allow binding.351 # branch of the default type, which does allow binding.
352 # See https://bugs.launchpad.net/bzr/+bug/112020352 # See https://bugs.launchpad.net/bzr/+bug/112020
353 local = controldir.ControlDir.create_branch_convenience('local2')353 local = controldir.ControlDir.create_branch_convenience('local2')
354 local.bind(target)354 try:
355 local.bind(target)
356 except branch.BindingUnsupported:
357 raise tests.TestNotApplicable(
358 'default format does not support binding')
355 source = self.make_branch('source')359 source = self.make_branch('source')
356 branch.Branch.hooks.install_named_hook(360 branch.Branch.hooks.install_named_hook(
357 'post_push', self.capture_post_push_hook, None)361 'post_push', self.capture_post_push_hook, None)
358362
=== modified file 'breezy/tests/per_merger.py'
--- breezy/tests/per_merger.py 2021-12-27 13:56:34 +0000
+++ breezy/tests/per_merger.py 2021-12-27 23:17:52 +0000
@@ -351,7 +351,11 @@
351 builder = self.make_merge_builder()351 builder = self.make_merge_builder()
352 self.create_file_needing_contents_merge(builder, "name1")352 self.create_file_needing_contents_merge(builder, "name1")
353 conflicts = builder.merge(self.merge_type)353 conflicts = builder.merge(self.merge_type)
354 self.assertEqual(conflicts, [TextConflict('name1', file_id=b'name1-id')])354 self.assertEqual(1, len(conflicts))
355 [conflict] = conflicts
356 self.assertEqual('text conflict', conflict.typestring)
357 if builder.this.supports_file_ids:
358 self.assertEqual(conflict.file_id, builder.this.path2id('name1'))
355 # The hook still gets to set the file contents in this case, so that it359 # The hook still gets to set the file contents in this case, so that it
356 # can insert custom conflict markers.360 # can insert custom conflict markers.
357 with builder.this.get_file('name1') as f:361 with builder.this.get_file('name1') as f:
358362
=== modified file 'setup.py'
--- setup.py 2021-12-25 12:35:22 +0000
+++ setup.py 2021-12-27 23:17:52 +0000
@@ -588,8 +588,9 @@
588 version=version_str,588 version=version_str,
589 description=META_INFO['description'],589 description=META_INFO['description'],
590 maintainer=META_INFO['maintainer'],590 maintainer=META_INFO['maintainer'],
591 copyright="Copyright 2005-2012 Canonical Ltd.\n"591 copyright=(
592 "Copyright 2017-2021 Breezy developers",592 "Copyright 2005-2012 Canonical Ltd.\n"
593 "Copyright 2017-2021 Breezy developers"),
593 company_name="Canonical Ltd.",594 company_name="Canonical Ltd.",
594 comments=META_INFO['description'],595 comments=META_INFO['description'],
595 )596 )

Subscribers

People subscribed via source and target branches