hgext/shelve.py
changeset 21851 aad28ff87788
parent 21064 4d9d490d7bbe
child 21852 37a5decc6924
--- a/hgext/shelve.py	Wed Jul 09 12:30:12 2014 -0500
+++ b/hgext/shelve.py	Fri Jun 20 16:15:38 2014 +0900
@@ -675,20 +675,31 @@
     '''
     cmdutil.checkunfinished(repo)
 
-    def checkopt(opt, incompatible):
+    allowables = [
+        ('addremove', 'create'), # 'create' is pseudo action
+        ('cleanup', 'cleanup'),
+#       ('date', 'create'), # ignored for passing '--date "0 0"' in tests
+        ('delete', 'delete'),
+        ('list', 'list'),
+        ('message', 'create'),
+        ('name', 'create'),
+        ('patch', 'list'),
+        ('stat', 'list'),
+    ]
+    def checkopt(opt):
         if opts[opt]:
-            for i in incompatible.split():
-                if opts[i]:
+            for i, allowable in allowables:
+                if opts[i] and opt != allowable:
                     raise util.Abort(_("options '--%s' and '--%s' may not be "
                                        "used together") % (opt, i))
             return True
-    if checkopt('cleanup', 'addremove delete list message name patch stat'):
+    if checkopt('cleanup'):
         if pats:
             raise util.Abort(_("cannot specify names when using '--cleanup'"))
         return cleanupcmd(ui, repo)
-    elif checkopt('delete', 'addremove cleanup list message name patch stat'):
+    elif checkopt('delete'):
         return deletecmd(ui, repo, pats)
-    elif checkopt('list', 'addremove cleanup delete message name'):
+    elif checkopt('list'):
         return listcmd(ui, repo, pats, opts)
     else:
         for i in ('patch', 'stat'):