Exemplo n.º 1
0
def clone(name):
    repo_url = get_repo_url(name)
    repo_dir = get_repo_dir(name)
    repo_base_url = get_repo_base_url(name)

    if not os.path.exists(repo_dir):
        logger.info('cloning repository "%s"', name)
        repository = Repository.clone(repo_base_url, repo_dir)
    else:
        logger.info('repository "%s" is already cloned', name)
        repository = Repository(repo_dir)

    repository.set_config({
        "paths": {
            "default": repo_url,
            "base": repo_base_url
        }
    })

    return repository
Exemplo n.º 2
0
def clone(name, force_update=False):
    repo_url = get_repo_url(name)
    repo_dir = get_repo_dir(name)
    repo_base_url = get_repo_base_url(name)

    if not os.path.exists(os.path.join(repo_dir, '.hg')):
        logger.info('cloning repository "%s"', name)
        repository = Repository.clone(repo_base_url, repo_dir)
    else:
        logger.info('repository "%s" is already cloned', name)
        repository = Repository(repo_dir)
        if force_update:
            logger.info('pulling / updating repository "%s"', name)
            repository.pull(update=True)

    repository.set_config({
        "paths": {
            "default": repo_url,
            "base": repo_base_url
        }
    })

    return repository