Rev 3321: Review feedback. in http://people.ubuntu.com/~robertc/baz2.0/versioned_files

Robert Collins robertc at robertcollins.net
Mon Apr 7 22:52:12 BST 2008


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

------------------------------------------------------------
revno: 3321
revision-id: robertc at robertcollins.net-20080407215208-rg0qk19a7sanekl1
parent: robertc at robertcollins.net-20080407045452-8r6asf9hs0cl5jvy
committer: Robert Collins <robertc at robertcollins.net>
branch nick: api-cleanup
timestamp: Tue 2008-04-08 07:52:08 +1000
message:
  Review feedback.
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2008-04-04 00:06:58 +0000
+++ b/bzrlib/knit.py	2008-04-07 21:52:08 +0000
@@ -1415,7 +1415,7 @@
                                    index)
 
     def _check_write_ok(self):
-        if self.get_scope() != self.scope:
+        if self._get_scope() != self._scope:
             raise errors.OutSideTransaction()
         if self._mode != 'w':
             raise errors.ReadOnlyObjectDirtiedError(self)
@@ -1449,8 +1449,8 @@
             else:
                 self._transport.put_bytes_non_atomic(
                     self._filename, self.HEADER, mode=self._file_mode)
-        self.scope = get_scope()
-        self.get_scope = get_scope
+        self._scope = get_scope()
+        self._get_scope = get_scope
 
     def get_ancestry(self, versions, topo_sorted=True):
         """See VersionedFile.get_ancestry."""

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-04-04 00:06:58 +0000
+++ b/bzrlib/repository.py	2008-04-07 21:52:08 +0000
@@ -2042,12 +2042,8 @@
     """Repositories in a meta-dir, that work via versioned file objects."""
 
     def __init__(self, _format, a_bzrdir, control_files, _revision_store, control_store, text_store):
-        super(MetaDirVersionedFileRepository, self).__init__(_format,
-                                                a_bzrdir,
-                                                control_files,
-                                                _revision_store,
-                                                control_store,
-                                                text_store)
+        super(MetaDirVersionedFileRepository, self).__init__(_format, a_bzrdir,
+            control_files, _revision_store, control_store, text_store)
         _revision_store.get_scope = self.get_transaction
         control_store.get_scope = self.get_transaction
         text_store.get_scope = self.get_transaction

=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py	2008-04-04 00:06:58 +0000
+++ b/bzrlib/weave.py	2008-04-07 21:52:08 +0000
@@ -186,6 +186,12 @@
                  '_weave_name', '_matcher']
     
     def __init__(self, weave_name=None, access_mode='w', matcher=None, get_scope=None):
+        """Create a weave.
+
+        :param get_scope: A callable that returns an opaque object to be used
+            for detecting when this weave goes out of scope (should stop
+            answering requests or allowing mutation).
+        """
         super(Weave, self).__init__(access_mode)
         self._weave = []
         self._parents = []
@@ -199,8 +205,8 @@
             self._matcher = matcher
         if get_scope is None:
             get_scope = lambda:None
-        self.get_scope = get_scope
-        self.scope = get_scope()
+        self._get_scope = get_scope
+        self._scope = get_scope()
         self._access_mode = access_mode
 
     def __repr__(self):
@@ -208,7 +214,7 @@
 
     def _check_write_ok(self):
         """Is the versioned file marked as 'finished' ? Raise if it is."""
-        if self.get_scope() != self.scope:
+        if self._get_scope() != self._scope:
             raise errors.OutSideTransaction()
         if self._access_mode != 'w':
             raise errors.ReadOnlyObjectDirtiedError(self)




More information about the bazaar-commits mailing list