Rev 4733: Possible fix for making sure packs triggering autopacking get cleaned up. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-autopack-rename-507557

John Arbash Meinel john at arbash-meinel.com
Thu Jan 21 19:18:20 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-autopack-rename-507557

------------------------------------------------------------
revno: 4733
revision-id: john at arbash-meinel.com-20100121191756-f9q5w6pw995w7drr
parent: john at arbash-meinel.com-20100121165921-rcie6mtki4a1i4j3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-autopack-rename-507557
timestamp: Thu 2010-01-21 13:17:56 -0600
message:
  Possible fix for making sure packs triggering autopacking get cleaned up.
-------------- next part --------------
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2010-01-21 16:59:21 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2010-01-21 19:17:56 +0000
@@ -1987,8 +1987,8 @@
         if obsolete_packs:
             orig_disk_names = set([x[0][0] for x in orig_disk_nodes])
             obsolete_packs = [o for o in obsolete_packs
-                              if o.name not in already_obsolete
-                                  and o.name in orig_disk_names]
+                if o.name not in already_obsolete
+                    and (o.name in orig_disk_names or isinstance(o, NewPack))]
             self._obsolete_packs(obsolete_packs)
         return [new_node[0][0] for new_node in new_nodes]
 

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2010-01-20 19:45:25 +0000
+++ b/bzrlib/tests/test_repository.py	2010-01-21 19:17:56 +0000
@@ -1366,6 +1366,22 @@
         self.assertEqual([to_remove_name],
                          sorted([x[0][0] for x in deleted_nodes]))
 
+    def test_autopack_obsoletes_new_pack(self):
+        tree, r, packs, revs = self.make_packs_and_alt_repo(write_lock=True)
+        packs._max_pack_count = lambda x: 1
+        packs.pack_distribution = lambda x: [10]
+        r.start_write_group()
+        r.revisions.insert_record_stream([versionedfile.FulltextContentFactory(
+            ('bogus-rev',), (), None, 'bogus-content\n')])
+        # This should trigger an autopack, which will combine everything into a
+        # single pack file.
+        import pdb; pdb.set_trace()
+        new_names = r.commit_write_group()
+        names = packs.names()
+        self.assertEqual(1, len(names))
+        self.assertEqual([names[0] + '.pack'],
+                         packs._pack_transport.list_dir('.'))
+
     def test_autopack_reloads_and_stops(self):
         tree, r, packs, revs = self.make_packs_and_alt_repo(write_lock=True)
         # After we have determined what needs to be autopacked, trigger a



More information about the bazaar-commits mailing list