This simplifies the code in a number of places.
Signed-off-by: Karl Hasselström <kha@treskal.com>
def func(parser, options, args):
stack = directory.repository.current_stack
def func(parser, options, args):
stack = directory.repository.current_stack
- patches = common.parse_patches(args, (list(stack.patchorder.applied)
- + list(stack.patchorder.unapplied)))
+ patches = common.parse_patches(args, list(stack.patchorder.all))
if len(patches) < 2:
raise common.CmdException('Need at least two patches')
return _coalesce(stack, stack.repository.default_iw, options.name,
if len(patches) < 2:
raise common.CmdException('Need at least two patches')
return _coalesce(stack, stack.repository.default_iw, options.name,
def func(parser, options, args):
"""Commit a number of patches."""
stack = directory.repository.current_stack
def func(parser, options, args):
"""Commit a number of patches."""
stack = directory.repository.current_stack
- args = common.parse_patches(args, (list(stack.patchorder.applied)
- + list(stack.patchorder.unapplied)))
+ args = common.parse_patches(args, list(stack.patchorder.all))
if len([x for x in [args, options.number != None, options.all] if x]) > 1:
parser.error('too many options')
if args:
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]
+ patches = [pn for pn in stack.patchorder.all if pn in args]
bad = set(args) - set(patches)
if bad:
raise common.CmdException('Bad patch names: %s'
bad = set(args) - set(patches)
if bad:
raise common.CmdException('Bad patch names: %s'
stack = directory.repository.current_stack
iw = stack.repository.default_iw
if args:
stack = directory.repository.current_stack
iw = stack.repository.default_iw
if args:
- patches = set(common.parse_patches(
- args, (list(stack.patchorder.applied)
- + list(stack.patchorder.unapplied))))
+ patches = set(common.parse_patches(args, list(stack.patchorder.all)))
else:
parser.error('No patches specified')
def allow_conflicts(trans):
else:
parser.error('No patches specified')
def allow_conflicts(trans):
next_commit = get_parent(next_commit)
patch_nr = len(commits)
next_commit = get_parent(next_commit)
patch_nr = len(commits)
- taken_names = set(stack.patchorder.applied + stack.patchorder.unapplied)
+ taken_names = set(stack.patchorder.all)
if patchnames:
for pn in patchnames:
if pn in taken_names:
if patchnames:
for pn in patchnames:
if pn in taken_names:
lambda self, val: self.__set_list('applied', val))
unapplied = property(lambda self: self.__get_list('unapplied'),
lambda self, val: self.__set_list('unapplied', val))
lambda self, val: self.__set_list('applied', val))
unapplied = property(lambda self: self.__get_list('unapplied'),
lambda self, val: self.__set_list('unapplied', val))
+ all = property(lambda self: self.applied + self.unapplied)
class Patches(object):
"""Creates Patch objects."""
class Patches(object):
"""Creates Patch objects."""