Example #1
0
def func(parser, options, args):
    """Clone the repository into the local dir and initialise 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 CmdException('"%s" exists. Remove it first' % local_dir)

    clone(repository, local_dir)
    os.chdir(local_dir)
    directory = DirectoryHasRepository()
    directory.setup()
    Stack.initialise(directory.repository)
Example #2
0
File: clone.py Project: snits/stgit
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)

    git.clone(repository, local_dir)
    os.chdir(local_dir)
    directory = common.DirectoryHasRepositoryLib()
    directory.setup()
    stack.Stack.initialise(directory.repository)