Rev 3621: Merge in bzr.1.6 to get NEWS cleaned up. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/hpss_readv

John Arbash Meinel john at arbash-meinel.com
Fri Aug 29 13:25:01 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/hpss_readv

------------------------------------------------------------
revno: 3621
revision-id: john at arbash-meinel.com-20080829122453-pgvngxegwod5ttdf
parent: john at arbash-meinel.com-20080829052558-2j75lgu4g571z13f
parent: pqm at pqm.ubuntu.com-20080829065751-5a5hk6l80cg7v5c6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hpss_readv
timestamp: Fri 2008-08-29 07:24:53 -0500
message:
  Merge in bzr.1.6 to get NEWS cleaned up.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
  bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
  bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
  bzrlib/tests/test_upgrade_stacked.py test_upgrade_stacked-20080804072225-jd13yami19nskns5-1
    ------------------------------------------------------------
    revno: 3619.2.2
    revision-id: pqm at pqm.ubuntu.com-20080829065751-5a5hk6l80cg7v5c6
    parent: pqm at pqm.ubuntu.com-20080829055632-1d382i6dsatudrcg
    parent: john at arbash-meinel.com-20080829053033-sr6alv4rzfvlfwke
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: 1.6
    timestamp: Fri 2008-08-29 07:57:51 +0100
    message:
      (jam) Fix bug #261339 by always fetching Revision texts as fulltexts.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
        ------------------------------------------------------------
        revno: 3619.3.2
        revision-id: john at arbash-meinel.com-20080829053033-sr6alv4rzfvlfwke
        parent: john at arbash-meinel.com-20080829020522-kpkk0zvxf52oj3kh
        parent: john at arbash-meinel.com-20080829051928-wtobyp0rxuepozmi
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: bug_261339
        timestamp: Fri 2008-08-29 00:30:33 -0500
        message:
          Merge in rich-root-serializer to get the NEWS entry correct.
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
          bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
          bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
          bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
          bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
          bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
          bzrlib/tests/test_upgrade_stacked.py test_upgrade_stacked-20080804072225-jd13yami19nskns5-1
        ------------------------------------------------------------
        revno: 3619.3.1
        revision-id: john at arbash-meinel.com-20080829020522-kpkk0zvxf52oj3kh
        parent: pqm at pqm.ubuntu.com-20080825143827-fl7cocq59pqdig2p
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: bug_261339
        timestamp: Thu 2008-08-28 21:05:22 -0500
        message:
          Fix bug #261339, Always request full texts for Revision texts.
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
          bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
    ------------------------------------------------------------
    revno: 3619.2.1
    revision-id: pqm at pqm.ubuntu.com-20080829055632-1d382i6dsatudrcg
    parent: pqm at pqm.ubuntu.com-20080825143827-fl7cocq59pqdig2p
    parent: john at arbash-meinel.com-20080829051928-wtobyp0rxuepozmi
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: 1.6
    timestamp: Fri 2008-08-29 06:56:32 +0100
    message:
      (jam) Supersede the --1.6-rich-root format,
      	in favor of --1.6.1-rich-root, which gets the serializer right.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
      bzrlib/tests/test_upgrade_stacked.py test_upgrade_stacked-20080804072225-jd13yami19nskns5-1
    ------------------------------------------------------------
    revno: 3619.1.6
    revision-id: john at arbash-meinel.com-20080829051928-wtobyp0rxuepozmi
    parent: john at arbash-meinel.com-20080829051856-cybdbv604adwbzn1
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Fri 2008-08-29 00:19:28 -0500
    message:
      Cleanup NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3619.1.5
    revision-id: john at arbash-meinel.com-20080829051856-cybdbv604adwbzn1
    parent: john at arbash-meinel.com-20080829044612-i5eshappfji5sjfz
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Fri 2008-08-29 00:18:56 -0500
    message:
      Switch out --1.6-rich-root for --1.6.1-rich-root.
      
      Fix up the tests that were expecting the old name.
      Also add tests that stacking properly check the various
      permutations.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
      bzrlib/tests/test_upgrade_stacked.py test_upgrade_stacked-20080804072225-jd13yami19nskns5-1
    ------------------------------------------------------------
    revno: 3619.1.4
    revision-id: john at arbash-meinel.com-20080829044612-i5eshappfji5sjfz
    parent: john at arbash-meinel.com-20080829025102-yen21bf2ryskwbrr
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Thu 2008-08-28 23:46:12 -0500
    message:
      Remove --1.6-rich-root as a registered metadir collection.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
    ------------------------------------------------------------
    revno: 3619.1.3
    revision-id: john at arbash-meinel.com-20080829025102-yen21bf2ryskwbrr
    parent: john at arbash-meinel.com-20080829024439-zx2jhwqbt4qlyg13
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Thu 2008-08-28 21:51:02 -0500
    message:
      When warning give an exact upgrade request.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
    ------------------------------------------------------------
    revno: 3619.1.2
    revision-id: john at arbash-meinel.com-20080829024439-zx2jhwqbt4qlyg13
    parent: john at arbash-meinel.com-20080829023918-10cy13i3x5af62ne
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Thu 2008-08-28 21:44:39 -0500
    message:
      Name the new format 1.6.1-rich-root, and NEWS for fixing bug #262333
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
    ------------------------------------------------------------
    revno: 3619.1.1
    revision-id: john at arbash-meinel.com-20080829023918-10cy13i3x5af62ne
    parent: pqm at pqm.ubuntu.com-20080825143827-fl7cocq59pqdig2p
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: rich_root_serializer
    timestamp: Thu 2008-08-28 21:39:18 -0500
    message:
      Create a new --1.6-rich-root, deprecate the old one.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-08-29 05:25:58 +0000
