Merge lp:~lifeless/bzr/bug-423818 into lp:bzr/2.0

Proposed by Robert Collins
Status: Merged
Approved by: Martin Pool
Approved revision: 4656
Merge reported by: Robert Collins
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr/bug-423818
Merge into: lp:bzr/2.0
Diff against target: None lines
To merge this branch: bzr merge lp:~lifeless/bzr/bug-423818
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+11279@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Oh hai. bug fixes.

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

> Oh hai. bug fixes.

do you want me to land this, or ..?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-09-04 07:47:47 +0000
3+++ NEWS 2009-09-06 20:34:43 +0000
4@@ -31,6 +31,14 @@
5 * Clearer message when Bazaar runs out of memory, instead of a ``MemoryError``
6 traceback. (Martin Pool, #109115)
7
8+* Conversion to 2a will create a single pack for all the new revisions (as
9+ long as it ran without interruption). This improves both ``bzr upgrade``
10+ and ``bzr pull`` or ``bzr merge`` from local branches in older formats.
11+ The autopack logic that occurs every 100 revisions during local
12+ conversions was not returning that pack's identifier, which resulted in
13+ the partial packs created during the conversion not being consolidated
14+ at the end of the conversion process. (Robert Collins, #423818)
15+
16 * Fetches from 2a to 2a are now again requested in 'groupcompress' order.
17 Groups that are seen as 'underutilized' will be repacked on-the-fly.
18 This means that when the source is fully packed, there is minimal
19
20=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
21--- bzrlib/repofmt/groupcompress_repo.py 2009-09-04 03:58:41 +0000
22+++ bzrlib/repofmt/groupcompress_repo.py 2009-09-06 20:34:43 +0000
23@@ -617,10 +617,11 @@
24 self._remove_pack_from_memory(pack)
25 # record the newly available packs and stop advertising the old
26 # packs
27- self._save_pack_names(clear_obsolete_packs=True)
28+ result = self._save_pack_names(clear_obsolete_packs=True)
29 # Move the old packs out of the way now they are no longer referenced.
30 for revision_count, packs in pack_operations:
31 self._obsolete_packs(packs)
32+ return result
33
34
35 class CHKInventoryRepository(KnitPackRepository):
36
37=== modified file 'bzrlib/repofmt/pack_repo.py'
38--- bzrlib/repofmt/pack_repo.py 2009-08-14 11:11:29 +0000
39+++ bzrlib/repofmt/pack_repo.py 2009-09-06 20:34:43 +0000
40@@ -2078,13 +2078,13 @@
41 "Repository %s has missing compression parent(s) %r "
42 % (self.repo, sorted(all_missing)))
43 self._remove_pack_indices(self._new_pack)
44- should_autopack = False
45+ any_new_content = False
46 if self._new_pack.data_inserted():
47 # get all the data to disk and read to use
48 self._new_pack.finish()
49 self.allocate(self._new_pack)
50 self._new_pack = None
51- should_autopack = True
52+ any_new_content = True
53 else:
54 self._new_pack.abort()
55 self._new_pack = None
56@@ -2095,13 +2095,15 @@
57 self._remove_pack_from_memory(resumed_pack)
58 resumed_pack.finish()
59 self.allocate(resumed_pack)
60- should_autopack = True
61+ any_new_content = True
62 del self._resumed_packs[:]
63- if should_autopack:
64- if not self.autopack():
65+ if any_new_content:
66+ result = self.autopack()
67+ if not result:
68 # when autopack takes no steps, the names list is still
69 # unsaved.
70 return self._save_pack_names()
71+ return result
72 return []
73
74 def _suspend_write_group(self):
75
76=== modified file 'bzrlib/tests/per_pack_repository.py'
77--- bzrlib/tests/per_pack_repository.py 2009-08-14 00:55:42 +0000
78+++ bzrlib/tests/per_pack_repository.py 2009-09-06 20:34:43 +0000
79@@ -239,31 +239,38 @@
80 self.assertTrue(large_pack_name in pack_names)
81
82 def test_commit_write_group_returns_new_pack_names(self):
83+ # This test doesn't need real disk.
84+ self.vfs_transport_factory = tests.MemoryServer
85 format = self.get_format()
86- tree = self.make_branch_and_tree('foo', format=format)
87- tree.commit('first post')
88- repo = tree.branch.repository
89+ repo = self.make_repository('foo', format=format)
90 repo.lock_write()
91 try:
92- repo.start_write_group()
93- try:
94- inv = inventory.Inventory(revision_id="A")
95- inv.root.revision = "A"
96- repo.texts.add_lines((inv.root.file_id, "A"), [], [])
97- rev = _mod_revision.Revision(timestamp=0, timezone=None,
98- committer="Foo Bar <foo@example.com>", message="Message",
99- revision_id="A")
100- rev.parent_ids = ()
101- repo.add_revision("A", rev, inv=inv)
102- except:
103- repo.abort_write_group()
104- raise
105- else:
106- old_names = repo._pack_collection._names.keys()
107- result = repo.commit_write_group()
108- cur_names = repo._pack_collection._names.keys()
109- new_names = list(set(cur_names) - set(old_names))
110- self.assertEqual(new_names, result)
111+ # All current pack repository styles autopack at 10 revisions; and
112+ # autopack as well as regular commit write group needs to return
113+ # the new pack name. Looping is a little ugly, but we don't have a
114+ # clean way to test both the autopack logic and the normal code
115+ # path without doing this loop.
116+ for pos in range(10):
117+ revid = str(pos)
118+ repo.start_write_group()
119+ try:
120+ inv = inventory.Inventory(revision_id=revid)
121+ inv.root.revision = revid
122+ repo.texts.add_lines((inv.root.file_id, revid), [], [])
123+ rev = _mod_revision.Revision(timestamp=0, timezone=None,
124+ committer="Foo Bar <foo@example.com>", message="Message",
125+ revision_id=revid)
126+ rev.parent_ids = ()
127+ repo.add_revision(revid, rev, inv=inv)
128+ except:
129+ repo.abort_write_group()
130+ raise
131+ else:
132+ old_names = repo._pack_collection._names.keys()
133+ result = repo.commit_write_group()
134+ cur_names = repo._pack_collection._names.keys()
135+ new_names = list(set(cur_names) - set(old_names))
136+ self.assertEqual(new_names, result)
137 finally:
138 repo.unlock()
139

Subscribers

People subscribed via source and target branches