fabtools.git¶
Git¶
This module provides low-level tools for managing Git repositories. You
should normally not use them directly but rather use the high-level wrapper
fabtools.require.git.working_copy() instead.
See also
-
fabtools.git.clone(remote_url, path=None, use_sudo=False, user=None)[source]¶ Clone a remote Git repository into a new directory.
Parameters: - remote_url (str) – URL of the remote repository to clone.
- path (str) – Path of the working copy directory. Must not exist yet.
- use_sudo (bool) – If
Trueexecutegitwithfabric.operations.sudo(), else withfabric.operations.run(). - user (str) – If
use_sudo is True, runfabric.operations.sudo()with the given user. Ifuse_sudo is Falsethis parameter has no effect.
-
fabtools.git.add_remote(path, name, remote_url, use_sudo=False, user=None, fetch=True)[source]¶ Add a remote Git repository into a directory.
Parameters: - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to fetch from.
- use_sudo (bool) – If
Trueexecutegitwithfabric.operations.sudo(), else withfabric.operations.run(). - user (str) – If
use_sudo is True, runfabric.operations.sudo()with the given user. Ifuse_sudo is Falsethis parameter has no effect. - name (str) – name for the remote repository
- remote_url (str) – URL of the remote repository
- fetch (bool) – If
Trueexecutegit remote add -f
-
fabtools.git.fetch(path, use_sudo=False, user=None, remote=None)[source]¶ Fetch changes from the default remote repository.
This will fetch new changesets, but will not update the contents of the working tree unless yo do a merge or rebase.
Parameters: - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to fetch from.
- use_sudo (bool) – If
Trueexecutegitwithfabric.operations.sudo(), else withfabric.operations.run(). - user (str) – If
use_sudo is True, runfabric.operations.sudo()with the given user. Ifuse_sudo is Falsethis parameter has no effect.
-
fabtools.git.pull(path, use_sudo=False, user=None, force=False)[source]¶ Fetch changes from the default remote repository and merge them.
Parameters: - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy with a default remote to pull from.
- use_sudo (bool) – If
Trueexecutegitwithfabric.operations.sudo(), else withfabric.operations.run(). - user (str) – If
use_sudo is True, runfabric.operations.sudo()with the given user. Ifuse_sudo is Falsethis parameter has no effect. - force (bool) – If
True, append the--forceoption to the command.
-
fabtools.git.checkout(path, branch='master', use_sudo=False, user=None, force=False)[source]¶ Checkout a branch to the working directory.
Parameters: - path (str) – Path of the working copy directory. This directory must exist and be a Git working copy.
- branch (str) – Name of the branch to checkout.
- use_sudo (bool) – If
Trueexecutegitwithfabric.operations.sudo(), else withfabric.operations.run(). - user (str) – If
use_sudo is True, runfabric.operations.sudo()with the given user. Ifuse_sudo is Falsethis parameter has no effect. - force (bool) – If
True, append the--forceoption to the command.