+ args = common.parse_patches(args, (list(stack.patchorder.applied)
+ + list(stack.patchorder.unapplied)))
+ if len([x for x in [args, options.number != None, options.all] if x]) > 1:
+ parser.error('too many options')
+ if args:
+ patches = [pn for pn in (stack.patchorder.applied
+ + stack.patchorder.unapplied) if pn in args]
+ bad = set(args) - set(patches)
+ if bad:
+ raise common.CmdException('Bad patch names: %s'
+ % ', '.join(sorted(bad)))
+ elif options.number != None:
+ if options.number <= len(stack.patchorder.applied):
+ patches = stack.patchorder.applied[:options.number]
+ else:
+ raise common.CmdException('There are not that many applied patches')
+ elif options.all:
+ patches = stack.patchorder.applied
+ else:
+ patches = stack.patchorder.applied[:1]