예제 #1
0
def clone_repository(
        url, path, bare=False, ignore_cert_errors=False,
        remote_name="origin", checkout_branch=None):
    """
    Clones a new Git repository from *url* in the given *path*.

    **bare** indicates whether a bare git repository should be created.

    **remote_name** is the name given to the "origin" remote.
    The default is "origin".

    **checkout_branch** gives the name of the branch to checkout.
    None means use the remote's *HEAD*.

    Returns a Repository class pointing to the newly cloned repository.

    If you wish to use the repo, you need to do a checkout for one of
    the available branches, like this:

        >>> repo = repo.clone_repository("url", "path")
        >>> repo.checkout(branch)  # i.e.: refs/heads/master

    """

    _pygit2.clone_repository(
        url, path, bare, ignore_cert_errors, remote_name, checkout_branch)
    return Repository(path)
예제 #2
0
파일: __init__.py 프로젝트: carlosmn/pygit2
def clone_repository(
        url, path, bare=False, ignore_cert_errors=False,
        remote_name="origin", checkout_branch=None, credentials=None):
    """Clones a new Git repository from *url* in the given *path*.

    Returns a Repository class pointing to the newly cloned repository.

    :param str url: URL of the repository to clone

    :param str path: Local path to clone into

    :param bool bare: Whether the local repository should be bare

    :param str remote_name: Name to give the remote at *url*.

    :param str checkout_branch: Branch to checkout after the
     clone. The default is to use the remote's default branch.

    :param callable credentials: authentication to use if the remote
     requires it

    :rtype: Repository

    """

    _pygit2.clone_repository(
        url, path, bare, ignore_cert_errors, remote_name, checkout_branch, credentials)
    return Repository(path)
예제 #3
0
def clone_repository(
        url, path, bare=False, ignore_cert_errors=False,
        remote_name="origin", checkout_branch=None):
    """
    Clones a new Git repository from *url* in the given *path*.

    **bare** indicates whether a bare git repository should be created.

    **remote_name** is the name given to the "origin" remote.
    The default is "origin".

    **checkout_branch** gives the name of the branch to checkout.
    None means use the remote's *HEAD*.

    Returns a Repository class pointing to the newly cloned repository.

    If you wish to use the repo, you need to do a checkout for one of
    the available branches, like this:

        >>> repo = repo.clone_repository("url", "path")
        >>> repo.checkout(branch)  # i.e.: refs/heads/master

    """

    _pygit2.clone_repository(
        url, path, bare, ignore_cert_errors, remote_name, checkout_branch)
    return Repository(path)
예제 #4
0
def clone_repository(url,
                     path,
                     bare=False,
                     remote_name="origin",
                     push_url=None,
                     fetch_spec=None,
                     push_spec=None,
                     checkout_branch=None):
    """
    Clones a new Git repository from *url* in the given *path*.

    **bare** indicates whether a bare git repository should be created.

    **remote_name** is the name given to the "origin" remote.
    The default is "origin".

    **push_url** is a URL to be used for pushing.
    None means use the *url* parameter.

    **fetch_spec** defines the the default fetch spec.
    None results in the same behavior as *GIT_REMOTE_DEFAULT_FETCH*.

    **push_spec** is the fetch specification to be used for pushing.
    None means use the same spec as for *fetch_spec*.

    **checkout_branch** gives the name of the branch to checkout.
    None means use the remote's *HEAD*.

    Returns a Repository class pointing to the newly cloned repository.

    If you wish to use the repo, you need to do a checkout for one of
    the available branches, like this:

        >>> repo = repo.clone_repository("url", "path")
        >>> repo.checkout(branch)  # i.e.: refs/heads/master

    """

    _pygit2.clone_repository(url, path, bare, remote_name, push_url,
                             fetch_spec, push_spec, checkout_branch)
    return Repository(path)
예제 #5
0
def clone_repository(
        url, path, bare=False, remote_name="origin",
        push_url=None, fetch_spec=None,
        push_spec=None, checkout_branch=None):
    """
    Clones a new Git repository from *url* in the given *path*.

    **bare** indicates whether a bare git repository should be created.

    **remote_name** is the name given to the "origin" remote.
    The default is "origin".

    **push_url** is a URL to be used for pushing.
    None means use the *url* parameter.

    **fetch_spec** defines the the default fetch spec.
    None results in the same behavior as *GIT_REMOTE_DEFAULT_FETCH*.

    **push_spec** is the fetch specification to be used for pushing.
    None means use the same spec as for *fetch_spec*.

    **checkout_branch** gives the name of the branch to checkout.
    None means use the remote's *HEAD*.

    Returns a Repository class pointing to the newly cloned repository.

    If you wish to use the repo, you need to do a checkout for one of
    the available branches, like this:

        >>> repo = repo.clone_repository("url", "path")
        >>> repo.checkout(branch)  # i.e.: refs/heads/master

    """

    _pygit2.clone_repository(
        url, path, bare, remote_name, push_url,
        fetch_spec, push_spec, checkout_branch)
    return Repository(path)