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
nexedi
ZODB
Commits
5321ae13
Commit
5321ae13
authored
Mar 18, 2019
by
Marius Gedminas
Committed by
GitHub
Mar 18, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #260 from zopefoundation/repozo-better-error
repozo -B with missing -f should show a clear error message
parents
334282c3
eac31d9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
src/ZODB/scripts/repozo.py
src/ZODB/scripts/repozo.py
+2
-0
src/ZODB/scripts/tests/test_repozo.py
src/ZODB/scripts/tests/test_repozo.py
+13
-3
No files found.
src/ZODB/scripts/repozo.py
View file @
5321ae13
...
...
@@ -251,6 +251,8 @@ def parseargs(argv):
if
options
.
withverify
is
not
None
:
log
(
'--with-verify option is ignored in backup mode'
)
options
.
withverify
=
None
if
not
options
.
file
:
usage
(
1
,
'--file is required in backup mode'
)
elif
options
.
mode
==
RECOVER
:
if
options
.
file
is
not
None
:
log
(
'--file option is ignored in recover mode'
)
...
...
src/ZODB/scripts/tests/test_repozo.py
View file @
5321ae13
...
...
@@ -150,7 +150,8 @@ class Test_parseargs(unittest.TestCase):
def
test_mode_selection
(
self
):
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
])
options
=
repozo
.
parseargs
([
'-B'
,
'-f'
,
'/tmp/Data.fs'
,
'-r'
,
'/tmp/nosuchdir'
])
self
.
assertEqual
(
options
.
mode
,
repozo
.
BACKUP
)
options
=
repozo
.
parseargs
([
'-R'
,
'-r'
,
'/tmp/nosuchdir'
])
self
.
assertEqual
(
options
.
mode
,
repozo
.
RECOVER
)
...
...
@@ -173,9 +174,11 @@ class Test_parseargs(unittest.TestCase):
def
test_misc_flags
(
self
):
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
,
'-F'
])
options
=
repozo
.
parseargs
([
'-B'
,
'-f'
,
'/tmp/Data.fs'
,
'-r'
,
'/tmp/nosuchdir'
,
'-F'
])
self
.
assertTrue
(
options
.
full
)
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
,
'-k'
])
options
=
repozo
.
parseargs
([
'-B'
,
'-f'
,
'/tmp/Data.fs'
,
'-r'
,
'/tmp/nosuchdir'
,
'-k'
])
self
.
assertTrue
(
options
.
killold
)
def
test_repo_is_required
(
self
):
...
...
@@ -186,6 +189,7 @@ class Test_parseargs(unittest.TestCase):
def
test_backup_ignored_args
(
self
):
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
,
'-v'
,
'-f'
,
'/tmp/Data.fs'
,
'-o'
,
'/tmp/ignored.fs'
,
'-D'
,
'2011-12-13'
])
self
.
assertEqual
(
options
.
date
,
None
)
...
...
@@ -195,6 +199,12 @@ class Test_parseargs(unittest.TestCase):
self
.
assertIn
(
'--output option is ignored in backup mode'
,
sys
.
stderr
.
getvalue
())
def
test_backup_required_args
(
self
):
from
ZODB.scripts
import
repozo
self
.
assertRaises
(
SystemExit
,
repozo
.
parseargs
,
[
'-B'
,
'-r'
,
'/tmp/nosuchdir'
])
self
.
assertIn
(
'--file is required'
,
sys
.
stderr
.
getvalue
())
def
test_recover_ignored_args
(
self
):
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-R'
,
'-r'
,
'/tmp/nosuchdir'
,
'-v'
,
...
...
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