Rev 2751: Fix knit test fallout from final readv api change. in http://people.ubuntu.com/~robertc/baz2.0/transport

Robert Collins robertc at robertcollins.net
Thu Oct 4 06:30:21 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/transport

------------------------------------------------------------
revno: 2751
revision-id: robertc at robertcollins.net-20071004053008-aquje8fyntc8q69h
parent: robertc at robertcollins.net-20071004050958-3uxw4hyf0f6xq7fy
parent: robertc at robertcollins.net-20071004030526-25d0wxbbvqtjezau
committer: Robert Collins <robertc at robertcollins.net>
branch nick: transport-get-file
timestamp: Thu 2007-10-04 15:30:08 +1000
message:
  Fix knit test fallout from final readv api change.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
    ------------------------------------------------------------
    revno: 2745.1.137
    revision-id: robertc at robertcollins.net-20071004030526-25d0wxbbvqtjezau
    parent: pqm at pqm.ubuntu.com-20071003232450-c831pepea3skddct
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: knits
    timestamp: Thu 2007-10-04 13:05:26 +1000
    message:
      * Removed previous deprecated ``basis_knit`` parameter to the
        ``KnitVersionedFile`` constructor.
      * Change lookup-before-access to fail-during-map-creation in knit text
        extraction reducing overall index operations during text extraction.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
=== modified file 'NEWS'
--- a/NEWS	2007-10-04 05:09:58 +0000
+++ b/NEWS	2007-10-04 05:30:08 +0000
@@ -134,6 +134,9 @@
      deprecated methods ``TestCase.capture`` and ``TestCase.run_bzr_captured``.
      (Martin Pool)
 
+   * Removed previous deprecated ``basis_knit`` parameter to the
+     ``KnitVersionedFile`` constructor. (Robert Collins)
+
    * Special purpose method ``TestCase.run_bzr_decode`` is moved to the test_non_ascii 
      class that needs it.
      (Martin Pool)

=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2007-09-27 21:11:38 +0000
+++ b/bzrlib/knit.py	2007-10-04 03:05:26 +0000
@@ -421,9 +421,8 @@
     """
 
     def __init__(self, relpath, transport, file_mode=None, access_mode=None,
-                 factory=None, basis_knit=DEPRECATED_PARAMETER, delta=True,
-                 create=False, create_parent_dir=False, delay_create=False,
-                 dir_mode=None, index=None, access_method=None):
+        factory=None, delta=True, create=False, create_parent_dir=False,
+        delay_create=False, dir_mode=None, index=None, access_method=None):
         """Construct a knit at location specified by relpath.
         
         :param create: If not True, only open an existing knit.
@@ -434,10 +433,6 @@
             actually be created until the first data is stored.
         :param index: An index to use for the knit.
         """
-        if deprecated_passed(basis_knit):
-            warnings.warn("KnitVersionedFile.__(): The basis_knit parameter is"
-                 " deprecated as of bzr 0.9.",
-                 DeprecationWarning, stacklevel=2)
         if access_mode is None:
             access_mode = 'w'
         super(KnitVersionedFile, self).__init__(access_mode)
@@ -467,7 +462,7 @@
         self._data = _KnitData(_access)
 
     def __repr__(self):
-        return '%s(%s)' % (self.__class__.__name__, 
+        return '%s(%s)' % (self.__class__.__name__,
                            self.transport.abspath(self.filename))
     
     def _check_should_delta(self, first_parents):
@@ -988,9 +983,6 @@
         the requested versions and content_map contains the KnitContents.
         Both dicts take version_ids as their keys.
         """
-        for version_id in version_ids:
-            if not self.has_version(version_id):
-                raise RevisionNotPresent(version_id, self.filename)
         record_map = self._get_record_map(version_ids)
 
         text_map = {}
@@ -1441,7 +1433,10 @@
 
     def get_method(self, version_id):
         """Return compression method of specified version."""
-        options = self._cache[version_id][1]
+        try:
+            options = self._cache[version_id][1]
+        except KeyError:
+            raise RevisionNotPresent(version_id, self._filename)
         if 'fulltext' in options:
             return 'fulltext'
         else:
@@ -1680,7 +1675,10 @@
             return 'fulltext'
 
     def _get_node(self, version_id):
-        return list(self._get_entries(self._version_ids_to_keys([version_id])))[0]
+        try:
+            return list(self._get_entries(self._version_ids_to_keys([version_id])))[0]
+        except IndexError:
+            raise RevisionNotPresent(version_id, self)
 
     def get_options(self, version_id):
         """Return a string represention options.

=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2007-10-04 05:09:58 +0000
+++ b/bzrlib/tests/test_knit.py	2007-10-04 05:30:08 +0000
@@ -1403,7 +1403,8 @@
         # request a last-first iteration
         results = list(k1.iter_lines_added_or_present_in_versions(
             ['base2', 'base']))
-        self.assertEqual([('readv', 'id.knit', [(0, 87), (87, 89)], False)],
+        self.assertEqual(
+            [('readv', 'id.knit', [(0, 87), (87, 89)], False, None)],
             instrumented_t._activity)
         self.assertEqual(['text\n', 'text2\n'], results)
 



More information about the bazaar-commits mailing list