Greg Ward  committed c472e03

Use opts.get(...) rather than opts[...].
This makes it easier for scripts or other extensions to use attic as a
Python API: they can just pass in empty opts rather than add the keys
that attic requires to be present.

  • Participants
  • Parent commits c4f70f7
  • Branches default

Comments (0)

Files changed (1)

     def _applymerge(self, repo, patchfile, sim, name, parent, force=False, **opts):
         """applies a patch using fancy merge technology."""
-        reverse = opts['reverse']
+        reverse = opts.get('reverse')
         opts['reverse'] = False
         def smwrapper(orig, *args, **opts):
                                         force=force, **opts)
         if success:
-            if opts['reverse']:
+            if opts.get('reverse'):
                 self.applied = ''
                 self.currentpatch = ''
         m = cmdutil.match(repo, pats, opts)
         added = repo.status(match=m)[1]
-        revertopts = { 'include': opts['include'],
-                       'exclude': opts['exclude'],
+        revertopts = { 'include': opts.get('include'),
+                       'exclude': opts.get('exclude'),
                        'date': None,
                        'all': True,
                        'rev': '.',