Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
964db367
Commit
964db367
authored
Jun 15, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
history(): Jim says that the `version' argument is a bug, and should
be ignored. This simplifies the logic a bit.
parent
181fdd8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
76 deletions
+76
-76
lib/python/BDBStorage/BDBFullStorage.py
lib/python/BDBStorage/BDBFullStorage.py
+38
-38
lib/python/BDBStorage/Full.py
lib/python/BDBStorage/Full.py
+38
-38
No files found.
lib/python/BDBStorage/BDBFullStorage.py
View file @
964db367
...
@@ -4,7 +4,7 @@ See Minimal.py for an implementation of Berkeley storage that does not support
...
@@ -4,7 +4,7 @@ See Minimal.py for an implementation of Berkeley storage that does not support
undo or versioning.
undo or versioning.
"""
"""
__version__
=
'$Revision: 1.2
5
$'
[
-
2
:][
0
]
__version__
=
'$Revision: 1.2
6
$'
[
-
2
:][
0
]
import
struct
import
struct
import
time
import
time
...
@@ -845,49 +845,49 @@ class Full(BerkeleyBase):
...
@@ -845,49 +845,49 @@ class Full(BerkeleyBase):
def
history
(
self
,
oid
,
version
=
None
,
size
=
1
,
filter
=
None
):
def
history
(
self
,
oid
,
version
=
None
,
size
=
1
,
filter
=
None
):
self
.
_lock_acquire
()
self
.
_lock_acquire
()
try
:
try
:
# Find the vid for the version
# Jim says:
if
version
is
None
:
#
tvid
=
None
# This documentation is wrong. I think that the version should
version
=
''
# be ignored. It really shouldn't be in the signature. Zope
elif
version
==
''
:
# never passes the version argument.
tvid
=
0
#
else
:
# so we ignore `version', which makes our lives a bit easier. We
# BAW: for now, let KeyErrors percolate up
# start with the most recent revision of the object, then search
tvid
=
self
.
_vids
[
version
]
# the transaction records backwards until we find enough records.
# Start with the most recent revision of the object, then search
# the transaction records backwards finding revisions in the
# selected version.
history
=
[]
history
=
[]
revid
=
self
.
_serials
[
oid
]
revid
=
self
.
_serials
[
oid
]
# BAW: Again, let KeyErrors percolate up
# BAW: Again, let KeyErrors percolate up
while
len
(
history
)
<
size
:
while
len
(
history
)
<
size
:
# Some information comes out of the revision metadata...
vid
,
nvrevid
,
lrevid
,
previd
=
struct
.
unpack
(
vid
,
nvrevid
,
lrevid
,
previd
=
struct
.
unpack
(
'>8s8s8s8s'
,
self
.
_metadata
[
oid
+
revid
])
'>8s8s8s8s'
,
self
.
_metadata
[
oid
+
revid
])
if
tvid
is
None
or
vid
==
ZERO
or
tvid
==
vid
:
# ...while other information comes out of the transaction
# Get transaction metadata, which we need to fill in the
# metadata.
# appropriate HistoryEntry slots.
txnmeta
=
self
.
_txnMetadata
[
revid
]
txnmeta
=
self
.
_txnMetadata
[
revid
]
userlen
,
desclen
=
struct
.
unpack
(
'>II'
,
txnmeta
[
1
:
9
])
userlen
,
desclen
=
struct
.
unpack
(
'>II'
,
txnmeta
[
1
:
9
])
user
=
txnmeta
[
9
:
9
+
userlen
]
user
=
txnmeta
[
9
:
9
+
userlen
]
desc
=
txnmeta
[
9
+
userlen
:
9
+
userlen
+
desclen
]
desc
=
txnmeta
[
9
+
userlen
:
9
+
userlen
+
desclen
]
# Now get the pickle size
# Now get the pickle size
data
=
self
.
_pickles
[
oid
+
lrevid
]
data
=
self
.
_pickles
[
oid
+
lrevid
]
# Create a HistoryEntry structure, which turns out to be a
# Create a HistoryEntry structure, which turns out to be a
# dictionary with some specifically named entries (BAW:
# dictionary with some specifically named entries (BAW:
# although this poorly documented).
# although this poorly documented).
if
vid
==
ZERO
:
if
vid
==
ZERO
:
retvers
=
''
retvers
=
''
else
:
else
:
retvers
=
self
.
_versions
[
vid
]
retvers
=
version
# The HistoryEntry object
d
=
{
'time'
:
TimeStamp
(
revid
).
timeTime
(),
d
=
{
'time'
:
TimeStamp
(
revid
).
timeTime
(),
'user_name'
:
user
,
'user_name'
:
user
,
'description'
:
desc
,
'description'
:
desc
,
'serial'
:
revid
,
'serial'
:
revid
,
'version'
:
retvers
,
'version'
:
retvers
,
'size'
:
len
(
data
),
'size'
:
len
(
data
),
}
}
if
filter
is
None
or
filter
(
d
):
if
filter
is
None
or
filter
(
d
):
history
.
append
(
d
)
history
.
append
(
d
)
# Chase the link backwards to the next most historical
# revision, stopping when we've reached the end.
if
previd
==
ZERO
:
if
previd
==
ZERO
:
break
break
revid
=
previd
revid
=
previd
...
...
lib/python/BDBStorage/Full.py
View file @
964db367
...
@@ -4,7 +4,7 @@ See Minimal.py for an implementation of Berkeley storage that does not support
...
@@ -4,7 +4,7 @@ See Minimal.py for an implementation of Berkeley storage that does not support
undo or versioning.
undo or versioning.
"""
"""
__version__
=
'$Revision: 1.2
5
$'
[
-
2
:][
0
]
__version__
=
'$Revision: 1.2
6
$'
[
-
2
:][
0
]
import
struct
import
struct
import
time
import
time
...
@@ -845,49 +845,49 @@ class Full(BerkeleyBase):
...
@@ -845,49 +845,49 @@ class Full(BerkeleyBase):
def
history
(
self
,
oid
,
version
=
None
,
size
=
1
,
filter
=
None
):
def
history
(
self
,
oid
,
version
=
None
,
size
=
1
,
filter
=
None
):
self
.
_lock_acquire
()
self
.
_lock_acquire
()
try
:
try
:
# Find the vid for the version
# Jim says:
if
version
is
None
:
#
tvid
=
None
# This documentation is wrong. I think that the version should
version
=
''
# be ignored. It really shouldn't be in the signature. Zope
elif
version
==
''
:
# never passes the version argument.
tvid
=
0
#
else
:
# so we ignore `version', which makes our lives a bit easier. We
# BAW: for now, let KeyErrors percolate up
# start with the most recent revision of the object, then search
tvid
=
self
.
_vids
[
version
]
# the transaction records backwards until we find enough records.
# Start with the most recent revision of the object, then search
# the transaction records backwards finding revisions in the
# selected version.
history
=
[]
history
=
[]
revid
=
self
.
_serials
[
oid
]
revid
=
self
.
_serials
[
oid
]
# BAW: Again, let KeyErrors percolate up
# BAW: Again, let KeyErrors percolate up
while
len
(
history
)
<
size
:
while
len
(
history
)
<
size
:
# Some information comes out of the revision metadata...
vid
,
nvrevid
,
lrevid
,
previd
=
struct
.
unpack
(
vid
,
nvrevid
,
lrevid
,
previd
=
struct
.
unpack
(
'>8s8s8s8s'
,
self
.
_metadata
[
oid
+
revid
])
'>8s8s8s8s'
,
self
.
_metadata
[
oid
+
revid
])
if
tvid
is
None
or
vid
==
ZERO
or
tvid
==
vid
:
# ...while other information comes out of the transaction
# Get transaction metadata, which we need to fill in the
# metadata.
# appropriate HistoryEntry slots.
txnmeta
=
self
.
_txnMetadata
[
revid
]
txnmeta
=
self
.
_txnMetadata
[
revid
]
userlen
,
desclen
=
struct
.
unpack
(
'>II'
,
txnmeta
[
1
:
9
])
userlen
,
desclen
=
struct
.
unpack
(
'>II'
,
txnmeta
[
1
:
9
])
user
=
txnmeta
[
9
:
9
+
userlen
]
user
=
txnmeta
[
9
:
9
+
userlen
]
desc
=
txnmeta
[
9
+
userlen
:
9
+
userlen
+
desclen
]
desc
=
txnmeta
[
9
+
userlen
:
9
+
userlen
+
desclen
]
# Now get the pickle size
# Now get the pickle size
data
=
self
.
_pickles
[
oid
+
lrevid
]
data
=
self
.
_pickles
[
oid
+
lrevid
]
# Create a HistoryEntry structure, which turns out to be a
# Create a HistoryEntry structure, which turns out to be a
# dictionary with some specifically named entries (BAW:
# dictionary with some specifically named entries (BAW:
# although this poorly documented).
# although this poorly documented).
if
vid
==
ZERO
:
if
vid
==
ZERO
:
retvers
=
''
retvers
=
''
else
:
else
:
retvers
=
self
.
_versions
[
vid
]
retvers
=
version
# The HistoryEntry object
d
=
{
'time'
:
TimeStamp
(
revid
).
timeTime
(),
d
=
{
'time'
:
TimeStamp
(
revid
).
timeTime
(),
'user_name'
:
user
,
'user_name'
:
user
,
'description'
:
desc
,
'description'
:
desc
,
'serial'
:
revid
,
'serial'
:
revid
,
'version'
:
retvers
,
'version'
:
retvers
,
'size'
:
len
(
data
),
'size'
:
len
(
data
),
}
}
if
filter
is
None
or
filter
(
d
):
if
filter
is
None
or
filter
(
d
):
history
.
append
(
d
)
history
.
append
(
d
)
# Chase the link backwards to the next most historical
# revision, stopping when we've reached the end.
if
previd
==
ZERO
:
if
previd
==
ZERO
:
break
break
revid
=
previd
revid
=
previd
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment