vcs Package

vcs Package

Roles in this namespace relate to Version Control Systems support in Debian distributions, such as git, svn or mercurial.

git Module

Roles in this namespace are meant to provide Git repository creation operations within Debian distributions.

class provy.more.debian.vcs.git.GitRole(prov, context)[source]

Bases: provy.core.roles.Role

This role provides utility methods for Git repositories management within Debian distributions.

Example:

from provy.core import Role
from provy.more.debian import GitRole

class MySampleRole(Role):
    def provision(self):
        with self.using(GitRole) as role:
            role.ensure_repository('git://github.com/python-provy/provy.git', '/home/user/provy',
                                   owner='user', branch='some-branch')
ensure_repository(repo, path, owner=None, branch=None, sudo=True)[source]

Makes sure the repository is create in the remote server. This method does not update the repository or perform any operations in it. It is merely used to ensure that the repository exists in the specified path.

Parameters:
  • repo (str) – Git repository url.
  • path (str) – Path to create the local repository.
  • owner (str) – User that owns the repository directory. Defaults to None, using the current one in the remote server.
  • branch (str) – If specified, the given branch will be checked-out, otherwise it stays in the master branch.
  • sudo (bool) – If False, won’t sudo when creating the repository. Defaults to True.

Example:

from provy.core import Role
from provy.more.debian import GitRole

class MySampleRole(Role):
    def provision(self):
        with self.using(GitRole) as role:
            role.ensure_repository('git://github.com/python-provy/provy.git', '/home/user/provy',
                                   owner='user', branch='some-branch')
provision()[source]

Installs Git dependencies. This method should be called upon if overriden in base classes, or Git won’t work properly in the remote server.

Example:

class MySampleRole(Role):
    def provision(self):
        self.provision_role(GitRole) # does not need to be called if using with block.