Rev 34: We've gotten farther along in the acceptance test. in lp:~jameinel/+junk/file_locking

John Arbash Meinel john at arbash-meinel.com
Wed Sep 23 04:07:13 BST 2009


At lp:~jameinel/+junk/file_locking

------------------------------------------------------------
revno: 34
revision-id: john at arbash-meinel.com-20090923030703-83thv9ikkvh4fhvi
parent: john at arbash-meinel.com-20090922212435-nw190q2b1skjo4pz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: file_locking
timestamp: Tue 2009-09-22 22:07:03 -0500
message:
  We've gotten farther along in the acceptance test.
-------------- next part --------------
=== modified file 'file_lock.py'
--- a/file_lock.py	2009-09-22 21:22:58 +0000
+++ b/file_lock.py	2009-09-23 03:07:03 +0000
@@ -488,6 +488,9 @@
         # TODO: Figure out matches when locks are nested
         # tracked_paths.sort(key=len, reverse=True)
         trackers = {}
+        # Note that this is O(M*N), we probably could do something a bit
+        # smarter. For example, we could trivially hash by the first directory
+        # name, or by the first letter of the path.
         for path in paths:
             for t_path in tracked_paths:
                 if osutils.is_inside(t_path, path):
@@ -497,9 +500,6 @@
                 trackers[path] = None
         return trackers
 
-    def is_tracked(self, path):
-        """For the given path, is it considered 'tracked'?"""
-
     def is_locked(self, path):
         """Is the given path already locked?
 

=== modified file 'tests/test_file_lock.py'
--- a/tests/test_file_lock.py	2009-09-22 21:24:35 +0000
+++ b/tests/test_file_lock.py	2009-09-23 03:07:03 +0000
@@ -275,16 +275,17 @@
         tree.branch.pull(builder.get_branch())
         # Refresh the memory tree
         tree.unlock()
+        tree._branch_revision_id = 'A'
         tree.lock_write()
         manager.initialize_lock_store(self.get_transport('lock-store'))
-        self.knownFailure('not implemented yet.')
         manager.track_paths(['b'])
         self.assertFalse(manager.is_locked('b'))
-        self.assertFalse(manager.is_tracked('a'))
-        self.assertTrue(manager.is_tracked('b'))
-        self.assertTrue(manager.is_tracked('b/c'))
+        self.assertEqual({'a': None, 'b': 'b', 'b/c': 'b'},
+                         manager.tracked_at(['a', 'b', 'b/c']))
         self.assertFalse(manager.is_locked('b/c'))
         manager.take_lock('b')
+        self.expectFailure('locking not supported yet',
+            self.assertTrue, manager.is_locked('b'))
         self.assertTrue(manager.is_locked('b'))
         self.assertTrue(manager.is_locked('b/c'))
         self.assertTrue(manager.have_lock('b'))



More information about the bazaar-commits mailing list