ctl.plugins.repository

Plugin interface for plugins that manage software repositories

Classes


PluginConfig

PluginConfig(confu.schema.core.Schema)

Configuration schema for RepositoryPlugin

Class Attributes

  • branch (Str): Checkout this branch
  • checkout_path (Directory): checkout to this local location - if not specified will default to ~/.ctl/cache/{repo_url}
  • repo_url (Str):

RepositoryPlugin

RepositoryPlugin(ctl.plugins.ExecutablePlugin)

Interface for repository type plugins

Class Attributes

  • ConfigSchema (ConfigSchema Class): Base plugin config schema

Instanced Attributes

These attributes / properties will be available on instances of the class

  • branch (@property): Should return the name of the current branch
  • is_clean (@property): Should perform a clean check (eg. git status --porcelain) and return True if clean, False if not
  • is_cloned (@property): should return True or False depending on whether the repository is already cloned at checkout_path or not
  • repo_ctl_dir (@property): location of ctl directory inside repository
  • uuid (@property): should return current commit hash/id
  • version (@property): current version as it exists in version_file
  • version_file (@property): location of version file

Methods

__repr__

def __repr__(self)

Return repr(self).


branch_exists

def branch_exists(self, name)

Should return True if the branch with the name exists in the local repository, False otherwise


checkout

def checkout(self, branch, **kwargs)

Should checkout a branch by name


clone

def clone(self, **kwargs)

Should clone the repository according to config parameters repo_url and checkout_path


commit

def commit(self, **kwargs)

Should commit changes

Keyword arguments

  • files (list): list of files to commit, should be filenames relative to the repo root
  • message (str): commit message
  • push (bool=True): push immediately

init

def init(self)

called after the plugin is initialized, plugin may define this for any other initialization code


merge

def merge(self, branch_a, branch_b, **kwargs)

Should merge branch b into branch a


pull

def pull(self, **kwargs)

Should pull the repository


push

def push(self, **kwargs)

Should push changes to the remote


tag

def tag(self, version, **kwargs)

Should tag the current branch