Rev 3824: Bring in Vincent's brisbane-core test fixes. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/inv_as_lines

John Arbash Meinel john at arbash-meinel.com
Wed Feb 18 14:57:26 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/inv_as_lines

------------------------------------------------------------
revno: 3824
revision-id: john at arbash-meinel.com-20090218145711-vp1n7ows6d4gx39k
parent: john at arbash-meinel.com-20090217200320-zxkvs2n9kaf26ky9
parent: v.ladeuil+lp at free.fr-20090218092113-ld7s24aqzt65v216
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: inv_as_lines
timestamp: Wed 2009-02-18 08:57:11 -0600
message:
  Bring in Vincent's brisbane-core test fixes.
modified:
  bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.5
    revision-id: v.ladeuil+lp at free.fr-20090218092113-ld7s24aqzt65v216
    parent: v.ladeuil+lp at free.fr-20090216110132-c56aaj9x3wpezu34
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: brisbane-core
    timestamp: Wed 2009-02-18 10:21:13 +0100
    message:
      Better fix with explanation for zlib.crc32.
      
      * bzrlib/chk_map.py:
      (_search_key_255): Change mask to 0xFFFFFFFF to ensure *unsigned*
      value is always used whatever python version or platform we're
      running.
    modified:
      bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
    ------------------------------------------------------------
    revno: 3814.1.4
    revision-id: v.ladeuil+lp at free.fr-20090216110132-c56aaj9x3wpezu34
    parent: v.ladeuil+lp at free.fr-20090214135200-0y4c8fl041tz2gug
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: brisbane-core
    timestamp: Mon 2009-02-16 12:01:32 +0100
    message:
      Cough, stop harassing early testers.
      
      * bzrlib/tests/test_pack_repository.py:
      (load_tests): Revert the fix but mark the place.
      
      * bzrlib/repository.py:
      (MRepositoryFormatPackDevelopment4,
      RepositoryFormatPackDevelopment4Subtree): Revert the fix but mark
      the place.
      
      * bzrlib/repofmt/pack_repo.py:
      (RepositoryFormatPackDevelopment4.get_format_string,
      RepositoryFormatPackDevelopment4Subtree.get_format_string): Bah,
      revert the fix but mark the place.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.3
    revision-id: v.ladeuil+lp at free.fr-20090214135200-0y4c8fl041tz2gug
    parent: v.ladeuil+lp at free.fr-20090214115707-xbgt9a0mtlwr4h6g
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: brisbane-core
    timestamp: Sat 2009-02-14 14:52:00 +0100
    message:
      Fix test failing on files present in obsolete_packs directory.
      
      * bzrlib/tests/test_pack_repository.py:
      (TestPackRepository.test_commit_across_pack_shape_boundary_autopacks,
      TestPackRepositoryStacking.test_autopack_only_considers_main_repo_packs):
      Adjust pack files number to be checked.
    modified:
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.2
    revision-id: v.ladeuil+lp at free.fr-20090214115707-xbgt9a0mtlwr4h6g
    parent: john at arbash-meinel.com-20090212223418-0srirubvn4ybz180
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: brisbane-core
    timestamp: Sat 2009-02-14 12:57:07 +0100
    message:
      Trivial format strings adjustments.
      
      * test_pack_repository.py:
      (load_tests): Not before 1.13 for development4 formats.
      
      * repository.py:
      (RepositoryFormatPackDevelopment4,
      RepositoryFormatPackDevelopment4Subtree): Not before 1.13.
      
      * pack_repo.py:
      (RepositoryFormatPackDevelopment4.get_format_string,
      RepositoryFormatPackDevelopment4Subtree.get_format_string): Not
      before 1.13.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2009-02-12 22:35:53 +0000
