Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
b9efd0b5
Commit
b9efd0b5
authored
May 24, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8708ccde
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
7 deletions
+16
-7
go/internal/xtesting/xtesting.go
go/internal/xtesting/xtesting.go
+3
-3
go/zodb/pydata.go
go/zodb/pydata.go
+1
-1
go/zodb/storage/fs1/format.go
go/zodb/storage/fs1/format.go
+7
-2
go/zodb/storage/fs1/fs1tools/dump_test.go
go/zodb/storage/fs1/fs1tools/dump_test.go
+2
-0
go/zodb/zodbtools/dump_test.go
go/zodb/zodbtools/dump_test.go
+2
-0
go/zodb/δtail.go
go/zodb/δtail.go
+1
-1
No files found.
go/internal/xtesting/xtesting.go
View file @
b9efd0b5
...
@@ -55,7 +55,7 @@ func NeedPy(t testing.TB, modules ...string) {
...
@@ -55,7 +55,7 @@ func NeedPy(t testing.TB, modules ...string) {
// verify if python is present
// verify if python is present
havePy
,
know
:=
pyHave
[
".python"
]
havePy
,
know
:=
pyHave
[
".python"
]
if
!
know
{
if
!
know
{
cmd
:=
exec
.
Command
(
"python
2
"
,
"-c"
,
"0"
)
cmd
:=
exec
.
Command
(
"python"
,
"-c"
,
"0"
)
err
:=
cmd
.
Run
()
err
:=
cmd
.
Run
()
havePy
=
(
err
==
nil
)
havePy
=
(
err
==
nil
)
pyHave
[
".python"
]
=
havePy
pyHave
[
".python"
]
=
havePy
...
@@ -69,7 +69,7 @@ func NeedPy(t testing.TB, modules ...string) {
...
@@ -69,7 +69,7 @@ func NeedPy(t testing.TB, modules ...string) {
for
_
,
pymod
:=
range
modules
{
for
_
,
pymod
:=
range
modules
{
have
,
know
:=
pyHave
[
pymod
]
have
,
know
:=
pyHave
[
pymod
]
if
!
know
{
if
!
know
{
cmd
:=
exec
.
Command
(
"python
2
"
,
"-c"
,
"import "
+
pymod
)
cmd
:=
exec
.
Command
(
"python"
,
"-c"
,
"import "
+
pymod
)
err
:=
cmd
.
Run
()
err
:=
cmd
.
Run
()
have
=
(
err
==
nil
)
have
=
(
err
==
nil
)
pyHave
[
pymod
]
=
have
pyHave
[
pymod
]
=
have
...
@@ -112,7 +112,7 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
...
@@ -112,7 +112,7 @@ func ZPyCommitRaw(zurl string, at zodb.Tid, objv ...ZRawObject) (_ zodb.Tid, err
zin
.
WriteString
(
"
\n
"
)
zin
.
WriteString
(
"
\n
"
)
// run py `zodb commit`
// run py `zodb commit`
cmd
:=
exec
.
Command
(
"python
2
"
,
"-m"
,
"zodbtools.zodb"
,
"commit"
,
zurl
,
at
.
String
())
cmd
:=
exec
.
Command
(
"python"
,
"-m"
,
"zodbtools.zodb"
,
"commit"
,
zurl
,
at
.
String
())
cmd
.
Stdin
=
zin
cmd
.
Stdin
=
zin
cmd
.
Stderr
=
os
.
Stderr
cmd
.
Stderr
=
os
.
Stderr
out
,
err
:=
cmd
.
Output
()
out
,
err
:=
cmd
.
Output
()
...
...
go/zodb/pydata.go
View file @
b9efd0b5
...
@@ -69,7 +69,7 @@ func encodePyData(pyclass pickle.Class, pystate interface{}) PyData {
...
@@ -69,7 +69,7 @@ func encodePyData(pyclass pickle.Class, pystate interface{}) PyData {
p
:=
pickle
.
NewEncoderWithConfig
(
buf
,
&
pickle
.
EncoderConfig
{
p
:=
pickle
.
NewEncoderWithConfig
(
buf
,
&
pickle
.
EncoderConfig
{
// allow pristine python2 to decode the pickle.
// allow pristine python2 to decode the pickle.
// TODO 2 -> 3 since ZODB5 switched to it and uses zodbpickle.
// TODO 2 -> 3 since ZODB5 switched to it and uses zodbpickle.
Protocol
:
2
,
Protocol
:
2
,
// XXX -> 3?
PersistentRef
:
persistentRef
,
PersistentRef
:
persistentRef
,
})
})
...
...
go/zodb/storage/fs1/format.go
View file @
b9efd0b5
...
@@ -68,7 +68,8 @@ type DataHeader struct {
...
@@ -68,7 +68,8 @@ type DataHeader struct {
}
}
const
(
const
(
Magic
=
"FS21"
// every FileStorage file starts with this
Magic21
=
"FS21"
// FileStorage file produced by Python2 starts with this
Magic30
=
"FS30"
// ----//---- by Python3 XXX +test
// on-disk sizes
// on-disk sizes
FileHeaderSize
=
4
FileHeaderSize
=
4
...
@@ -154,8 +155,12 @@ func (fh *FileHeader) Load(r io.ReaderAt) error {
...
@@ -154,8 +155,12 @@ func (fh *FileHeader) Load(r io.ReaderAt) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%sread magic: %s"
,
ioprefix
(
r
),
err
)
return
fmt
.
Errorf
(
"%sread magic: %s"
,
ioprefix
(
r
),
err
)
}
}
if
string
(
fh
.
Magic
[
:
])
!=
Magic
{
switch
string
(
fh
.
Magic
[
:
])
{
default
:
return
fmt
.
Errorf
(
"%sinvalid fs1 magic %q"
,
ioprefix
(
r
),
fh
.
Magic
)
return
fmt
.
Errorf
(
"%sinvalid fs1 magic %q"
,
ioprefix
(
r
),
fh
.
Magic
)
case
Magic21
,
Magic30
:
// ok XXX do we need to distinguish them somehow?
}
}
return
nil
return
nil
...
...
go/zodb/storage/fs1/fs1tools/dump_test.go
View file @
b9efd0b5
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
fs1tools
package
fs1tools
// XXX + py3
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../testdata/1.fs >testdata/1.fstail.ok"
//go:generate sh -c "python2 -m ZODB.scripts.fstail -n 1000000 ../testdata/1.fs >testdata/1.fstail.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/1.fs >testdata/1.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage import fsdump; fsdump.main()' ../testdata/1.fs >testdata/1.fsdump.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/1.fs >testdata/1.fsdumpv.ok"
//go:generate sh -c "python2 -c 'from ZODB.FileStorage.fsdump import Dumper; import sys; d = Dumper(sys.argv[1]); d.dump()' ../testdata/1.fs >testdata/1.fsdumpv.ok"
...
...
go/zodb/zodbtools/dump_test.go
View file @
b9efd0b5
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
zodbtools
package
zodbtools
// XXX +py3 ?
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/1.fs >testdata/1.zdump.pyok"
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/1.fs >testdata/1.zdump.pyok"
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/empty.fs >testdata/empty.zdump.pyok"
//go:generate sh -c "python2 -m zodbtools.zodb dump ../../zodb/storage/fs1/testdata/empty.fs >testdata/empty.zdump.pyok"
...
...
go/zodb/δtail.go
View file @
b9efd0b5
...
@@ -118,7 +118,7 @@ func (δtail *ΔTail) Tail() Tid {
...
@@ -118,7 +118,7 @@ func (δtail *ΔTail) Tail() Tid {
//
//
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
func
(
δtail
*
ΔTail
)
SliceByRev
(
low
,
high
Tid
)
/*readonly*/
[]
ΔRevEntry
{
func
(
δtail
*
ΔTail
)
SliceByRev
(
low
,
high
Tid
)
/*readonly*/
[]
ΔRevEntry
{
tail
:=
δtail
.
Tail
()
tail
:=
δtail
.
tail
head
:=
δtail
.
head
head
:=
δtail
.
head
if
!
(
tail
<=
low
&&
low
<=
high
&&
high
<=
head
)
{
if
!
(
tail
<=
low
&&
low
<=
high
&&
high
<=
head
)
{
panic
(
fmt
.
Sprintf
(
"δtail.Slice: invalid query: (%s, %s]; (tail, head] = (%s, %s]"
,
low
,
high
,
tail
,
head
))
panic
(
fmt
.
Sprintf
(
"δtail.Slice: invalid query: (%s, %s]; (tail, head] = (%s, %s]"
,
low
,
high
,
tail
,
head
))
...
...
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