Rev 2634: Remove unneeded pulib method lookup on private class _KnitIndex. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Fri Jul 13 19:22:34 BST 2007


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

------------------------------------------------------------
revno: 2634
revision-id: robertc at robertcollins.net-20070713182231-ysvixzjwrx0n2oe1
parent: robertc at robertcollins.net-20070713181833-f70rgypb8n3zev7n
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sat 2007-07-14 04:22:31 +1000
message:
  Remove unneeded pulib method lookup on private class _KnitIndex.
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2007-07-13 18:18:33 +0000
+++ b/bzrlib/knit.py	2007-07-13 18:22:31 +0000
@@ -1219,10 +1219,6 @@
         """Get all the versions in the file. not topologically sorted."""
         return self._history
 
-    def lookup(self, version_id):
-        assert version_id in self._cache
-        return self._cache[version_id][5]
-
     def _version_list_to_index(self, versions):
         result_list = []
         cache = self._cache

=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py	2007-07-13 18:18:33 +0000
+++ b/bzrlib/tests/test_knit.py	2007-07-13 18:22:31 +0000
@@ -358,7 +358,9 @@
             ])
         index = self.get_knit_index(transport, "filename", "r")
         self.assertEqual(2, index.num_versions())
-        self.assertEqual(1, index.lookup("version"))
+        # check that the index used is the first one written. (Specific
+        # to KnitIndex style indices.
+        self.assertEqual("1", index._version_list_to_index(["version"]))
         self.assertEqual((3, 4), index.get_position("version"))
         self.assertEqual(["options3"], index.get_options("version"))
         self.assertEqual(["parent", "other"],
@@ -500,17 +502,6 @@
         index.add_version("b", ["option"], 0, 1, [])
         self.assertEqual(["a", "b"], index.get_versions())
 
-    def test_lookup(self):
-        transport = MockTransport([
-            _KnitIndex.HEADER,
-            "a option 0 1 :",
-            "b option 0 1 :"
-            ])
-        index = self.get_knit_index(transport, "filename", "r")
-
-        self.assertEqual(0, index.lookup("a"))
-        self.assertEqual(1, index.lookup("b"))
-
     def test_add_version(self):
         transport = MockTransport([
             _KnitIndex.HEADER




More information about the bazaar-commits mailing list