Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
7ee7c920
Commit
7ee7c920
authored
May 14, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged the tseaver-better_repozo_tests branch.
parent
c36d4c48
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
599 additions
and
95 deletions
+599
-95
src/ZODB/scripts/repozo.py
src/ZODB/scripts/repozo.py
+13
-6
src/ZODB/scripts/tests/test_repozo.py
src/ZODB/scripts/tests/test_repozo.py
+586
-89
No files found.
src/ZODB/scripts/repozo.py
View file @
7ee7c920
...
...
@@ -93,6 +93,9 @@ READCHUNK = 16 * 1024
VERBOSE
=
False
class
WouldOverwriteFiles
(
Exception
):
pass
def
usage
(
code
,
msg
=
''
):
outfp
=
sys
.
stderr
if
code
==
0
:
...
...
@@ -301,7 +304,9 @@ def gen_filename(options, ext=None):
ext
=
'.deltafs'
if
options
.
gzip
:
ext
+=
'z'
t
=
time
.
gmtime
()[:
6
]
+
(
ext
,)
# Hook for testing
now
=
getattr
(
options
,
'test_now'
,
time
.
gmtime
()[:
6
])
t
=
now
+
(
ext
,)
return
'%04d-%02d-%02d-%02d-%02d-%02d%s'
%
t
# Return a list of files needed to reproduce state at time options.date.
...
...
@@ -419,8 +424,7 @@ def do_full_backup(options):
options
.
full
=
True
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
))
if
os
.
path
.
exists
(
dest
):
print
>>
sys
.
stderr
,
'Cannot overwrite existing file:'
,
dest
sys
.
exit
(
2
)
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
log
(
'writing full backup: %s bytes to %s'
,
pos
,
dest
)
sum
=
copyfile
(
options
,
dest
,
0
,
pos
)
# Write the data file for this full backup
...
...
@@ -447,8 +451,7 @@ def do_incremental_backup(options, reposz, repofiles):
options
.
full
=
False
dest
=
os
.
path
.
join
(
options
.
repository
,
gen_filename
(
options
))
if
os
.
path
.
exists
(
dest
):
print
>>
sys
.
stderr
,
'Cannot overwrite existing file:'
,
dest
sys
.
exit
(
2
)
raise
WouldOverwriteFiles
(
'Cannot overwrite existing file: %s'
%
dest
)
log
(
'writing incremental: %s bytes to %s'
,
pos
-
reposz
,
dest
)
sum
=
copyfile
(
options
,
dest
,
reposz
,
pos
-
reposz
)
# The first file in repofiles points to the last full backup. Use this to
...
...
@@ -570,7 +573,11 @@ def main(argv=None):
argv
=
sys
.
argv
[
1
:]
options
=
parseargs
(
argv
)
if
options
.
mode
==
BACKUP
:
do_backup
(
options
)
try
:
do_backup
(
options
)
except
WouldOverwriteFiles
,
e
:
print
>>
sys
.
stderr
,
str
(
e
)
sys
.
exit
(
2
)
else
:
assert
options
.
mode
==
RECOVER
do_recover
(
options
)
...
...
src/ZODB/scripts/tests/test_repozo.py
View file @
7ee7c920
This diff is collapsed.
Click to expand it.
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