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
1=== modified file 'breezy/bzr/bzrdir.py'
2--- breezy/bzr/bzrdir.py 2021-11-17 20:30:19 +0000
3+++ breezy/bzr/bzrdir.py 2021-12-27 23:17:52 +0000
4@@ -780,6 +780,8 @@
5 if cls is not BzrDir:
6 raise AssertionError("BzrDir.create always creates the "
7 "default format, not one of %r" % cls)
8+ if format is None:
9+ format = BzrDirFormat.get_default_format()
10 return controldir.ControlDir.create(
11 base, format=format, possible_transports=possible_transports)
12
13
14=== modified file 'breezy/bzr/tests/test_bzrdir.py'
15--- breezy/bzr/tests/test_bzrdir.py 2020-12-26 18:24:48 +0000
16+++ breezy/bzr/tests/test_bzrdir.py 2021-12-27 23:17:52 +0000
17@@ -80,13 +80,16 @@
18 old_format = bzrdir.BzrDirFormat.get_default_format()
19 # default is BzrDirMetaFormat1
20 self.assertIsInstance(old_format, bzrdir.BzrDirMetaFormat1)
21- controldir.ControlDirFormat._set_default_format(SampleBzrDirFormat())
22+ current_default = controldir.format_registry.aliases()['bzr']
23+ controldir.format_registry.register('sample', SampleBzrDirFormat, help='Sample')
24+ self.addCleanup(controldir.format_registry.remove, 'sample')
25+ controldir.format_registry.register_alias('bzr', 'sample')
26 # creating a bzr dir should now create an instrumented dir.
27 try:
28 result = bzrdir.BzrDir.create('memory:///')
29 self.assertIsInstance(result, SampleBzrDir)
30 finally:
31- controldir.ControlDirFormat._set_default_format(old_format)
32+ controldir.format_registry.register_alias('bzr', current_default)
33 self.assertEqual(old_format, bzrdir.BzrDirFormat.get_default_format())
34
35
36
37=== modified file 'breezy/tests/blackbox/test_send.py'
38--- breezy/tests/blackbox/test_send.py 2020-06-19 21:26:53 +0000
39+++ breezy/tests/blackbox/test_send.py 2021-12-27 23:17:52 +0000
40@@ -282,16 +282,17 @@
41 self.parent_tree = ControlDir.create_standalone_workingtree('parent')
42 self.build_tree_contents([('parent/file', b'parent')])
43 self.parent_tree.add('file')
44- self.parent_tree.commit('first commit', rev_id=b'parent')
45+ parent = self.parent_tree.commit('first commit')
46 # Branch 'local' from parent and do a change
47 local_bzrdir = self.parent_tree.controldir.sprout('local')
48 self.local_tree = local_bzrdir.open_workingtree()
49 self.build_tree_contents([('local/file', b'local')])
50- self.local_tree.commit('second commit', rev_id=b'local')
51+ local = self.local_tree.commit('second commit')
52+ return parent, local
53
54 _default_command = ['send', '-o-', '../parent']
55 _default_wd = 'local'
56- _default_sent_revs = [b'local']
57+ _default_sent_revs = None
58 _default_errors = ['Working tree ".*/local/" has uncommitted '
59 'changes \\(See brz status\\)\\.', ]
60 _default_additional_error = 'Use --no-strict to force the send.\n'
61@@ -311,7 +312,7 @@
62 else:
63 err_re = []
64 if revs is None:
65- revs = self._default_sent_revs
66+ revs = self._default_sent_revs or [self.local]
67 out, err = self.run_send(args, err_re=err_re)
68 if len(revs) == 1:
69 bundling_revs = 'Bundling %d revision.\n' % len(revs)
70@@ -324,7 +325,7 @@
71 self.assertEqual(bundling_revs, err)
72 md = merge_directive.MergeDirective.from_lines(
73 BytesIO(out.encode('utf-8')))
74- self.assertEqual(b'parent', md.base_revision_id)
75+ self.assertEqual(self.parent, md.base_revision_id)
76 br = serializer.read_bundle(BytesIO(md.get_raw_bundle()))
77 self.assertEqual(set(revs), set(r.revision_id for r in br.revisions))
78
79@@ -334,7 +335,7 @@
80
81 def setUp(self):
82 super(TestSendStrictWithoutChanges, self).setUp()
83- self.make_parent_and_local_branches()
84+ self.parent, self.local = self.make_parent_and_local_branches()
85
86 def test_send_without_workingtree(self):
87 ControlDir.open("local").destroy_workingtree()
88@@ -383,12 +384,12 @@
89 do_changes_func()
90
91 def _uncommitted_changes(self):
92- self.make_parent_and_local_branches()
93+ self.parent, self.local = self.make_parent_and_local_branches()
94 # Make a change without committing it
95 self.build_tree_contents([('local/file', b'modified')])
96
97 def _pending_merges(self):
98- self.make_parent_and_local_branches()
99+ self.parent, self.local = self.make_parent_and_local_branches()
100 # Create 'other' branch containing a new file
101 other_bzrdir = self.parent_tree.controldir.sprout('other')
102 other_tree = other_bzrdir.open_workingtree()
103@@ -400,7 +401,7 @@
104 self.local_tree.revert(filenames=['other-file'], backups=False)
105
106 def _out_of_sync_trees(self):
107- self.make_parent_and_local_branches()
108+ self.parent, self.local = self.make_parent_and_local_branches()
109 self.run_bzr(['checkout', '--lightweight', 'local', 'checkout'])
110 # Make a change and commit it
111 self.build_tree_contents([('local/file', b'modified in local')])
112@@ -409,13 +410,13 @@
113 self._default_wd = 'checkout'
114 self._default_errors = ["Working tree is out of date, please run"
115 " 'brz update'\\.", ]
116- self._default_sent_revs = [b'modified-in-local', b'local']
117+ self._default_sent_revs = [b'modified-in-local', self.local]
118
119 def test_send_default(self):
120 self.assertSendSucceeds([], with_warning=True)
121
122 def test_send_with_revision(self):
123- self.assertSendSucceeds(['-r', 'revid:local'], revs=[b'local'])
124+ self.assertSendSucceeds(['-r', 'revid:' + self.local.decode('utf-8')], revs=[self.local])
125
126 def test_send_no_strict(self):
127 self.assertSendSucceeds(['--no-strict'])
128
129=== modified file 'breezy/tests/per_branch/test_pull.py'
130--- breezy/tests/per_branch/test_pull.py 2021-12-25 14:55:24 +0000
131+++ breezy/tests/per_branch/test_pull.py 2021-12-27 23:17:52 +0000
132@@ -300,7 +300,11 @@
133 # branch of the default type, which does allow binding.
134 # See https://bugs.launchpad.net/bzr/+bug/112020
135 local = controldir.ControlDir.create_branch_convenience('local2')
136- local.bind(target)
137+ try:
138+ local.bind(target)
139+ except branch.BindingUnsupported:
140+ raise TestNotApplicable(
141+ 'default format does not support binding')
142 source = self.make_branch('source')
143 branch.Branch.hooks.install_named_hook(
144 'post_pull', self.capture_post_pull_hook, None)
145
146=== modified file 'breezy/tests/per_branch/test_push.py'
147--- breezy/tests/per_branch/test_push.py 2021-12-25 14:55:24 +0000
148+++ breezy/tests/per_branch/test_push.py 2021-12-27 23:17:52 +0000
149@@ -351,7 +351,11 @@
150 # branch of the default type, which does allow binding.
151 # See https://bugs.launchpad.net/bzr/+bug/112020
152 local = controldir.ControlDir.create_branch_convenience('local2')
153- local.bind(target)
154+ try:
155+ local.bind(target)
156+ except branch.BindingUnsupported:
157+ raise tests.TestNotApplicable(
158+ 'default format does not support binding')
159 source = self.make_branch('source')
160 branch.Branch.hooks.install_named_hook(
161 'post_push', self.capture_post_push_hook, None)
162
163=== modified file 'breezy/tests/per_merger.py'
164--- breezy/tests/per_merger.py 2021-12-27 13:56:34 +0000
165+++ breezy/tests/per_merger.py 2021-12-27 23:17:52 +0000
166@@ -351,7 +351,11 @@
167 builder = self.make_merge_builder()
168 self.create_file_needing_contents_merge(builder, "name1")
169 conflicts = builder.merge(self.merge_type)
170- self.assertEqual(conflicts, [TextConflict('name1', file_id=b'name1-id')])
171+ self.assertEqual(1, len(conflicts))
172+ [conflict] = conflicts
173+ self.assertEqual('text conflict', conflict.typestring)
174+ if builder.this.supports_file_ids:
175+ self.assertEqual(conflict.file_id, builder.this.path2id('name1'))
176 # The hook still gets to set the file contents in this case, so that it
177 # can insert custom conflict markers.
178 with builder.this.get_file('name1') as f:
179
180=== modified file 'setup.py'
181--- setup.py 2021-12-25 12:35:22 +0000
182+++ setup.py 2021-12-27 23:17:52 +0000
183@@ -588,8 +588,9 @@
184 version=version_str,
185 description=META_INFO['description'],
186 maintainer=META_INFO['maintainer'],
187- copyright="Copyright 2005-2012 Canonical Ltd.\n"
188- "Copyright 2017-2021 Breezy developers",
189+ copyright=(
190+ "Copyright 2005-2012 Canonical Ltd.\n"
191+ "Copyright 2017-2021 Breezy developers"),
192 company_name="Canonical Ltd.",
193 comments=META_INFO['description'],
194 )

Subscribers

People subscribed via source and target branches