+++ b/NEWS	2008-08-29 12:24:53 +0000
@@ -4,8 +4,8 @@
 
 .. contents::
 
-bzr 1.6rc1 IN DEVELOPMENT
--------------------------
+bzr 1.6.1rc1 IN DEVELOPMENT
+---------------------------
 
   BUG FIXES:
 
@@ -13,9 +13,23 @@
       buffered the readv data and processed it. It would keep appending to
       the same string (causing many copies) and then pop bytes out of the
       start of the string (causing more copies).
-      With this patch "bzr+ssh://local" speeds improve by up to 3x.
+      With this patch "bzr+ssh://local" can improve dramatically,
+      especially for projects with large files.
       (John Arbash Meinel)
 
+    * Revision texts were always meant to be stored as fulltexts. There
+      was a bug in a bzr.dev version that would accidentally create deltas
+      when copying from a Pack repo to a Knit repo. This has been fixed,
+      but to support those repositories, we know always request full texts
+      for Revision texts. (John Arbash Meinel, #261339)
+
+    * The previous ``--1.6-rich-root`` format used an incorrect xml
+      serializer, which would accidentally support fetching from a
+      repository that supported subtrees, even though the local one would
+      not. We deprecated that format, and introduced a new one that uses
+      the correct serializer ``--1.6.1-rich-root``.
+      (John Arbash Meinel, #262333)
+
 
 bzr 1.6 2008-08-25
 ------------------

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-08-19 21:04:22 +0000
+++ b/bzrlib/bzrdir.py	2008-08-29 05:18:56 +0000
@@ -3025,7 +3025,7 @@
     branch_format='bzrlib.branch.BzrBranchFormat7',
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     )
-format_registry.register_metadir('1.6-rich-root',
+format_registry.register_metadir('1.6.1-rich-root',
     'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5RichRoot',
     help='A branch and pack based repository that supports stacking '
          'and rich root data (needed for bzr-svn). ',

=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/fetch.py	2008-08-29 02:05:22 +0000
@@ -255,7 +255,10 @@
         to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
             [(rev_id,) for rev_id in revs],
             self.to_repository._fetch_order,
-            not self.to_repository._fetch_uses_deltas)))
+            True)))
+        # Bug #261339, some knit repositories accidentally had deltas in their
+        # revision stream, when you weren't ever supposed to have deltas.
+        # So we now *force* fulltext copying for signatures and revisions
         self._fetch_just_revision_texts(revs)
 
     def _fetch_just_revision_texts(self, version_ids):
