Rev 464: Fix bug in revid caching. in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev

Jelmer Vernooij jelmer at samba.org
Sun May 27 15:53:51 BST 2007


At http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev

------------------------------------------------------------
revno: 464
revision-id: jelmer at samba.org-20070527145252-d5bqmu83eocgt69y
parent: jelmer at samba.org-20070527140010-41aozmkiwt42nes3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sun 2007-05-27 16:52:52 +0200
message:
  Fix bug in revid caching.
modified:
  README                         README-20051120210643-bd274a2fef9aed6a
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'README'
--- a/README	2007-05-20 21:32:33 +0000
+++ b/README	2007-05-27 14:52:52 +0000
@@ -79,13 +79,14 @@
   but the number of corner cases is wide, so support for this 
   has not been enabled by default yet.
 
-- Performance. Network-wise (both bandwidth and roundtrips), the plugin is in
-  good shape. However, it is currently quite CPU-intensive for no good reason 
-  and I hope to make a couple of improvements in that area.
+- Better performance. Network-wise (both bandwidth and roundtrips), the plugin 
+  is in good shape. However, it is currently quite CPU-intensive for no good 
+  reason and I hope to make a couple of improvements in that area.
 
 - Override implementation of get_revision_delta(). Will speed up 'bzr log -v'
 	
-- use svn_ra_replay() on systems that have Subversion 1.4. Saves a couple of roundtrips when fetching history.
+- use svn_ra_replay() on systems that have Subversion 1.4. Saves a couple of 
+  roundtrips when fetching history.
 
 - implement svn_ra_get_dir_revs() in Subversion to fetch the properties set on 
   a specific directory all at once.

=== modified file 'repository.py'
--- a/repository.py	2007-05-27 14:00:10 +0000
+++ b/repository.py	2007-05-27 14:52:52 +0000
@@ -162,7 +162,8 @@
         assert self.base
         assert self.uuid
 
-        cache_file = os.path.join(self.create_cache_dir(), 'cache-v%d' % MAPPING_VERSION)
+        cache_file = os.path.join(self.create_cache_dir(), 
+                                  'cache-v%d' % MAPPING_VERSION)
         if not cachedbs.has_key(cache_file):
             cachedbs[cache_file] = sqlite3.connect(cache_file)
         self.cachedb = cachedbs[cache_file]
@@ -463,7 +464,7 @@
                 # If there are any new entries that are not yet in the cache, 
                 # add them
                 for r in revids:
-                    self.revmap.insert_revid(revid, branch, 0, revno, 
+                    self.revmap.insert_revid(r, branch, 0, revno, 
                             "undefined")
 
                 if revid in revids:

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-05-18 16:49:29 +0000
+++ b/tests/test_repos.py	2007-05-27 14:52:52 +0000
@@ -669,6 +669,18 @@
         self.assertEqual(("", 1), 
             repository.lookup_revision_id("myid"))
 
+    def test_lookup_revision_id_overridden_not_found(self):
+        """Make sure a revision id that is looked up but doesn't exist 
+        doesn't accidently end up in the revid cache."""
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/bloe': None})
+        self.client_add("dc/bloe")
+        self.client_set_prop("dc", SVN_PROP_BZR_REVISION_ID, "myid\n")
+        self.client_commit("dc", "foobar")
+        repository = Repository.open("svn+%s" % repos_url)
+        self.assertRaises(NoSuchRevision, 
+                repository.lookup_revision_id, "foobar")
+
     def test_lookup_revision_id_invalid_uuid(self):
         repos_url = self.make_client('d', 'dc')
         repository = Repository.open("svn+%s" % repos_url)




More information about the bazaar-commits mailing list