def func(parser, options, args): """Clone the <repository> into the local <dir> and initialises the stack """ if len(args) != 2: parser.error('incorrect number of arguments') repository = args[0] local_dir = args[1] if os.path.exists(local_dir): raise common.CmdException('"%s" exists. Remove it first' % local_dir) clone(repository, local_dir) os.chdir(local_dir) directory = common.DirectoryHasRepositoryLib() directory.setup() Stack.initialise(directory.repository)
kind = 'stack' usage = [''] description = """ Print the name of the next patch.""" args = [] options = [ opt( '-b', '--branch', args=[argparse.stg_branches], short='Use BRANCH instead of the default branch', ) ] directory = common.DirectoryHasRepositoryLib() def func(parser, options, args): """Show the name of the next patch """ if len(args) != 0: parser.error('incorrect number of arguments') stack = directory.repository.get_stack(options.branch) unapplied = stack.patchorder.unapplied if unapplied: out.stdout(unapplied[0]) else: raise common.CmdException('No unapplied patches')