Documentation for the new clone method.
Even though I am aware that the comment lines in pygit2/__init__.py are longer than 79 characters, there's a reason for that. If I break them, they'll show poorly in the documentation, and in my opinion better docs trump the 80 char requirement. If you think it's still better to have less than 80 characters in the comments, I'll gladly resubmit the changes at the expense of the documentation.
This commit is contained in:
@@ -20,6 +20,17 @@ Functions
|
|||||||
>>> repo = init_repository('test') # Creates a non-bare repository
|
>>> repo = init_repository('test') # Creates a non-bare repository
|
||||||
>>> repo = init_repository('test', bare=True) # Creates a bare repository
|
>>> repo = init_repository('test', bare=True) # Creates a bare repository
|
||||||
|
|
||||||
|
.. autofunction:: pygit2.clone_repository
|
||||||
|
|
||||||
|
Example::
|
||||||
|
|
||||||
|
>>> from pygit2 import clone_repository
|
||||||
|
>>> repo_url = 'git://github.com/libgit2/pygit2.git'
|
||||||
|
>>> repo_path = '/path/to/create/repository'
|
||||||
|
>>> repo = clone_repository(repo_url, repo_path) # Clones a non-bare repository
|
||||||
|
>>> repo = clone_repository(repo_url, repo_path, bare=True) # Clones a bare repository
|
||||||
|
|
||||||
|
|
||||||
.. autofunction:: pygit2.discover_repository
|
.. autofunction:: pygit2.discover_repository
|
||||||
|
|
||||||
|
|
||||||
|
@@ -56,18 +56,20 @@ def clone_repository(
|
|||||||
"""
|
"""
|
||||||
Clones a new Git repository from *url* in the given *path*.
|
Clones a new Git repository from *url* in the given *path*.
|
||||||
|
|
||||||
Parameters:
|
* **bare** indicates whether a bare git repository should be created.
|
||||||
* 'bare' indicates whether a bare git repository should be created.
|
* **remote_name** is the name given to the "origin" remote. The default is "origin".
|
||||||
* 'remote_name' is the name given to the "origin" remote.
|
* **push_url** is a URL to be used for pushing. None means use the *url* parameter.
|
||||||
The default is "origin".
|
* **fetch_spec** defines the the default fetch spec. None results in the same behavior as *GIT_REMOTE_DEFAULT_FETCH*.
|
||||||
* 'push_url' is a URL to be used for pushing.
|
* **push_spec** is the fetch specification to be used for pushing. None means use the same spec as for *fetch_spec*.
|
||||||
None means use the fetch url.
|
* **checkout_branch** gives the name of the branch to checkout. None means use the remote's *HEAD*.
|
||||||
* 'fetch_spec' is the fetch specification to be used for fetching.
|
|
||||||
None results in the same behavior as GIT_REMOTE_DEFAULT_FETCH.
|
Returns a Repository class pointing to the newly cloned repository.
|
||||||
* 'push_spec' is the fetch specification to be used for pushing.
|
|
||||||
None means use the same spec as for 'fetch_spec'.
|
If you wish to use the repo, you need to do a checkout for one of the available branches, like this:
|
||||||
* 'checkout_branch' gives the name of the branch to checkout.
|
|
||||||
None means use the remote's HEAD
|
>>> repo = repo.clone_repository("url", "path")
|
||||||
|
>>> repo.checkout(branch) # i.e.: refs/heads/master
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_pygit2.clone_repository(
|
_pygit2.clone_repository(
|
||||||
|
Reference in New Issue
Block a user