@@ -264,7 +267,10 @@
         to_rf.insert_record_stream(from_rf.get_record_stream(
             [(rev_id,) for rev_id in version_ids],
             self.to_repository._fetch_order,
-            not self.to_repository._fetch_uses_deltas))
+            True))
+        # Bug #261339, some knit repositories accidentally had deltas in their
+        # revision stream, when you weren't ever supposed to have deltas.
+        # So we now *force* fulltext copying for signatures and revisions
 
     def _generate_root_texts(self, revs):
         """This will be called by __fetch between fetching weave texts and
@@ -380,6 +386,8 @@
                                       parents)
 
     def fetch_revisions(self, revision_ids):
+        # TODO: should this batch them up rather than requesting 10,000
+        #       revisions at once?
         for revision in self.source.get_revisions(revision_ids):
             self.target.add_revision(revision.revision_id, revision)
 

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-08-29 02:51:02 +0000
@@ -1722,8 +1722,15 @@
         self._fetch_order = 'unordered'
 
     def _warn_if_deprecated(self):
-        # This class isn't deprecated
-        pass
+        # This class isn't deprecated, but one sub-format is
+        if isinstance(self._format, RepositoryFormatKnitPack5RichRootBroken):
+            from bzrlib import repository
+            if repository._deprecation_warning_done:
+                return
+            repository._deprecation_warning_done = True
+            warning("Format %s for %s is deprecated - please use"
+                    " 'bzr upgrade --1.6.1-rich-root'"
+                    % (self._format, self.bzrdir.transport.base))
 
     def _abort_write_group(self):
         self._pack_collection._abort_write_group()
@@ -2086,12 +2093,54 @@
 
 
 class RepositoryFormatKnitPack5RichRoot(RepositoryFormatPack):
+    """A repository with rich roots and stacking.
+
+    New in release 1.6.1.
+
+    Supports stacking on other repositories, allowing data to be accessed
+    without being stored locally.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackRootCommitBuilder
+    rich_root_data = True
+    supports_tree_reference = False # no subtrees
+    _serializer = xml6.serializer_v6
+    supports_external_lookups = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir(
+            '1.6.1-rich-root')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def check_conversion_target(self, target_format):
+        if not target_format.rich_root_data:
+            raise errors.BadConversionTarget(
+                'Does not support rich root data.', target_format)
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6.1)\n"
+
+    def get_format_description(self):
+        return "Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)"
+
+
+class RepositoryFormatKnitPack5RichRootBroken(RepositoryFormatPack):
     """A repository with rich roots and external references.
 
     New in release 1.6.
 
     Supports external lookups, which results in non-truncated ghosts after
     reconcile compared to pack-0.92 formats.
+
+    This format was deprecated because the serializer it uses accidentally
+    supported subtrees, when the format was not intended to. This meant that
+    someone could accidentally fetch from an incorrect repository.
     """
 
     repository_class = KnitPackRepository
@@ -2115,13 +2164,14 @@
         if not target_format.rich_root_data:
             raise errors.BadConversionTarget(
                 'Does not support rich root data.', target_format)
-            
+
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
         return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6)\n"
 
     def get_format_description(self):
-        return "Packs 5 rich-root (adds stacking support, requires bzr 1.6)"
+        return ("Packs 5 rich-root (adds stacking support, requires bzr 1.6)"
+                " (deprecated)")
 
 
 class RepositoryFormatPackDevelopment0(RepositoryFormatPack):

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/repository.py	2008-08-29 02:39:18 +0000
@@ -2300,9 +2300,14 @@
     'RepositoryFormatKnitPack5',
     )
 format_registry.register_lazy(
+    'Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6.1)\n',
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatKnitPack5RichRoot',
+    )
+format_registry.register_lazy(
     'Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6)\n',
     'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatKnitPack5RichRoot',
+    'RepositoryFormatKnitPack5RichRootBroken',
     )
 
 # Development formats. 
@@ -2903,13 +2908,17 @@
     @staticmethod
     def is_compatible(source, target):
         """Be compatible with Knit1 source and Knit3 target"""
-        from bzrlib.repofmt.knitrepo import RepositoryFormatKnit3
         try:
