Skip to content
Snippets Groups Projects
Commit ce00b2e96d09 authored by Tony Tung's avatar Tony Tung
Browse files

shelve: refactor allowables to specify sets of valid operations

This will allow us to have --patch and --stat as standalone operations that
don't require --list, as well as pairing them with --list.
parent bb2f543b48b5
No related branches found
No related tags found
No related merge requests found
......@@ -691,17 +691,17 @@
cmdutil.checkunfinished(repo)
allowables = [
('addremove', 'create'), # 'create' is pseudo action
('cleanup', 'cleanup'),
# ('date', 'create'), # ignored for passing '--date "0 0"' in tests
('delete', 'delete'),
('edit', 'create'),
('list', 'list'),
('message', 'create'),
('name', 'create'),
('patch', 'list'),
('stat', 'list'),
('addremove', set(['create'])), # 'create' is pseudo action
('cleanup', set(['cleanup'])),
# ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests
('delete', set(['delete'])),
('edit', set(['create'])),
('list', set(['list'])),
('message', set(['create'])),
('name', set(['create'])),
('patch', set(['list'])),
('stat', set(['list'])),
]
def checkopt(opt):
if opts[opt]:
for i, allowable in allowables:
......@@ -704,8 +704,8 @@
]
def checkopt(opt):
if opts[opt]:
for i, allowable in allowables:
if opts[i] and opt != allowable:
if opts[i] and opt not in allowable:
raise util.Abort(_("options '--%s' and '--%s' may not be "
"used together") % (opt, i))
return True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment