Merge lp:~lifeless/bzr/bug-375013 into lp:~bzr/bzr/trunk-old

Proposed by Robert Collins
Status: Superseded
Proposed branch: lp:~lifeless/bzr/bug-375013
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 395 lines
To merge this branch: bzr merge lp:~lifeless/bzr/bug-375013
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+9908@code.launchpad.net

This proposal has been superseded by a proposal from 2009-08-11.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Fix test_branch_from_trivial_stacked_branch_streaming_acceptance to work
with rich root formats, pending work on bug 375013.

Basically, committing to stacked branches is broken if there is any
actual content, but this test isn't trying to exercise that - and this
prevents changing the default in our test suite to a rich root format.

So I've fixed the test, and that may permit us to reduce the priority of
the bug (as its an existing defect in bzr, for any rich root format).

-Rob

Revision history for this message
Martin Pool (mbp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-08-10 08:26:42 +0000
3+++ NEWS 2009-08-11 05:35:11 +0000
4@@ -9,18 +9,57 @@
5 In Development
6 ##############
7
8+Compatibility Breaks
9+********************
10+
11+* Committing directly to a stacked branch from a lightweight checkout will
12+ no longer work. In previous versions this would appear to work but would
13+ generate repositories with insufficient data to create deltas, leading
14+ to later errors when branching or reading from the repository.
15+ (Robert Collins, bug #375013)
16+
17+New Features
18+************
19+
20 Bug Fixes
21 *********
22
23 * Further tweaks to handling of ``bzr add`` messages about ignored files.
24 (Jason Spashett, #76616)
25
26-
27-In Development
28-##############
29-
30-Compatibility Breaks
31-********************
32+Improvements
33+************
34+
35+Documentation
36+*************
37+
38+API Changes
39+***********
40+
41+Internals
42+*********
43+
44+Testing
45+*******
46+
47+
48+bzr 1.18
49+########
50+
51+:Codename: little traveller
52+:1.18rc1: 2009-08-10
53+
54+This release of Bazaar marches on towards the 2.0 release in which the 2a
55+'brisbane-core' format becomes generally recommended. Most of the work in
56+this release now focusses on bug fixes and stabilization, covering both 2a
57+and previous formats. There is a new text-mode interactive merge feature,
58+a new guide to migration to 2a format in the user documentation, and
59+pushing branches to a smart server is now much faster.
60+
61+The Bazaar team decided that 2.0 will be a long-term supported release,
62+with bugfix-only releases based on it continuing for at least six months
63+or until the following stable release.
64+
65
66 New Features
67 ************
68@@ -948,7 +987,7 @@
69 (Vincent Ladeuil, Robert Collins)
70
71 bzr 1.14
72-###########
73+########
74 :Codename: brisbane-core
75 :1.14rc1: 2009-04-06
76 :1.14rc2: 2009-04-19
77
78=== modified file 'bzr'
79--- bzr 2009-07-30 23:54:26 +0000
80+++ bzr 2009-08-11 05:35:11 +0000
81@@ -23,7 +23,7 @@
82 import warnings
83
84 # update this on each release
85-_script_version = (1, 18, 0)
86+_script_version = (2, 0, 0)
87
88 if __doc__ is None:
89 print "bzr does not support python -OO."
90
91=== modified file 'bzrlib/__init__.py'
92--- bzrlib/__init__.py 2009-07-20 11:27:05 +0000
93+++ bzrlib/__init__.py 2009-08-11 05:35:11 +0000
94@@ -50,7 +50,7 @@
95 # Python version 2.0 is (2, 0, 0, 'final', 0)." Additionally we use a
96 # releaselevel of 'dev' for unreleased under-development code.
97
98-version_info = (1, 18, 0, 'dev', 0)
99+version_info = (2, 0, 0, 'dev', 0)
100
101 # API compatibility version: bzrlib is currently API compatible with 1.15.
102 api_minimum_version = (1, 17, 0)
103
104=== modified file 'bzrlib/repository.py'
105--- bzrlib/repository.py 2009-08-06 02:23:37 +0000
106+++ bzrlib/repository.py 2009-08-11 05:35:11 +0000
107@@ -1695,6 +1695,10 @@
108 :param revprops: Optional dictionary of revision properties.
109 :param revision_id: Optional revision id.
110 """
111+ if self._fallback_repositories:
112+ raise errors.BzrError("Cannot commit from a lightweight checkout "
113+ "to a stacked branch. See "
114+ "https://bugs.launchpad.net/bzr/+bug/375013 for details.")
115 result = self._commit_builder_class(self, parents, config,
116 timestamp, timezone, committer, revprops, revision_id)
117 self.start_write_group()
118
119=== modified file 'bzrlib/tests/blackbox/test_branch.py'
120--- bzrlib/tests/blackbox/test_branch.py 2009-08-03 04:19:03 +0000
121+++ bzrlib/tests/blackbox/test_branch.py 2009-08-11 05:35:11 +0000
122@@ -149,29 +149,6 @@
123 class TestBranchStacked(ExternalBase):
124 """Tests for branch --stacked"""
125
126- def check_shallow_branch(self, branch_revid, stacked_on):
127- """Assert that the branch 'newbranch' has been published correctly.
128-
129- :param stacked_on: url of a branch this one is stacked upon.
130- :param branch_revid: a revision id that should be the only
131- revision present in the stacked branch, and it should not be in
132- the reference branch.
133- """
134- new_branch = branch.Branch.open('newbranch')
135- # The branch refers to the mainline
136- self.assertEqual(stacked_on, new_branch.get_stacked_on_url())
137- # and the branch's work was pushed
138- self.assertTrue(new_branch.repository.has_revision(branch_revid))
139- # The newly committed revision shoud be present in the stacked branch,
140- # but not in the stacked-on branch. Because stacking is set up by the
141- # branch object, if we open the stacked branch's repository directly,
142- # bypassing the branch, we see only what's in the stacked repository.
143- stacked_repo = bzrdir.BzrDir.open('newbranch').open_repository()
144- stacked_repo_revisions = set(stacked_repo.all_revision_ids())
145- if len(stacked_repo_revisions) != 1:
146- self.fail("wrong revisions in stacked repository: %r"
147- % (stacked_repo_revisions,))
148-
149 def assertRevisionInRepository(self, repo_path, revid):
150 """Check that a revision is in a repository, disregarding stacking."""
151 repo = bzrdir.BzrDir.open(repo_path).open_repository()
152@@ -198,12 +175,14 @@
153 format='1.9')
154 branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
155 # with some work on it
156- branch_tree.commit('moar work plz')
157+ work_tree = trunk_tree.branch.bzrdir.sprout('local').open_workingtree()
158+ work_tree.commit('moar work plz')
159+ work_tree.branch.push(branch_tree.branch)
160 # branching our local branch gives us a new stacked branch pointing at
161 # mainline.
162 out, err = self.run_bzr(['branch', 'branch', 'newbranch'])
163 self.assertEqual('', out)
164- self.assertEqual('Branched 1 revision(s).\n',
165+ self.assertEqual('Branched 2 revision(s).\n',
166 err)
167 # it should have preserved the branch format, and so it should be
168 # capable of supporting stacking, but not actually have a stacked_on
169@@ -222,7 +201,9 @@
170 format='1.9')
171 branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base)
172 # with some work on it
173- branch_revid = branch_tree.commit('moar work plz')
174+ work_tree = trunk_tree.branch.bzrdir.sprout('local').open_workingtree()
175+ branch_revid = work_tree.commit('moar work plz')
176+ work_tree.branch.push(branch_tree.branch)
177 # you can chain branches on from there
178 out, err = self.run_bzr(['branch', 'branch', '--stacked', 'branch2'])
179 self.assertEqual('', out)
180@@ -231,7 +212,8 @@
181 self.assertEqual(branch_tree.branch.base,
182 branch.Branch.open('branch2').get_stacked_on_url())
183 branch2_tree = WorkingTree.open('branch2')
184- branch2_revid = branch2_tree.commit('work on second stacked branch')
185+ branch2_revid = work_tree.commit('work on second stacked branch')
186+ work_tree.branch.push(branch2_tree.branch)
187 self.assertRevisionInRepository('branch2', branch2_revid)
188 self.assertRevisionsInBranchRepository(
189 [trunk_revid, branch_revid, branch2_revid],
190@@ -250,9 +232,8 @@
191 self.assertEqual('Created new stacked branch referring to %s.\n' %
192 trunk_tree.branch.base, err)
193 self.assertRevisionNotInRepository('newbranch', original_revid)
194- new_tree = WorkingTree.open('newbranch')
195- new_revid = new_tree.commit('new work')
196- self.check_shallow_branch(new_revid, trunk_tree.branch.base)
197+ new_branch = branch.Branch.open('newbranch')
198+ self.assertEqual(trunk_tree.branch.base, new_branch.get_stacked_on_url())
199
200 def test_branch_stacked_from_smart_server(self):
201 # We can branch stacking on a smart server
202@@ -329,7 +310,9 @@
203 t.commit(message='commit %d' % count)
204 tree2 = t.branch.bzrdir.sprout('feature', stacked=True
205 ).open_workingtree()
206- tree2.commit('feature change')
207+ local_tree = t.branch.bzrdir.sprout('local-working').open_workingtree()
208+ local_tree.commit('feature change')
209+ local_tree.branch.push(tree2.branch)
210 self.reset_smart_call_log()
211 out, err = self.run_bzr(['branch', self.get_url('feature'),
212 'local-target'])
213
214=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
215--- bzrlib/tests/per_branch/test_stacking.py 2009-08-05 02:30:59 +0000
216+++ bzrlib/tests/per_branch/test_stacking.py 2009-08-11 05:35:11 +0000
217@@ -150,8 +150,8 @@
218 raise TestNotApplicable(e)
219 # stacked repository
220 self.assertRevisionNotInRepository('newbranch', trunk_revid)
221- new_tree = new_dir.open_workingtree()
222- new_branch_revid = new_tree.commit('something local')
223+ tree = new_dir.open_branch().create_checkout('local')
224+ new_branch_revid = tree.commit('something local')
225 self.assertRevisionNotInRepository('mainline', new_branch_revid)
226 self.assertRevisionInRepository('newbranch', new_branch_revid)
227
228@@ -173,8 +173,8 @@
229 new_dir = remote_bzrdir.sprout('newbranch', stacked=True)
230 # stacked repository
231 self.assertRevisionNotInRepository('newbranch', trunk_revid)
232- new_tree = new_dir.open_workingtree()
233- new_branch_revid = new_tree.commit('something local')
234+ tree = new_dir.open_branch().create_checkout('local')
235+ new_branch_revid = tree.commit('something local')
236 self.assertRevisionNotInRepository('mainline', new_branch_revid)
237 self.assertRevisionInRepository('newbranch', new_branch_revid)
238
239@@ -333,7 +333,8 @@
240
241 def test_fetch_copies_from_stacked_on_and_stacked(self):
242 stacked, unstacked = self.prepare_stacked_on_fetch()
243- stacked.commit('second commit', rev_id='rev2')
244+ tree = stacked.branch.create_checkout('local')
245+ tree.commit('second commit', rev_id='rev2')
246 unstacked.fetch(stacked.branch.repository, 'rev2')
247 unstacked.get_revision('rev1')
248 unstacked.get_revision('rev2')
249@@ -355,13 +356,15 @@
250 stack_on.add('a')
251 stack_on.commit('base commit')
252 stacked_dir = stack_on.bzrdir.sprout('stacked', stacked=True)
253- stacked_tree = stacked_dir.open_workingtree()
254+ stacked_branch = stacked_dir.open_branch()
255+ local_tree = stack_on.bzrdir.sprout('local').open_workingtree()
256 for i in range(20):
257 text_lines[0] = 'changed in %d\n' % i
258- self.build_tree_contents([('stacked/a', ''.join(text_lines))])
259- stacked_tree.commit('commit %d' % i)
260- stacked_tree.branch.repository.pack()
261- check.check_dwim(stacked_tree.branch.base, False, True, True)
262+ self.build_tree_contents([('local/a', ''.join(text_lines))])
263+ local_tree.commit('commit %d' % i)
264+ local_tree.branch.push(stacked_branch)
265+ stacked_branch.repository.pack()
266+ check.check_dwim(stacked_branch.base, False, True, True)
267
268 def test_pull_delta_when_stacked(self):
269 if not self.branch_format.supports_stacking():
270@@ -470,7 +473,8 @@
271 except errors.NoWorkingTree:
272 stacked = stacked_dir.open_branch().create_checkout(
273 'stacked-checkout', lightweight=True)
274- stacked.commit('second commit', rev_id='rev2')
275+ tree = stacked.branch.create_checkout('local')
276+ tree.commit('second commit', rev_id='rev2')
277 # Sanity check: stacked's repo should not contain rev1, otherwise this
278 # test isn't testing what it's supposed to.
279 repo = stacked.branch.repository.bzrdir.open_repository()
280
281=== modified file 'bzrlib/tests/per_repository/test_commit_builder.py'
282--- bzrlib/tests/per_repository/test_commit_builder.py 2009-05-06 05:36:28 +0000
283+++ bzrlib/tests/per_repository/test_commit_builder.py 2009-08-11 05:35:11 +0000
284@@ -1267,3 +1267,19 @@
285 self.addCleanup(branch.repository.abort_write_group)
286 self.assertRaises(ValueError, builder.commit,
287 u'Invalid\r\ncommit message\r\n')
288+
289+ def test_stacked_repositories_reject_commit_builder(self):
290+ # As per bug 375013, committing to stacked repositories is currently
291+ # broken, so repositories with fallbacks refuse to hand out a commit
292+ # builder.
293+ repo_basis = self.make_repository('basis')
294+ branch = self.make_branch('local')
295+ repo_local = branch.repository
296+ try:
297+ repo_local.add_fallback_repository(repo_basis)
298+ except errors.UnstackableRepositoryFormat:
299+ raise tests.TestNotApplicable("not a stackable format.")
300+ repo_local.lock_write()
301+ self.addCleanup(repo_local.unlock)
302+ self.assertRaises(errors.BzrError, repo_local.get_commit_builder,
303+ branch, [], branch.get_config())
304
305=== modified file 'bzrlib/tests/per_repository_reference/test_check.py'
306--- bzrlib/tests/per_repository_reference/test_check.py 2009-03-23 14:59:43 +0000
307+++ bzrlib/tests/per_repository_reference/test_check.py 2009-08-11 05:35:11 +0000
308@@ -33,8 +33,9 @@
309 referring = self.make_branch_and_tree('referring')
310 readonly_base = self.readonly_repository('base')
311 referring.branch.repository.add_fallback_repository(readonly_base)
312- self.build_tree_contents([('referring/file', 'change')])
313- rev2_id = referring.commit('two')
314+ local_tree = referring.branch.create_checkout('local')
315+ self.build_tree_contents([('local/file', 'change')])
316+ rev2_id = local_tree.commit('two')
317 check_result = referring.branch.repository.check(
318 referring.branch.repository.all_revision_ids())
319 check_result.report_results(verbose=False)
320
321=== modified file 'bzrlib/tests/test_pack_repository.py'
322--- bzrlib/tests/test_pack_repository.py 2009-07-17 10:38:41 +0000
323+++ bzrlib/tests/test_pack_repository.py 2009-08-11 05:35:11 +0000
324@@ -865,7 +865,8 @@
325 base.commit('foo')
326 referencing = self.make_branch_and_tree('repo', format=self.get_format())
327 referencing.branch.repository.add_fallback_repository(base.branch.repository)
328- referencing.commit('bar')
329+ local_tree = referencing.branch.create_checkout('local')
330+ local_tree.commit('bar')
331 new_instance = referencing.bzrdir.open_repository()
332 new_instance.lock_read()
333 self.addCleanup(new_instance.unlock)
334@@ -884,13 +885,14 @@
335 # and max packs policy - so we are checking the policy is honoured
336 # in the test. But for now 11 commits is not a big deal in a single
337 # test.
338+ local_tree = tree.branch.create_checkout('local')
339 for x in range(9):
340- tree.commit('commit %s' % x)
341+ local_tree.commit('commit %s' % x)
342 # there should be 9 packs:
343 index = self.index_class(trans, 'pack-names', None)
344 self.assertEqual(9, len(list(index.iter_all_entries())))
345 # committing one more should coalesce to 1 of 10.
346- tree.commit('commit triggering pack')
347+ local_tree.commit('commit triggering pack')
348 index = self.index_class(trans, 'pack-names', None)
349 self.assertEqual(1, len(list(index.iter_all_entries())))
350 # packing should not damage data
351@@ -909,7 +911,7 @@
352 # in the obsolete_packs directory.
353 large_pack_name = list(index.iter_all_entries())[0][1][0]
354 # finally, committing again should not touch the large pack.
355- tree.commit('commit not triggering pack')
356+ local_tree.commit('commit not triggering pack')
357 index = self.index_class(trans, 'pack-names', None)
358 self.assertEqual(2, len(list(index.iter_all_entries())))
359 pack_names = [node[1][0] for node in index.iter_all_entries()]
360
361=== modified file 'bzrlib/tests/test_remote.py'
362--- bzrlib/tests/test_remote.py 2009-07-30 04:27:05 +0000
363+++ bzrlib/tests/test_remote.py 2009-08-11 05:35:11 +0000
364@@ -2651,7 +2651,8 @@
365 tree1.commit('rev1', rev_id='rev1')
366 tree2 = tree1.branch.bzrdir.sprout('tree2', stacked=True
367 ).open_workingtree()
368- tree2.commit('local changes make me feel good.')
369+ local_tree = tree2.branch.create_checkout('local')
370+ local_tree.commit('local changes make me feel good.')
371 branch2 = Branch.open(self.get_url('tree2'))
372 branch2.lock_read()
373 self.addCleanup(branch2.unlock)
374@@ -2727,7 +2728,8 @@
375 _, stacked = self.prepare_stacked_remote_branch()
376 tree = stacked.bzrdir.sprout('tree3', stacked=True
377 ).open_workingtree()
378- tree.commit('more local changes are better')
379+ local_tree = tree.branch.create_checkout('local-tree3')
380+ local_tree.commit('more local changes are better')
381 branch = Branch.open(self.get_url('tree3'))
382 branch.lock_read()
383 return None, branch
384@@ -2744,8 +2746,9 @@
385 # stacked upon sources in topological order.
386 rev_ord, expected_revs = self.get_ordered_revs('knit', 'topological')
387 self.assertEqual(expected_revs, rev_ord)
388- # Getting topological sort requires VFS calls still
389- self.assertLength(12, self.hpss_calls)
390+ # Getting topological sort requires VFS calls still - one of which is
391+ # pushing up from the bound branch.
392+ self.assertLength(13, self.hpss_calls)
393
394 def test_stacked_get_stream_groupcompress(self):
395 # Repository._get_source.get_stream() from a stacked repository with