-            from bzrlib.repofmt.knitrepo import (RepositoryFormatKnit1,
-                RepositoryFormatKnit3)
+            from bzrlib.repofmt.knitrepo import (
+                RepositoryFormatKnit1,
+                RepositoryFormatKnit3,
+                )
             from bzrlib.repofmt.pack_repo import (
                 RepositoryFormatKnitPack1,
                 RepositoryFormatKnitPack3,
+                RepositoryFormatKnitPack4,
+                RepositoryFormatKnitPack5,
+                RepositoryFormatKnitPack5RichRoot,
                 RepositoryFormatPackDevelopment0,
                 RepositoryFormatPackDevelopment0Subtree,
                 )
@@ -2917,6 +2926,9 @@
                 RepositoryFormatKnit1,
                 RepositoryFormatKnitPack1,
                 RepositoryFormatPackDevelopment0,
+                RepositoryFormatKnitPack4,
+                RepositoryFormatKnitPack5,
+                RepositoryFormatKnitPack5RichRoot,
                 )
             subtrees = (
                 RepositoryFormatKnit3,

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2008-07-24 06:10:47 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2008-08-29 05:18:56 +0000
@@ -247,7 +247,7 @@
         branch5 = tree5.branch
         out, err = self.run_bzr('info -v lightcheckout')
         self.assertEqualDiff(
-"""Lightweight checkout (format: 1.6 or 1.6-rich-root \
+"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root \
 or dirstate or dirstate-tags or \
 pack-0.92 or rich-root or rich-root-pack)
 Location:
@@ -415,7 +415,7 @@
         # Out of date lightweight checkout
         out, err = self.run_bzr('info lightcheckout --verbose')
         self.assertEqualDiff(
-"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
+"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
 dirstate or dirstate-tags or \
 pack-0.92 or rich-root or rich-root-pack)
 Location:
@@ -552,7 +552,7 @@
         datestring_first = format_date(rev.timestamp, rev.timezone)
         out, err = self.run_bzr('info tree/lightcheckout --verbose')
         self.assertEqualDiff(
-"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
+"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
 dirstate or dirstate-tags or \
 pack-0.92 or rich-root or rich-root-pack)
 Location:
@@ -676,7 +676,7 @@
         datestring_last = format_date(rev.timestamp, rev.timezone)
         out, err = self.run_bzr('info tree/lightcheckout --verbose')
         self.assertEqualDiff(
-"""Lightweight checkout (format: 1.6 or 1.6-rich-root or \
+"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
 dirstate or dirstate-tags or \
 pack-0.92 or rich-root or rich-root-pack)
 Location:
@@ -1092,7 +1092,7 @@
             (False, True): 'Lightweight checkout',
             (False, False): 'Checkout',
             }[(shared_repo is not None, light_checkout)]
-        format = {True: '1.6 or 1.6-rich-root'
+        format = {True: '1.6 or 1.6.1-rich-root'
                         ' or dirstate or dirstate-tags or pack-0.92'
                         ' or rich-root or rich-root-pack',
                   False: 'dirstate'}[light_checkout]

=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/tests/test_fetch.py	2008-08-29 02:05:22 +0000
@@ -374,8 +374,12 @@
         self.assertEqual(('get_record_stream', [('rev-one',)],
                           target._fetch_order, False),
                          self.find_get_record_stream(source.inventories.calls))
+        # Because of bugs in the old fetch code, revisions could accidentally
+        # have deltas present in knits. However, it was never intended, so we
+        # always for include_delta_closure=True, to make sure we get fulltexts.
+        # bug #261339
         self.assertEqual(('get_record_stream', [('rev-one',)],
-                          target._fetch_order, False),
+                          target._fetch_order, True),
                          self.find_get_record_stream(source.revisions.calls))
         # XXX: Signatures is special, and slightly broken. The
         # standard item_keys_introduced_by actually does a lookup for every
@@ -386,7 +390,7 @@
         # we care about.
         signature_calls = source.signatures.calls[-1:]
         self.assertEqual(('get_record_stream', [('rev-one',)],
-                          target._fetch_order, False),
+                          target._fetch_order, True),
                          self.find_get_record_stream(signature_calls))
 
     def test_fetch_no_deltas_with_delta_closure(self):

