Commits

Martin Geisler committed 398336d

more carefull extraction of values from opts

This makes the functions easier to call from other Python code since
you don't have to supply as many values in opts. See this changeset
for a similar change in Mercurial:

http://www.selenic.com/hg/rev/784073457a0f

Comments (0)

Files changed (1)

     s = repo.attic
     if not name and s.currentpatch == 'default':
         name = 'default'
-    if opts['interactive']:
+    if opts.get('interactive'):
         interactiveshelve(ui, repo, name, pats, opts)
         repo.ui.status(_('patch %s shelved\n' % (s.currentpatch)))
     else:
         makepatch(ui, repo, name, pats, opts)
-        if opts['refresh']:
+        if opts.get('refresh'):
             if name:
                 s.applied = name
                 s.persiststate()
 def unshelve(ui, repo, name = None, **opts):
     """applies a patch from the attic to the working copy"""
     s = repo.attic
-    force = opts['force']
+    force = opts.get('force')
     if s.applied and not force:
         raise util.Abort(_('cannot apply a patch over an already active patch'))
     if not name:
     s.apply(repo, name, sim, **opts)
     s.persiststate()
     repo.ui.status(_('patch %s unshelved\n') % (s.applied))
-    if opts['delete']:
+    if opts.get('delete'):
         s.remove(name)
         repo.ui.status(_('patch removed\n'))
         s.resetdefault()
 
 def listattic(ui, repo, **opts):
     """lists the available patches in the attic"""
-    if opts['current']:
+    if opts.get('current'):
         currentinfo(ui, repo)
-    elif opts['header']:
+    elif opts.get('header'):
         headerinfo(ui, repo, opts['header'])
     else:
         s = repo.attic
         orig(ui, repo, message = '\n'.join(m),
              logfile = None, user = u, date = d)
 
-        if not opts['keep']:
+        if not opts.get('keep'):
             s.remove(name)
         s.resetdefault()