Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zodbtools
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
zodbtools
Commits
054e25d5
Commit
054e25d5
authored
Jul 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
05de3cb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
2 deletions
+82
-2
zodbtools/zodb.py
zodbtools/zodb.py
+2
-2
zodbtools/zodbpack.py
zodbtools/zodbpack.py
+80
-0
No files found.
zodbtools/zodb.py
View file @
054e25d5
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017-20
19
Nexedi SA and Contributors.
# Copyright (C) 2017-20
20
Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Jérome Perrin <jerome@nexedi.com>
#
...
...
@@ -37,7 +37,7 @@ def register_command(cmdname):
command_module
=
importlib
.
import_module
(
'zodbtools.zodb'
+
cmdname
)
command_dict
[
cmdname
]
=
command_module
for
_
in
(
'analyze'
,
'cmp'
,
'commit'
,
'dump'
,
'info'
):
for
_
in
(
'analyze'
,
'cmp'
,
'commit'
,
'dump'
,
'info'
,
'pack'
):
register_command
(
_
)
...
...
zodbtools/zodbpack.py
0 → 100644
View file @
054e25d5
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""Zodbpack - Pack a ZODB database"""
from
__future__
import
print_function
from
zodbtools.util
import
storageFromURL
import
ZODB.serialize
import
sys
import
time
from
golang
import
func
,
defer
# XXX
# XXX +packtime
def
zodbpack
(
stor
):
t
=
time
.
time
()
stor
.
pack
(
t
,
ZODB
.
serialize
.
referencesf
)
# ----------------------------------------
import
getopt
summary
=
"pack a ZODB database"
def
usage
(
out
):
print
(
"""
\
Usage: zodb pack [OPTIONS] <storage>
Pack a ZODB database.
<storage> is an URL (see 'zodb help zurl') of a ZODB-storage.
XXX
Options:
-h --help show this help
"""
,
file
=
out
)
@
func
def
main
(
argv
):
try
:
optv
,
argv
=
getopt
.
getopt
(
argv
[
1
:],
"h"
,
[
"help"
])
except
getopt
.
GetoptError
as
e
:
print
(
e
,
file
=
sys
.
stderr
)
usage
(
sys
.
stderr
)
sys
.
exit
(
2
)
for
opt
,
_
in
optv
:
if
opt
in
(
"-h"
,
"--help"
):
usage
(
sys
.
stdout
)
sys
.
exit
(
0
)
try
:
storurl
=
argv
[
0
]
except
IndexError
:
usage
(
sys
.
stderr
)
sys
.
exit
(
2
)
stor
=
storageFromURL
(
storurl
,
read_only
=
True
)
defer
(
stor
.
close
)
zodbpack
(
stor
,
argv
[
1
:])
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