Rev 2836: Merge bzr.dev in file:///v/home/vila/src/bzr/bugs/osx.clean/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Sep 24 09:54:00 BST 2007


At file:///v/home/vila/src/bzr/bugs/osx.clean/

------------------------------------------------------------
revno: 2836
revision-id: v.ladeuil+lp at free.fr-20070924085356-g7mx4wdj2np35j37
parent: v.ladeuil+lp at free.fr-20070924084931-cce6o30w898zxs3z
parent: pqm at pqm.ubuntu.com-20070924042807-nfjwj1voh6a8zddf
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: osx.clean
timestamp: Mon 2007-09-24 10:53:56 +0200
message:
  Merge bzr.dev
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
  bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
  bzrlib/tests/repository_implementations/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
  bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 2823.1.28
    revision-id: pqm at pqm.ubuntu.com-20070924042807-nfjwj1voh6a8zddf
    parent: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
    parent: robertc at robertcollins.net-20070924022944-lv2e2glumuo3ne8q
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-09-24 05:28:07 +0100
    message:
      (robertc) Increase efficiency of shaing during adding of knit records. (Robert Collins)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
        ------------------------------------------------------------
        revno: 2823.1.27.1.1
        revision-id: robertc at robertcollins.net-20070924022944-lv2e2glumuo3ne8q
        parent: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: knits
        timestamp: Mon 2007-09-24 12:29:44 +1000
        message:
          * ``KnitVersionedFile.add*`` will no longer cache added records even when
            enable_cache() has been called - the caching feature is now exclusively for
            reading existing data. (Robert Collins)
        modified:
          NEWS                           NEWS-20050323055033-4e00b5db738777ff
          bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
          bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
    ------------------------------------------------------------
    revno: 2823.1.27
    revision-id: pqm at pqm.ubuntu.com-20070923210826-t3ymvo1l68z96in1
    parent: pqm at pqm.ubuntu.com-20070923202533-vzfy37j7bpkwo21z
    parent: robertc at robertcollins.net-20070923203327-o2pztijk7aysuw9w
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Sun 2007-09-23 22:08:26 +0100
    message:
      (robertc) Tweak index -Devil tracing.
    modified:
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
        ------------------------------------------------------------
        revno: 2823.1.26.1.1
        revision-id: robertc at robertcollins.net-20070923203327-o2pztijk7aysuw9w
        parent: pqm at pqm.ubuntu.com-20070923202533-vzfy37j7bpkwo21z
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: index
        timestamp: Mon 2007-09-24 06:33:27 +1000
        message:
          Tweak index -Devil tracing.
        modified:
          bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
    ------------------------------------------------------------
    revno: 2823.1.26
    revision-id: pqm at pqm.ubuntu.com-20070923202533-vzfy37j7bpkwo21z
    parent: pqm at pqm.ubuntu.com-20070922170226-ex2ydmlyboaoj87c
    parent: robertc at robertcollins.net-20070923191242-zhem9hyu4s3iv0is
    committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Sun 2007-09-23 21:25:33 +0100
    message:
      (robertc) Various test fixes and tweaks for packs. (Robert Collins).
    modified:
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
      bzrlib/tests/repository_implementations/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 2818.4.2
    revision-id: robertc at robertcollins.net-20070923191242-zhem9hyu4s3iv0is
    parent: robertc at robertcollins.net-20070914021941-wjd6iu3rnqarh07q
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: pack-support
    timestamp: Mon 2007-09-24 05:12:42 +1000
    message:
      Review feedback.
    modified:
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 2818.4.1
    revision-id: robertc at robertcollins.net-20070914021941-wjd6iu3rnqarh07q
    parent: pqm at pqm.ubuntu.com-20070913193317-hi3rhwxhbrviw7hz
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: pack-support
    timestamp: Fri 2007-09-14 12:19:41 +1000
    message:
      Various test fixes and tweaks for packs.
    modified:
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
      bzrlib/tests/repository_implementations/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-09-24 08:49:31 +0000
+++ b/NEWS	2007-09-24 08:53:56 +0000
@@ -91,6 +91,10 @@
 
   API BREAKS:
 
+   * ``KnitVersionedFile.add*`` will no longer cache added records even when
+     enable_cache() has been called - the caching feature is now exclusively for
+     reading existing data. (Robert Collins)
+
    * The ``VersionedFile`` interface now allows content checks to be bypassed
      by supplying check_content=False.  This saves nearly 30% of the minimum
      cost to store a version of a file. (Robert Collins)

