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
eac31d9f
Commit
eac31d9f
authored
Mar 18, 2019
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repozo -B with missing -f should show a clear error
Fixes #259.
parent
334282c3
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 @
eac31d9f
...
@@ -251,6 +251,8 @@ def parseargs(argv):
...
@@ -251,6 +251,8 @@ def parseargs(argv):
if
options
.
withverify
is
not
None
:
if
options
.
withverify
is
not
None
:
log
(
'--with-verify option is ignored in backup mode'
)
log
(
'--with-verify option is ignored in backup mode'
)
options
.
withverify
=
None
options
.
withverify
=
None
if
not
options
.
file
:
usage
(
1
,
'--file is required in backup mode'
)
elif
options
.
mode
==
RECOVER
:
elif
options
.
mode
==
RECOVER
:
if
options
.
file
is
not
None
:
if
options
.
file
is
not
None
:
log
(
'--file option is ignored in recover mode'
)
log
(
'--file option is ignored in recover mode'
)
...
...
src/ZODB/scripts/tests/test_repozo.py
View file @
eac31d9f
...
@@ -150,7 +150,8 @@ class Test_parseargs(unittest.TestCase):
...
@@ -150,7 +150,8 @@ class Test_parseargs(unittest.TestCase):
def
test_mode_selection
(
self
):
def
test_mode_selection
(
self
):
from
ZODB.scripts
import
repozo
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
)
self
.
assertEqual
(
options
.
mode
,
repozo
.
BACKUP
)
options
=
repozo
.
parseargs
([
'-R'
,
'-r'
,
'/tmp/nosuchdir'
])
options
=
repozo
.
parseargs
([
'-R'
,
'-r'
,
'/tmp/nosuchdir'
])
self
.
assertEqual
(
options
.
mode
,
repozo
.
RECOVER
)
self
.
assertEqual
(
options
.
mode
,
repozo
.
RECOVER
)
...
@@ -173,9 +174,11 @@ class Test_parseargs(unittest.TestCase):
...
@@ -173,9 +174,11 @@ class Test_parseargs(unittest.TestCase):
def
test_misc_flags
(
self
):
def
test_misc_flags
(
self
):
from
ZODB.scripts
import
repozo
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
)
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
)
self
.
assertTrue
(
options
.
killold
)
def
test_repo_is_required
(
self
):
def
test_repo_is_required
(
self
):
...
@@ -186,6 +189,7 @@ class Test_parseargs(unittest.TestCase):
...
@@ -186,6 +189,7 @@ class Test_parseargs(unittest.TestCase):
def
test_backup_ignored_args
(
self
):
def
test_backup_ignored_args
(
self
):
from
ZODB.scripts
import
repozo
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
,
'-v'
,
options
=
repozo
.
parseargs
([
'-B'
,
'-r'
,
'/tmp/nosuchdir'
,
'-v'
,
'-f'
,
'/tmp/Data.fs'
,
'-o'
,
'/tmp/ignored.fs'
,
'-o'
,
'/tmp/ignored.fs'
,
'-D'
,
'2011-12-13'
])
'-D'
,
'2011-12-13'
])
self
.
assertEqual
(
options
.
date
,
None
)
self
.
assertEqual
(
options
.
date
,
None
)
...
@@ -195,6 +199,12 @@ class Test_parseargs(unittest.TestCase):
...
@@ -195,6 +199,12 @@ class Test_parseargs(unittest.TestCase):
self
.
assertIn
(
'--output option is ignored in backup mode'
,
self
.
assertIn
(
'--output option is ignored in backup mode'
,
sys
.
stderr
.
getvalue
())
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
):
def
test_recover_ignored_args
(
self
):
from
ZODB.scripts
import
repozo
from
ZODB.scripts
import
repozo
options
=
repozo
.
parseargs
([
'-R'
,
'-r'
,
'/tmp/nosuchdir'
,
'-v'
,
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