Commit 19e7bc4e authored by Jeremy Hylton's avatar Jeremy Hylton

Add getSerial() routine that return current revision id for an oid.

BaseStorage implements this in terms of modifiedInVersion() and
load().  Other storages may (perhaps even should) implement it more
efficiently.
parent 53cef0df
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
""" """
# Do this portably in the face of checking out with -kv # Do this portably in the face of checking out with -kv
import string import string
__version__ = string.split('$Revision: 1.14 $')[-2:][0] __version__ = string.split('$Revision: 1.15 $')[-2:][0]
import ThreadLock, bpthread import ThreadLock, bpthread
import time, UndoLogCompatible import time, UndoLogCompatible
...@@ -253,6 +253,15 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -253,6 +253,15 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
def pack(self, t, referencesf): pass def pack(self, t, referencesf): pass
def getSerial(self, oid):
self._lock_acquire()
try:
v = self.modifiedInVersion(oid)
pickledata, serial = self.load(oid, v)
return serial
finally:
self._lock_release()
def loadSerial(self, oid, serial): def loadSerial(self, oid, serial):
raise POSException.Unsupported, ( raise POSException.Unsupported, (
"Retrieval of historical revisions is not supported") "Retrieval of historical revisions is not supported")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment