changeset 25103:ce00b2e96d09

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.
author Tony Tung <tonytung@fb.com>
date Tue, 14 Apr 2015 16:23:07 -0400
parents bb2f543b48b5
children d6453f6fbdba
files hgext/shelve.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Fri May 15 11:52:09 2015 -0500
+++ b/hgext/shelve.py	Tue Apr 14 16:23:07 2015 -0400
@@ -691,21 +691,21 @@
     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:
-                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