Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
663174eb
Commit
663174eb
authored
Mar 29, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do some reformatting and un-optimization on undoLog()
parent
7b1532bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
25 deletions
+23
-25
src/ZODB/FileStorage.py
src/ZODB/FileStorage.py
+23
-25
No files found.
src/ZODB/FileStorage.py
View file @
663174eb
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
# may have a back pointer to a version record or to a non-version
# may have a back pointer to a version record or to a non-version
# record.
# record.
#
#
__version__
=
'$Revision: 1.8
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
6
$'
[
11
:
-
2
]
import
struct
,
time
,
os
,
string
,
base64
,
sys
import
struct
,
time
,
os
,
string
,
base64
,
sys
from
struct
import
pack
,
unpack
from
struct
import
pack
,
unpack
...
@@ -1164,38 +1164,36 @@ class FileStorage(BaseStorage.BaseStorage,
...
@@ -1164,38 +1164,36 @@ class FileStorage(BaseStorage.BaseStorage,
def
undoLog
(
self
,
first
=
0
,
last
=-
20
,
filter
=
None
):
def
undoLog
(
self
,
first
=
0
,
last
=-
20
,
filter
=
None
):
if
last
<
0
:
if
last
<
0
:
last
=
first
-
last
+
1
last
=
first
-
last
+
1
self
.
_lock_acquire
()
self
.
_lock_acquire
()
try
:
try
:
packt
=
self
.
_packt
if
self
.
_packt
is
None
:
if
packt
is
None
:
raise
UndoError
(
raise
UndoError
(
'Undo is currently disabled for database maintenance.<p>'
)
'Undo is currently disabled for database maintenance.<p>'
)
pos
=
self
.
_pos
pos
=
self
.
_pos
# BAW: Why 39 please? This makes no sense (see also below).
# BAW: Why 39 please? This makes no sense (see also below).
if
pos
<
39
:
if
pos
<
39
:
return
[]
return
[]
file
=
self
.
_file
file
=
self
.
_file
seek
=
file
.
seek
seek
=
file
.
seek
read
=
file
.
read
read
=
file
.
read
unpack
=
struct
.
unpack
r
=
[]
strip
=
string
.
strip
i
=
0
encode
=
base64
.
encodestring
r
=
[]
append
=
r
.
append
i
=
0
while
i
<
last
and
pos
>
39
:
while
i
<
last
and
pos
>
39
:
se
ek
(
pos
-
8
)
se
lf
.
_file
.
seek
(
pos
-
8
)
pos
=
pos
-
U64
(
read
(
8
))
-
8
pos
=
pos
-
U64
(
self
.
_file
.
read
(
8
))
-
8
seek
(
pos
)
se
lf
.
_file
.
se
ek
(
pos
)
h
=
read
(
TRANS_HDR_LEN
)
h
=
self
.
_file
.
read
(
TRANS_HDR_LEN
)
tid
,
tl
,
status
,
ul
,
dl
,
el
=
unpack
(
">8s8scHHH"
,
h
)
tid
,
tl
,
status
,
ul
,
dl
,
el
=
struct
.
unpack
(
">8s8scHHH"
,
h
)
if
tid
<
packt
:
if
tid
<
self
.
_
packt
:
break
break
if
status
!=
' '
:
if
status
!=
' '
:
continue
continue
u
=
ul
and
read
(
ul
)
or
''
d
=
u
=
''
d
=
dl
and
read
(
dl
)
or
''
if
ul
:
u
=
self
.
_file
.
read
(
ul
)
if
dl
:
d
=
self
.
_file
.
read
(
dl
)
e
=
{}
e
=
{}
if
el
:
if
el
:
try
:
try
:
...
@@ -1231,15 +1229,15 @@ class FileStorage(BaseStorage.BaseStorage,
...
@@ -1231,15 +1229,15 @@ class FileStorage(BaseStorage.BaseStorage,
id
=
tid
+
p64
(
pos
)
id
=
tid
+
p64
(
pos
)
else
:
else
:
id
=
tid
+
p64
(
pos
)
+
next
id
=
tid
+
p64
(
pos
)
+
next
d
=
{
'id'
:
encode
(
id
).
rstrip
(),
d
=
{
'id'
:
base64
.
encodestring
(
id
).
rstrip
(),
'time'
:
TimeStamp
(
tid
).
timeTime
(),
'time'
:
TimeStamp
(
tid
).
timeTime
(),
'user_name'
:
u
,
'user_name'
:
u
,
'description'
:
d
}
'description'
:
d
}
d
.
update
(
e
)
d
.
update
(
e
)
if
filter
is
None
or
filter
(
d
):
if
filter
is
None
or
filter
(
d
):
if
i
>=
first
:
if
i
>=
first
:
append
(
d
)
r
.
append
(
d
)
i
=
i
+
1
i
+=
1
return
r
return
r
finally
:
finally
:
self
.
_lock_release
()
self
.
_lock_release
()
...
...
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