=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py	2007-09-20 07:37:57 +0000
+++ b/bzrlib/index.py	2007-09-23 20:33:27 +0000
@@ -324,7 +324,7 @@
             the most efficient order for the index.
         """
         if 'evil' in debug.debug_flags:
-            trace.mutter_callsite(2,
+            trace.mutter_callsite(3,
                 "iter_all_entries scales with size of history.")
         if self._nodes is None:
             self._buffer_all()
@@ -615,7 +615,7 @@
             efficient order for the index (in this case dictionary hash order).
         """
         if 'evil' in debug.debug_flags:
-            trace.mutter_callsite(2,
+            trace.mutter_callsite(3,
                 "iter_all_entries scales with size of history.")
         if self.reference_lists:
             for key, (absent, references, value) in self._nodes.iteritems():

=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2007-09-21 06:35:09 +0000
+++ b/bzrlib/knit.py	2007-09-24 02:29:44 +0000
@@ -104,6 +104,7 @@
 from bzrlib.osutils import (
     contains_whitespace,
     contains_linebreaks,
+    sha_string,
     sha_strings,
     )
 from bzrlib.symbol_versioning import DEPRECATED_PARAMETER, deprecated_passed
@@ -854,17 +855,12 @@
 
         Any versions not present will be converted into ghosts.
         """
-        #  461    0   6546.0390     43.9100   bzrlib.knit:489(_add)
-        # +400    0    889.4890    418.9790   +bzrlib.knit:192(lower_fulltext)
-        # +461    0   1364.8070    108.8030   +bzrlib.knit:996(add_record)
-        # +461    0    193.3940     41.5720   +bzrlib.knit:898(add_version)
-        # +461    0    134.0590     18.3810   +bzrlib.osutils:361(sha_strings)
-        # +461    0     36.3420     15.4540   +bzrlib.knit:146(make)
-        # +1383   0      8.0370      8.0370   +<len>
-        # +61     0     13.5770      7.9190   +bzrlib.knit:199(lower_line_delta)
-        # +61     0    963.3470      7.8740   +bzrlib.knit:427(_get_content)
-        # +61     0    973.9950      5.2950   +bzrlib.knit:136(line_delta)
-        # +61     0   1918.1800      5.2640   +bzrlib.knit:359(_merge_annotations)
+        # first thing, if the content is something we don't need to store, find
+        # that out.
+        line_bytes = ''.join(lines)
+        digest = sha_string(line_bytes)
+        if nostore_sha == digest:
+            raise errors.ExistingContent
 
         present_parents = []
         if parent_texts is None:
@@ -879,10 +875,7 @@
              present_parents[0] != parents[0])):
             delta = False
 
-        digest = sha_strings(lines)
-        if nostore_sha == digest:
-            raise errors.ExistingContent
-        text_length = sum(map(len, lines))
+        text_length = len(line_bytes)
         options = []
         if lines:
             if lines[-1][-1] != '\n':
@@ -908,13 +901,20 @@
         if delta:
             options.append('line-delta')
             store_lines = self.factory.lower_line_delta(delta_hunks)
+            size, bytes = self._data._record_to_data(version_id, digest,
+                store_lines)
         else:
             options.append('fulltext')
+            # get mixed annotation + content and feed it into the
+            # serialiser.
             store_lines = self.factory.lower_fulltext(content)
+            size, bytes = self._data._record_to_data(version_id, digest,
+                store_lines)
 
-        access_memo = self._data.add_record(version_id, digest, store_lines)
+        access_memo = self._data.add_raw_records([size], bytes)[0]
         self._index.add_versions(
-            ((version_id, options, access_memo, parents),), random_id=random_id)
+            ((version_id, options, access_memo, parents),),
+            random_id=random_id)
         return digest, text_length, content
 
     def check(self, progress_bar=None):
@@ -2005,17 +2005,6 @@
         """
         return self._access.add_raw_records(sizes, raw_data)
         
-    def add_record(self, version_id, digest, lines):
-        """Write new text record to disk. 
-        
-        Returns index data for retrieving it later, as per add_raw_records.
-        """
-        size, bytes = self._record_to_data(version_id, digest, lines)
-        result = self.add_raw_records([size], bytes)
-        if self._do_cache:
-            self._cache[version_id] = bytes
-        return result[0]
-
     def _parse_record_header(self, version_id, raw_data):
         """Parse a record header for consistency.
 

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-08-20 13:07:12 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-09-23 19:12:42 +0000
@@ -248,7 +248,11 @@
         wt.commit("base", allow_pointless=True, rev_id='A')
         from bzrlib.testament import Testament
         strategy = gpg.LoopbackGPGStrategy(None)
+        branch.repository.lock_write()
+        branch.repository.start_write_group()
         branch.repository.sign_revision('A', strategy)
+        branch.repository.commit_write_group()
+        branch.repository.unlock()
         self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n' +
                          Testament.from_revision(branch.repository,
                          'A').as_short_text() +
@@ -272,7 +276,11 @@
         wt = self.make_branch_and_tree('source')
         wt.commit('A', allow_pointless=True, rev_id='A')
         repo = wt.branch.repository
+        repo.lock_write()
+        repo.start_write_group()
         repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
+        repo.commit_write_group()
+        repo.unlock()
         #FIXME: clone should work to urls,
         # wt.clone should work to disks.
         self.build_tree(['target/'])

=== modified file 'bzrlib/tests/interrepository_implementations/test_interrepository.py'
--- a/bzrlib/tests/interrepository_implementations/test_interrepository.py	2007-09-12 03:16:04 +0000
+++ b/bzrlib/tests/interrepository_implementations/test_interrepository.py	2007-09-14 02:19:41 +0000
@@ -242,17 +242,22 @@
         tree_a = self.make_branch_and_tree('a')
         self.bzrdir = tree_a.branch.bzrdir
         # add a corrupt inventory 'orphan'
-        inv_file = tree_a.branch.repository.control_weaves.get_weave(
-            'inventory', 
-            tree_a.branch.repository.get_transaction())
+        tree_a.branch.repository.lock_write()
+        tree_a.branch.repository.start_write_group()
+        inv_file = tree_a.branch.repository.get_inventory_weave()
         inv_file.add_lines('orphan', [], [])
+        tree_a.branch.repository.commit_write_group()
+        tree_a.branch.repository.unlock()
         # add a real revision 'rev1'
         tree_a.commit('rev1', rev_id='rev1', allow_pointless=True)
         # add a real revision 'rev2' based on rev1
         tree_a.commit('rev2', rev_id='rev2', allow_pointless=True)
         # and sign 'rev2'
-        tree_a.branch.repository.sign_revision('rev2',
-            bzrlib.gpg.LoopbackGPGStrategy(None))
+        tree_a.branch.repository.lock_write()
+        tree_a.branch.repository.start_write_group()
+        tree_a.branch.repository.sign_revision('rev2', bzrlib.gpg.LoopbackGPGStrategy(None))
+        tree_a.branch.repository.commit_write_group()
+        tree_a.branch.repository.unlock()
 
     def test_missing_revision_ids(self):
         # revision ids in repository A but not B are returned, fake ones
@@ -276,7 +281,7 @@
         self.assertEqual(['rev1'],
                          repo_b.missing_revision_ids(repo_a, revision_id='rev1'))
         
-    def test_fetch_preserves_signatures(self):
+    def test_fetch_fetches_signatures_too(self):
         from_repo = self.bzrdir.open_repository()
         from_signature = from_repo.get_signature_text('rev2')
         to_repo = self.make_to_repository('target')
@@ -308,6 +313,8 @@
         repo = self.make_to_repository('missing_ghost')
         inv = Inventory(revision_id='with_ghost')
         inv.root.revision = 'with_ghost'
+        repo.lock_write()
+        repo.start_write_group()
         sha1 = repo.add_inventory('with_ghost', inv, [])
         rev = bzrlib.revision.Revision(timestamp=0,
                                        timezone=None,
@@ -317,6 +324,8 @@
                                        revision_id='with_ghost')
         rev.parent_ids = ['ghost']
         repo.add_revision('with_ghost', rev)
+        repo.commit_write_group()
+        repo.unlock()
 
     def test_fetch_all_fixes_up_ghost(self):
         # fetching from a repo with a current ghost unghosts it in referencing

=== modified file 'bzrlib/tests/repository_implementations/test_commit_builder.py'
--- a/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-09-21 00:22:35 +0000
+++ b/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-09-23 20:25:33 +0000
@@ -411,6 +411,8 @@
         rev4 = tree1.commit('')
         tree3, = self._get_revtrees(tree1, [rev4])
         self.assertEqual(rev4, tree3.inventory[name + 'id'].revision)
+        # TODO: change this to an assertFileGraph call to check the
+        # parent order of rev4: it should be rev2, rev3
         self.assertFileAncestry([rev1, rev2, rev3, rev4], tree1, name,
             [rev1, rev3, rev2, rev4])
 

=== modified file 'bzrlib/tests/repository_implementations/test_fetch.py'
--- a/bzrlib/tests/repository_implementations/test_fetch.py	2007-08-20 07:54:29 +0000
+++ b/bzrlib/tests/repository_implementations/test_fetch.py	2007-09-14 02:19:41 +0000
@@ -64,6 +64,9 @@
         knit3_repo = b_bzrdir.create_repository()
         # fetch with a default limit (grab everything)
         knit3_repo.fetch(tree_a.branch.repository, revision_id=None)
+        # Reopen to avoid any in-memory caching - ensure its reading from
+        # disk.
+        knit3_repo = b_bzrdir.open_repository()
         rev1_tree = knit3_repo.revision_tree('rev1')
         lines = rev1_tree.get_file_lines(rev1_tree.inventory.root.file_id)
         self.assertEqual([], lines)
@@ -82,7 +85,11 @@
         wt = self.make_branch_and_tree('a-repo-with-sigs')
         wt.commit('rev1', allow_pointless=True, rev_id='rev1')
         repo = wt.branch.repository
+        repo.lock_write()
+        repo.start_write_group()
         repo.sign_revision('rev1', gpg.LoopbackGPGStrategy(None))
+        repo.commit_write_group()
+        repo.unlock()
         return repo
 
     def test_fetch_copies_signatures(self):

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2007-08-21 03:40:50 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2007-09-14 02:19:41 +0000
@@ -234,13 +234,6 @@
         new_signature = wt.branch.repository.get_signature_text('A')
         self.assertEqual(old_signature, new_signature)
 
-    def test_exposed_versioned_files_are_marked_dirty(self):
-        repo = self.make_repository('.')
-        repo.lock_write()
-        inv = repo.get_inventory_weave()
-        repo.unlock()
-        self.assertRaises(errors.OutSideTransaction, inv.add_lines, 'foo', [], [])
-
     def test_format_description(self):
         repo = self.make_repository('.')
         text = repo._format.get_format_description()
@@ -396,7 +389,7 @@
         self.assertRaises(errors.RevisionNotPresent, list,
                           repository.iter_files_bytes(
                           [('file1-id', 'rev3', 'file1-notpresent')]))
-        self.assertRaises(errors.NoSuchId, list,
+        self.assertRaises((errors.RevisionNotPresent, errors.NoSuchId), list,
                           repository.iter_files_bytes(
                           [('file3-id', 'rev3', 'file1-notpresent')]))
 
@@ -466,10 +459,19 @@
         self.bzrdir = tree_a.branch.bzrdir
         # add a corrupt inventory 'orphan'
         # this may need some generalising for knits.
-        inv_file = tree_a.branch.repository.control_weaves.get_weave(
-            'inventory', 
-            tree_a.branch.repository.get_transaction())
-        inv_file.add_lines('orphan', [], [])
+        tree_a.lock_write()
+        try:
+            tree_a.branch.repository.start_write_group()
+            inv_file = tree_a.branch.repository.get_inventory_weave()
+            try:
+                inv_file.add_lines('orphan', [], [])
+            except:
+                tree_a.branch.repository.commit_write_group()
+                raise
+            else:
+                tree_a.branch.repository.abort_write_group()
+        finally:
+            tree_a.unlock()
         # add a real revision 'rev1'
         tree_a.commit('rev1', rev_id='rev1', allow_pointless=True)
         # add a real revision 'rev2' based on rev1
@@ -570,10 +572,16 @@
 
     def test_reserved_id(self):
         repo = self.make_repository('repository')
-        self.assertRaises(errors.ReservedId, repo.add_inventory, 'reserved:',
-                          None, None)
-        self.assertRaises(errors.ReservedId, repo.add_revision, 'reserved:',
-                          None)
+        repo.lock_write()
+        repo.start_write_group()
+        try:
+            self.assertRaises(errors.ReservedId, repo.add_inventory, 'reserved:',
+                              None, None)
+            self.assertRaises(errors.ReservedId, repo.add_revision, 'reserved:',
+                              None)
+        finally:
+            repo.abort_write_group()
+            repo.unlock()
 
 
 class TestCaseWithCorruptRepository(TestCaseWithRepository):

=== modified file 'bzrlib/tests/test_info.py'
--- a/bzrlib/tests/test_info.py	2007-07-06 21:20:10 +0000
+++ b/bzrlib/tests/test_info.py	2007-09-14 02:19:41 +0000
@@ -97,8 +97,11 @@
                 bzrdir.format_registry.make_bzrdir(format).workingtree_format
             control.create_workingtree()
             tree = workingtree.WorkingTree.open('%s_co' % format)
-            self.assertEqual(expected, info.describe_format(tree.bzrdir,
-                tree.branch.repository, tree.branch, tree))
+            format_description = info.describe_format(tree.bzrdir,
+                    tree.branch.repository, tree.branch, tree)
+            self.assertEqual(expected, format_description,
+                "checkout of format called %r was described as %r" %
+                (expected, format_description))
         finally:
             control._format.workingtree_format = old_format
 
@@ -128,7 +131,10 @@
 
     def test_describe_checkout_format(self):
         for key in bzrdir.format_registry.keys():
-            if key in ('default', 'weave'):
+            if key in ('default', 'weave', 'experimental'):
+                continue
+            if key.startswith('experimental-'):
+                # these are typically hidden or aliases for other formats
                 continue
             expected = None
             if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree'):

=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2007-09-21 06:35:09 +0000
+++ b/bzrlib/tests/test_knit.py	2007-09-24 02:29:44 +0000
@@ -1907,11 +1907,8 @@
 
 class TestKnitCaching(KnitTests):
     
-    def create_knit(self, cache_add=False):
+    def create_knit(self):
         k = self.make_test_knit(True)
-        if cache_add:
-            k.enable_cache()
-
         k.add_lines('text-1', [], split_lines(TEXT_1))
         k.add_lines('text-2', [], split_lines(TEXT_2))
         return k
@@ -1921,14 +1918,6 @@
         # Nothing should be cached without setting 'enable_cache'
         self.assertEqual({}, k._data._cache)
 
-    def test_cache_add_and_clear(self):
-        k = self.create_knit(True)
-
-        self.assertEqual(['text-1', 'text-2'], sorted(k._data._cache.keys()))
-
-        k.clear_cache()
-        self.assertEqual({}, k._data._cache)
-
     def test_cache_data_read_raw(self):
         k = self.create_knit()
 

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2007-08-30 08:27:29 +0000
+++ b/bzrlib/tests/test_repository.py	2007-09-23 19:12:42 +0000
@@ -160,6 +160,15 @@
                           control.transport.get,
                           'ancestry.weave')
 
+    def test_exposed_versioned_files_are_marked_dirty(self):
+        control = bzrdir.BzrDirFormat6().initialize(self.get_url())
+        repo = weaverepo.RepositoryFormat6().initialize(control)
+        repo.lock_write()
+        inv = repo.get_inventory_weave()
+        repo.unlock()
+        self.assertRaises(errors.OutSideTransaction,
+            inv.add_lines, 'foo', [], [])
+
 
 class TestFormat7(TestCaseWithTransport):
     
@@ -264,6 +273,15 @@
                              'W\n',
                              t.get('inventory.weave').read())
 
+    def test_exposed_versioned_files_are_marked_dirty(self):
+        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
+        repo = weaverepo.RepositoryFormat7().initialize(control)
+        repo.lock_write()
+        inv = repo.get_inventory_weave()
+        repo.unlock()
+        self.assertRaises(errors.OutSideTransaction,
+            inv.add_lines, 'foo', [], [])
+
 
 class TestFormatKnit1(TestCaseWithTransport):
     
@@ -342,6 +360,16 @@
         self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
         self.check_knits(t)
 
+    def test_exposed_versioned_files_are_marked_dirty(self):
+        format = bzrdir.BzrDirMetaFormat1()
+        format.repository_format = knitrepo.RepositoryFormatKnit1()
+        repo = self.make_repository('.', format=format)
+        repo.lock_write()
+        inv = repo.get_inventory_weave()
+        repo.unlock()
+        self.assertRaises(errors.OutSideTransaction,
+            inv.add_lines, 'foo', [], [])
+
 
 class KnitRepositoryStreamTests(test_knit.KnitTests):
     """Tests for knitrepo._get_stream_as_bytes."""
@@ -417,7 +445,7 @@
 
     This is for use during testing where we use DummyRepository as repositories
     so that none of the default regsitered inter-repository classes will
-    match.
+    MATCH.
     """
 
     @staticmethod
@@ -559,3 +587,12 @@
         revision_tree = tree.branch.repository.revision_tree('dull2')
         self.assertEqual('dull', revision_tree.inventory.root.revision)
 
+    def test_exposed_versioned_files_are_marked_dirty(self):
+        format = bzrdir.BzrDirMetaFormat1()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
+        repo = self.make_repository('.', format=format)
+        repo.lock_write()
+        inv = repo.get_inventory_weave()
+        repo.unlock()
+        self.assertRaises(errors.OutSideTransaction,
+            inv.add_lines, 'foo', [], [])



More information about the bazaar-commits mailing list