_docsweeper.version_control#

Module for version control functions.

class _docsweeper.version_control.VCSCommandSetConfig#

Bases: NamedTuple

Configuration values for VCSCommandSet.

Holds configuration values that are customizable by clients.

Note

This class is exported publicly as docsweeper.VCSCommandSetConfig.

executable: Optional[Path]#

The path of the executable of the version used.

follow_rename: Optional[bool]#

Whether the version control system shall follow renamed files.

is_complete()#

Return whether all entries of this config have a value.

Return type:

bool

merge(other)#

Return a new config with merged values of this config and other.

Parameters:

other (VCSCommandSetConfig) – entries that are not None in this config are merged into the new one

Returns:

the merged config

Return type:

VCSCommandSetConfig

class _docsweeper.version_control.FileRenamedError#

Bases: ValueError

Raised when a file was unexpectedly detected to have been renamed.

class _docsweeper.version_control.VCSCommandSet#

Bases: ABC

Encapsulates all commands needed for a complete version control command set.

Note

This class is exported publicly as docsweeper.VCSCommandSet.

class _docsweeper.version_control.GitCommandSet#

Bases: VCSCommandSet

An implementation of a version control command set for git.

Note

This class is exported publicly as docsweeper.GitCommandSet.

class _docsweeper.version_control.MercurialCommandSet#

Bases: VCSCommandSet

An implementation of a version control command set for mercurial.

Note

This class is exported publicly as docsweeper.MercurialCommandSet.

class _docsweeper.version_control.VCSShim#

Bases: object

A shim between the output of a version control command set and clients.

Encapsulates the low-level commands of a VCSCommandSet into a more user-friendly interface.

_docsweeper.version_control.command_sets: Dict[str, Tuple[Type[VCSCommandSet], VCSCommandSetConfig]] = {'git': (<class '_docsweeper.version_control.GitCommandSet'>, VCSCommandSetConfig(executable=PosixPath('/usr/bin/git'), follow_rename=True)), 'hg': (<class '_docsweeper.version_control.MercurialCommandSet'>, VCSCommandSetConfig(executable=PosixPath('/usr/bin/hg'), follow_rename=True))}#

Dictionary of all supported command sets and their default configuration.

Note

This object is exported publicly as docsweeper.command_sets.

class _docsweeper.version_control.VCSExecutableError#

Bases: Exception

Raised when there is an issue with the chosen version control executable.

For example, if the executable does not exist or is otherwise not executable.

__init__(vcs, executable)#

Raise an exception with executable for version control system vcs.

Parameters:
  • vcs (str) –

  • executable (str) –

Return type:

None