~ubuntu-branches/ubuntu/karmic/bzr/karmic-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository_chk/test_supported.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pool
  • Date: 2009-12-14 19:17:08 UTC
  • mfrom: (1.4.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091214191708-dyay45g6mrsndc21
Tags: 2.0.2-0ubuntu1
* Proposed SRU, taking all changes from Bazaar's 2.0.2 new bugfix-only
  upstream release.
* Avoid "NoneType has no attribute st_mode" error when files disappear
  from a directory while it's being read. LP: #446033
* Content filters are now applied correctly after revert.
* Diff parsing handles "Binary files differ" hunks.  LP: #436325
* Fetching from stacked pre-2a repository via a smart server no longer
  fails intermittently with "second push failed to complete".
  LP: #437626
* Fix typos left after test_selftest refactoring.
  LP: #461149
* Fixed ``ObjectNotLocked`` errors during ``bzr log -r NNN somefile``.
  LP: #445171
* PreviewTree file names are not limited by the encoding of the temp
  directory's filesystem. LP: #436794
* ``bzr log`` now read-locks branches exactly once, so makes better use of
  data caches.
* Filtered views user documentation upgraded to refer to format 2a
  instead of pre-2.0 formats.
* ``bzr add`` in a tree that has files with ``\r`` or ``\n`` in the
  filename will issue a warning and skip over those files.
  LP: #3918
* bzr will attempt to authenticate with SSH servers that support
  ``keyboard-interactive`` auth but not ``password`` auth when using
  Paramiko.   LP: #433846
* Fixed fetches from a stacked branch on a smart server that were failing
  with some combinations of remote and local formats.  This was causing
  "unknown object type identifier 60" errors.  LP: #427736
* Fixed ``ObjectNotLocked`` errors when doing some log and diff operations
  on branches via a smart server.  LP: #389413
* Handle things like ``bzr add foo`` and ``bzr rm foo`` when the tree is
  at the root of a drive. ``osutils._cicp_canonical_relpath`` always
  assumed that ``abspath()`` returned a path that did not have a trailing
  ``/``, but that is not true when working at the root of the filesystem.
  LP: #322807
* Hide deprecation warnings for 'final' releases for python2.6.
  LP: #440062
* Improve the time for ``bzr log DIR`` for 2a format repositories.
  We had been using the same code path as for <2a formats, which required
  iterating over all objects in all revisions.
  LP: #374730
* Make sure that we unlock the tree if we fail to create a TreeTransform
  object when doing a merge, and there is limbo, or pending-deletions
  directory.  LP: #427773
* Occasional IndexError on renamed files have been fixed. Operations that
  set a full inventory in the working tree will now go via the
  apply_inventory_delta code path which is simpler and easier to
  understand than dirstates set_state_from_inventory method. This may
  have a small performance impact on operations built on _write_inventory,
  but such operations are already doing full tree scans, so no radical
  performance change should be observed. LP: #403322
* Retrieving file text or mtime from a _PreviewTree has good performance when
  there are many changes.
* The CHK index pages now use an unlimited cache size. With a limited
  cache and a large project, the random access of chk pages could cause us
  to download the entire cix file many times.
  LP: #402623
* When a file kind becomes unversionable after being added, a sensible
  error will be shown instead of a traceback. LP: #438569
* Improved README.
* Improved upgrade documentation for Launchpad branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for repositories that support CHK indices."""
18
18
 
19
19
from bzrlib import (
 
20
    btree_index,
20
21
    errors,
21
22
    osutils,
 
23
    repository,
22
24
    )
23
25
from bzrlib.versionedfile import VersionedFiles
24
26
from bzrlib.tests.per_repository_chk import TestCaseWithRepositoryCHK
108
110
        finally:
109
111
            repo.unlock()
110
112
 
 
113
    def test_chk_bytes_are_fully_buffered(self):
 
114
        repo = self.make_repository('.')
 
115
        repo.lock_write()
 
116
        self.addCleanup(repo.unlock)
 
117
        repo.start_write_group()
 
118
        try:
 
119
            sha1, len, _ = repo.chk_bytes.add_lines((None,),
 
120
                None, ["foo\n", "bar\n"], random_id=True)
 
121
            self.assertEqual('4e48e2c9a3d2ca8a708cb0cc545700544efb5021',
 
122
                sha1)
 
123
            self.assertEqual(
 
124
                set([('sha1:4e48e2c9a3d2ca8a708cb0cc545700544efb5021',)]),
 
125
                repo.chk_bytes.keys())
 
126
        except:
 
127
            repo.abort_write_group()
 
128
            raise
 
129
        else:
 
130
            repo.commit_write_group()
 
131
        # This may not always be correct if we change away from BTreeGraphIndex
 
132
        # in the future. But for now, lets check that chk_bytes are fully
 
133
        # buffered
 
134
        index = repo.chk_bytes._index._graph_index._indices[0]
 
135
        self.assertIsInstance(index, btree_index.BTreeGraphIndex)
 
136
        self.assertIs(type(index._leaf_node_cache), dict)
 
137
        # Re-opening the repository should also have a repo with everything
 
138
        # fully buffered
 
139
        repo2 = repository.Repository.open(self.get_url())
 
140
        repo2.lock_read()
 
141
        self.addCleanup(repo2.unlock)
 
142
        index = repo2.chk_bytes._index._graph_index._indices[0]
 
143
        self.assertIsInstance(index, btree_index.BTreeGraphIndex)
 
144
        self.assertIs(type(index._leaf_node_cache), dict)
 
145
 
111
146
 
112
147
class TestCommitWriteGroupIntegrityCheck(TestCaseWithRepositoryCHK):
113
148
    """Tests that commit_write_group prevents various kinds of invalid data