Commit 9141ebbd authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in commiting from one version to another that caused

destination version to fail to detect the new data.
parent b15feea9
...@@ -149,7 +149,7 @@ Also, the object ids time stamps are big-endian, so comparisons ...@@ -149,7 +149,7 @@ Also, the object ids time stamps are big-endian, so comparisons
are meaningful. are meaningful.
""" """
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import struct, time, os, bpthread, string, base64 import struct, time, os, bpthread, string, base64
now=time.time now=time.time
...@@ -351,7 +351,8 @@ class FileStorage: ...@@ -351,7 +351,8 @@ class FileStorage:
here=tfile.tell()+self._pos+self._thl here=tfile.tell()+self._pos+self._thl
oids=[] oids=[]
appoids=oids.append appoids=oids.append
tvindex=self._tvindex
while srcpos: while srcpos:
seek(srcpos) seek(srcpos)
h=read(58) # oid, serial, prev(oid), tloc, vlen, plen, pnv, pv h=read(58) # oid, serial, prev(oid), tloc, vlen, plen, pnv, pv
...@@ -361,6 +362,7 @@ class FileStorage: ...@@ -361,6 +362,7 @@ class FileStorage:
appoids(oid) appoids(oid)
write(h[:16] + spos + middle) write(h[:16] + spos + middle)
if dest: if dest:
tvindex[dest]=here
write(h[-16:-8]+sd+dest) write(h[-16:-8]+sd+dest)
sd=p64(here) sd=p64(here)
...@@ -370,7 +372,7 @@ class FileStorage: ...@@ -370,7 +372,7 @@ class FileStorage:
spos=h[-8:] spos=h[-8:]
srcpos=u64(spos) srcpos=u64(spos)
self._tvindex[src]=0 tvindex[src]=0
return oids return oids
...@@ -624,7 +626,8 @@ class FileStorage: ...@@ -624,7 +626,8 @@ class FileStorage:
prev=u64(sprev) prev=u64(sprev)
dlen=42+(plen or 8) dlen=42+(plen or 8)
if vlen: dlen=dlen+16+vlen if vlen: dlen=dlen+16+vlen
if indexpos(oid,0) != pos: raise UndoError, 'Undoable transaction' if indexpos(oid,0) != pos:
raise UndoError, 'Undoable transaction'
pos=pos+dlen pos=pos+dlen
if pos > tend: raise UndoError, 'Undoable transaction' if pos > tend: raise UndoError, 'Undoable transaction'
tappend((oid,prev)) tappend((oid,prev))
......
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