hgext/shelve.py
changeset 28401 2565fe39a76c
parent 28378 96a7368a79b6
child 28571 3f0e25e89e28
--- a/hgext/shelve.py	Sat Feb 27 21:15:16 2016 -0800
+++ b/hgext/shelve.py	Wed Mar 09 08:21:57 2016 +0100
@@ -290,10 +290,10 @@
     else:
         desc = '(changes in empty repository)'
 
-    if not opts['message']:
+    if not opts.get('message'):
         opts['message'] = desc
 
-    name = opts['name']
+    name = opts.get('name')
 
     lock = tr = None
     try:
@@ -540,7 +540,7 @@
 
 def unshelvecleanup(ui, repo, name, opts):
     """remove related files after an unshelve"""
-    if not opts['keep']:
+    if not opts.get('keep'):
         for filetype in 'hg patch'.split():
             shelvedfile(repo, name, filetype).movetobackup()
         cleanupoldbackups(repo)
@@ -630,8 +630,8 @@
         return _dounshelve(ui, repo, *shelved, **opts)
 
 def _dounshelve(ui, repo, *shelved, **opts):
-    abortf = opts['abort']
-    continuef = opts['continue']
+    abortf = opts.get('abort')
+    continuef = opts.get('continue')
     if not abortf and not continuef:
         cmdutil.checkunfinished(repo)
 
@@ -850,7 +850,7 @@
         ('stat', set(['stat', 'list'])),
     ]
     def checkopt(opt):
-        if opts[opt]:
+        if opts.get(opt):
             for i, allowable in allowables:
                 if opts[i] and opt not in allowable:
                     raise error.Abort(_("options '--%s' and '--%s' may not be "