+++ b/bzrlib/chk_map.py	2009-02-18 14:57:11 +0000
@@ -76,7 +76,13 @@
     We use 255-way because '\n' is used as a delimiter, and causes problems
     while parsing.
     """
-    bytes = '\x00'.join([struct.pack('>i', zlib.crc32(bit)) for bit in key])
+    # Depending on python version and platform, zlib.crc32 will return either a
+    # signed (<= 2.5 >= 3.0) or an unsigned (2.5, 2.6).
+    # http://docs.python.org/library/zlib.html recommends using a mask to force
+    # an unsigned value to ensure the same numeric value (unsigned) is obtained
+    # across all python versions and platforms.
+    bytes = '\x00'.join([struct.pack('>L', zlib.crc32(bit)&0xFFFFFFFF)
+                         for bit in key])
     return bytes.replace('\n', '_')
 
 

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2009-02-13 20:04:19 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2009-02-18 14:57:11 +0000
@@ -2901,6 +2901,10 @@
 
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
+        # This will need to be updated (at least replacing 1.13 with the target
+        # bzr release) once we merge brisbane-core into bzr.dev, I've used
+        # 'merge-bbc-dev4-to-bzr.dev' into comments at relevant places to make
+        # them easily greppable.  -- vila 2009016
         return "Bazaar development format 5 (needs bzr.dev from before 1.13)\n"
 
     def get_format_description(self):
@@ -2951,6 +2955,7 @@
 
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
+        # merge-bbc-dev4-to-bzr.dev
         return ("Bazaar development format 5 with subtree support"
                 " (needs bzr.dev from before 1.13)\n")
 

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-02-13 19:54:48 +0000
+++ b/bzrlib/repository.py	2009-02-18 14:57:11 +0000
@@ -2552,23 +2552,27 @@
     )
 # 1.9->1.110 go below here
 format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
     "Bazaar development format 5 (needs bzr.dev from before 1.13)\n",
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatPackDevelopment5',
     )
 format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
     ("Bazaar development format 5 with subtree support"
      " (needs bzr.dev from before 1.13)\n"),
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatPackDevelopment5Subtree',
     )
 format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
     ('Bazaar development format 5 hash 16'
      ' (needs bzr.dev from before 1.13)\n'),
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatPackDevelopment5Hash16',
     )
 format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
     ('Bazaar development format 5 hash 255'
      ' (needs bzr.dev from before 1.13)\n'),
     'bzrlib.repofmt.pack_repo',

=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2009-02-17 20:03:20 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2009-02-18 14:57:11 +0000
@@ -207,15 +207,14 @@
         tree = tree.bzrdir.open_workingtree()
         check_result = tree.branch.repository.check(
             [tree.branch.last_revision()])
-        # We should have 50 (10x5) files in the obsolete_packs directory.
-        # If supports_chks, then we have 60
+        nb_files = 5 # .pack, .rix, .iix, .tix, .six
+        if tree.branch.repository._format.supports_chks:
+            nb_files += 1 # .cix
+        # We should have 10 x nb_files files in the obsolete_packs directory.
         obsolete_files = list(trans.list_dir('obsolete_packs'))
         self.assertFalse('foo' in obsolete_files)
         self.assertFalse('bar' in obsolete_files)
-        if tree.branch.repository._format.supports_chks:
-            self.assertEqual(60, len(obsolete_files))
-        else:
-            self.assertEqual(50, len(obsolete_files))
+        self.assertEqual(10 * nb_files, len(obsolete_files))
         # XXX: Todo check packs obsoleted correctly - old packs and indices
         # in the obsolete_packs directory.
         large_pack_name = list(index.iter_all_entries())[0][1][0]
@@ -681,9 +680,10 @@
         self.assertEqual(1, len(new_instance._pack_collection.all_packs()))
 
     def test_autopack_only_considers_main_repo_packs(self):
-        base = self.make_branch_and_tree('base', format=self.get_format())
+        format = self.get_format()
+        base = self.make_branch_and_tree('base', format=format)
         base.commit('foo')
-        tree = self.make_branch_and_tree('repo', format=self.get_format())
+        tree = self.make_branch_and_tree('repo', format=format)
         tree.branch.repository.add_fallback_repository(base.branch.repository)
         trans = tree.branch.repository.bzrdir.get_repository_transport(None)
         # This test could be a little cheaper by replacing the packs
@@ -704,15 +704,14 @@
         tree = tree.bzrdir.open_workingtree()
         check_result = tree.branch.repository.check(
             [tree.branch.last_revision()])
-        # We should have 50 (10x5) files in the obsolete_packs directory.
-        # If supports_chks, then we have 60
+        nb_files = 5 # .pack, .rix, .iix, .tix, .six
+        if tree.branch.repository._format.supports_chks:
+            nb_files += 1 # .cix
+        # We should have 10 x nb_files files in the obsolete_packs directory.
         obsolete_files = list(trans.list_dir('obsolete_packs'))
         self.assertFalse('foo' in obsolete_files)
         self.assertFalse('bar' in obsolete_files)
-        if tree.branch.repository._format.supports_chks:
-            self.assertEqual(60, len(obsolete_files))
-        else:
-            self.assertEqual(50, len(obsolete_files))
+        self.assertEqual(10 * nb_files, len(obsolete_files))
         # XXX: Todo check packs obsoleted correctly - old packs and indices
         # in the obsolete_packs directory.
         large_pack_name = list(index.iter_all_entries())[0][1][0]
@@ -804,21 +803,25 @@
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
          dict(format_name='development5',
+              # merge-bbc-dev4-to-bzr.dev
               format_string="Bazaar development format 5 "
                   "(needs bzr.dev from before 1.13)\n",
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
          dict(format_name='development5-subtree',
+              # merge-bbc-dev4-to-bzr.dev
               format_string="Bazaar development format 5 "
                   "with subtree support (needs bzr.dev from before 1.13)\n",
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
          dict(format_name='development5-hash16',
+              # merge-bbc-dev4-to-bzr.dev
               format_string="Bazaar development format 5 hash 16"
                             " (needs bzr.dev from before 1.13)\n",
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
          dict(format_name='development5-hash255',
+              # merge-bbc-dev4-to-bzr.dev
               format_string="Bazaar development format 5 hash 255"
                             " (needs bzr.dev from before 1.13)\n",
               format_supports_external_lookups=True,



More information about the bazaar-commits mailing list