rituals.util.scm package

rituals.util.scm – Source Code Management support.

rituals.util.scm.auto_detect(workdir)[source]

Return string signifying the SCM used in the given directory.

Currently, ‘git’ is supported. Anything else returns ‘unknown’.

rituals.util.scm.provider(workdir, commit=True, **kwargs)[source]

Factory for the correct SCM provider in workdir.

Submodules

rituals.util.scm.base module

Provider base class.

class rituals.util.scm.base.ProviderBase(workdir, commit=True, **kwargs)[source]

Bases: object

Base class for SCM providers.

run(cmd, *args, **kwargs)[source]

Run a command.

run_elective(cmd, *args, **kwargs)[source]

Run a command, or just echo it, depending on commit.

rituals.util.scm.git module

git SCM provider.

class rituals.util.scm.git.GitProvider(workdir, commit=True, **kwargs)[source]

Bases: rituals.util.scm.base.ProviderBase

git SCM provider.

Expects a working git executable in the path, having a reasonably current version.

add_file(filename)[source]

Stage a file for committing.

commit(message)[source]

Commit pending changes.

key = u'git'
pep440_dev_version(verbose=False, non_local=False)[source]

Return a PEP-440 dev version appendix to the main version number.

Result is None if the workdir is in a release-ready state (i.e. clean and properly tagged).

tag(label, message=None)[source]

Tag the current workdir state.

workdir_is_clean(quiet=False)[source]

Check for uncommitted changes, return True if everything is clean.

Inspired by http://stackoverflow.com/questions/3878624/.

rituals.util.scm.null module

Provider for unknown SCM systems.

class rituals.util.scm.null.NullProvider(workdir, commit=True, **kwargs)[source]

Bases: rituals.util.scm.base.ProviderBase

Stub provider for unknown SCM systems.

This implements the provider interface, mostly emitting warnings.

add_file(filename)[source]

Stage a file for committing, or commit it directly (depending on the SCM).

commit(message)[source]

Commit pending changes.

key = u'unknown'
pep440_dev_version(verbose=False, non_local=False)[source]

Return a PEP-440 dev version appendix to the main version number.

tag(label, message=None)[source]

Tag the current workdir state.

workdir_is_clean(quiet=False)[source]

Check for uncommitted changes, return True if everything is clean.