=== modified file 'bzrlib/tests/test_info.py'
--- a/bzrlib/tests/test_info.py	2008-07-24 05:19:40 +0000
+++ b/bzrlib/tests/test_info.py	2008-08-29 05:18:56 +0000
@@ -146,8 +146,8 @@
             expected = None
             if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree',
                 'pack-0.92', 'pack-0.92-subtree', 'rich-root',
-                'rich-root-pack', '1.6', '1.6-rich-root'):
-                expected = '1.6 or 1.6-rich-root or ' \
+                'rich-root-pack', '1.6', '1.6.1-rich-root'):
+                expected = '1.6 or 1.6.1-rich-root or ' \
                     'dirstate or dirstate-tags or pack-0.92 or'\
                     ' rich-root or rich-root-pack'
             if key in ('knit', 'metaweave'):

=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2008-08-18 23:11:59 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2008-08-29 05:18:56 +0000
@@ -495,7 +495,7 @@
     def get_format(self):
         return bzrdir.format_registry.make_bzrdir(self.format_name)
 
-    def test_stack_checks_compatibility(self):
+    def test_stack_checks_rich_root_compatibility(self):
         # early versions of the packing code relied on pack internals to
         # stack, but the current version should be able to stack on any
         # format.
@@ -507,7 +507,10 @@
         if repo.supports_rich_root():
             # can only stack on repositories that have compatible internal
             # metadata
-            matching_format_name = 'pack-0.92-subtree'
+            if getattr(repo._format, 'supports_tree_reference', False):
+                matching_format_name = 'pack-0.92-subtree'
+            else:
+                matching_format_name = 'rich-root-pack'
             mismatching_format_name = 'pack-0.92'
         else:
             matching_format_name = 'pack-0.92'
@@ -524,6 +527,32 @@
             r'KnitPackRepository.*/repo/.*\n'
             r'different rich-root support')
 
+    def test_stack_checks_serializers_compatibility(self):
+        repo = self.make_repository('repo', format=self.get_format())
+        if getattr(repo._format, 'supports_tree_reference', False):
+            # can only stack on repositories that have compatible internal
+            # metadata
+            matching_format_name = 'pack-0.92-subtree'
+            mismatching_format_name = 'rich-root-pack'
+        else:
+            if repo.supports_rich_root():
+                matching_format_name = 'rich-root-pack'
+                mismatching_format_name = 'pack-0.92-subtree'
+            else:
+                raise TestNotApplicable('No formats use non-v5 serializer'
+                    ' without having rich-root also set')
+        base = self.make_repository('base', format=matching_format_name)
+        repo.add_fallback_repository(base)
+        # you can't stack on something with incompatible data
+        bad_repo = self.make_repository('mismatch',
+            format=mismatching_format_name)
+        e = self.assertRaises(errors.IncompatibleRepositories,
+            repo.add_fallback_repository, bad_repo)
+        self.assertContainsRe(str(e),
+            r'(?m)KnitPackRepository.*/mismatch/.*\nis not compatible with\n'
+            r'KnitPackRepository.*/repo/.*\n'
+            r'different serializers')
+
     def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
         base = self.make_branch_and_tree('base', format=self.get_format())
         base.commit('foo')
@@ -590,9 +619,9 @@
          dict(format_name='1.6',
               format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
               format_supports_external_lookups=True),
-         dict(format_name='1.6-rich-root',
+         dict(format_name='1.6.1-rich-root',
               format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
-                  "(bzr 1.6)\n",
+                  "(bzr 1.6.1)\n",
               format_supports_external_lookups=True),
          dict(format_name='development0',
               format_string="Bazaar development format 0 "

=== modified file 'bzrlib/tests/test_upgrade_stacked.py'
--- a/bzrlib/tests/test_upgrade_stacked.py	2008-08-04 07:55:41 +0000
+++ b/bzrlib/tests/test_upgrade_stacked.py	2008-08-29 05:18:56 +0000
@@ -74,7 +74,7 @@
 #        ('knit', 'rich-root', True),
         ('knit', '1.6', False),
 #        ('pack-0.92', '1.6', False),
-        ('1.6', '1.6-rich-root', True),
+        ('1.6', '1.6.1-rich-root', True),
         ]
     scenarios = []
     for (old_name, new_name, model_change) in scenario_pairs:



More information about the bazaar-commits mailing list