fabtools.require.git
¶
Git¶
This module provides high-level tools for managing Git repositories.
See also
-
fabtools.require.git.
command
()[source]¶ Require the git command-line tool.
Example:
from fabric.api import run from fabtools import require require.git.command() run('git --help')
-
fabtools.require.git.
working_copy
(remote_url, path=None, branch='master', update=True, use_sudo=False, user=None)[source]¶ Require a working copy of the repository from the
remote_url
.The
path
is optional, and defaults to the last segment of the remote repository URL, without its.git
suffix.If the
path
does not exist, this will clone the remote repository and check out the specified branch.If the
path
exists andupdate
isTrue
, it will fetch changes from the remote repository, check out the specified branch, then merge the remote changes into the working copy.If the
path
exists andupdate
isFalse
, it will only check out the specified branch, without fetching remote changesets.Parameters: - remote_url (str) – URL of the remote repository (e.g.
https://github.com/ronnix/fabtools.git). The given URL
will be the
origin
remote of the working copy. - path (str) – Absolute or relative path of the working copy on the
filesystem. If this directory doesn’t exist yet, a new
working copy is created through
git clone
. If the directory does exist andupdate == True
, agit fetch
is issued. Ifpath is None
thegit clone
is issued in the current working directory and the directory name of the working copy is created bygit
. - branch (str) – Branch or tag to check out. If the given value is a tag
name, update must be
False
or consecutive calls will fail. - update (bool) – Whether or not to fetch and merge remote changesets.
- use_sudo (bool) – If
True
executegit
withfabric.operations.sudo()
, else withfabric.operations.run()
. - user (str) – If
use_sudo is True
, runfabric.operations.sudo()
with the given user. Ifuse_sudo is False
this parameter has no effect.
- remote_url (str) – URL of the remote repository (e.g.
https://github.com/ronnix/fabtools.git). The given URL
will be the