At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3894
revision-id: [email protected]
parent: [email protected]
parent: [email protected]
committer: Canonical.com Patch Queue Manager <[email protected]>
branch nick: +trunk
timestamp: Thu 2008-12-11 17:46:47 +0000
message:
  Raise if CachingParentsProvider.enable_cache used wrongly (abentley)
modified:
  bzrlib/graph.py                
graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/tests/test_graph.py     
test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 3835.1.20
    revision-id: [email protected]
    parent: [email protected]
    committer: Aaron Bentley <[email protected]>
    branch nick: remote-stacking-graph
    timestamp: Thu 2008-12-11 08:25:46 -0800
    message:
      Change custom error to an AssertionError.
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                
graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/tests/test_graph.py     
test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 3835.1.19
    revision-id: [email protected]
    parent: [email protected]
    committer: Aaron Bentley <[email protected]>
    branch nick: remote-stacking-graph
    timestamp: Wed 2008-12-10 19:28:44 -0800
    message:
      Raise exception when caching is enabled twice.
    modified:
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                
graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/tests/test_graph.py     
test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py   2008-12-10 19:40:42 +0000
+++ b/bzrlib/graph.py   2008-12-11 16:25:46 +0000
@@ -134,6 +134,8 @@
 
     def enable_cache(self, cache_misses=True):
         """Enable cache."""
+        if self._cache is not None:
+            raise AssertionError('Cache enabled when already enabled.')
         self._cache = {}
         self._cache_misses = cache_misses
         if self._debug:

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py        2008-12-10 19:40:42 +0000
+++ b/bzrlib/tests/test_graph.py        2008-12-11 16:25:46 +0000
@@ -1454,12 +1454,17 @@
         self.caching_pp.disable_cache()
         self.assertIs(None, self.caching_pp._cache)
 
+    def test_enable_cache_raises(self):
+        e = self.assertRaises(AssertionError, self.caching_pp.enable_cache)
+        self.assertEqual('Cache enabled when already enabled.', str(e))
+
     def test_cache_misses(self):
         self.caching_pp.get_parent_map(['rev3'])
         self.caching_pp.get_parent_map(['rev3'])
         self.assertEqual(['rev3'], self.inst_pp.calls)
 
     def test_no_cache_misses(self):
+        self.caching_pp.disable_cache()
         self.caching_pp.enable_cache(cache_misses=False)
         self.caching_pp.get_parent_map(['rev3'])
         self.caching_pp.get_parent_map(['rev3'])


-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to