reuse.vcs module - reuse 6.1.2 documentation

Skip to content
Back to top
View this page

# reuse.vcs module

This module deals with version control systems.

class reuse.vcs.VCSStrategy(root: str | PathLike[str])

  Bases: `ABC`

  Strategy pattern for version control systems.

  EXE: str | None = None
  abstract is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  abstract is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  abstract classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  abstract classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

class reuse.vcs.VCSStrategyNone(root: str | PathLike[str])

  Bases: `VCSStrategy`

  Strategy that is used when there is no VCS.

  is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

class reuse.vcs.VCSStrategyGit(root: str | PathLike[str])

  Bases: `VCSStrategy`

  Strategy that is used for Git.

  EXE: str | None = '/usr/bin/git'
  is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

class reuse.vcs.VCSStrategyHg(root: str | PathLike[str])

  Bases: `VCSStrategy`

  Strategy that is used for Mercurial.

  EXE: str | None = '/usr/bin/hg'
  is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

class reuse.vcs.VCSStrategyJujutsu(root: str | PathLike[str])

  Bases: `VCSStrategy`

  Strategy that is used for Jujutsu.

  EXE: str | None = None
  is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

class reuse.vcs.VCSStrategyPijul(root: str | PathLike[str])

  Bases: `VCSStrategy`

  Strategy that is used for Pijul.

  EXE: str | None = None
  is_ignored(path: Path) → bool

    Is path ignored by the VCS?

  is_submodule(path: str | PathLike[str]) → bool

    Is path a VCS submodule?

  classmethod in_repo(directory: str | PathLike[str]) → bool

    Is directory inside of the VCS repository?

    Raises:

      NotADirectoryError – if directory is not a directory.

  classmethod find_root(cwd: str | PathLike[str] | None = None) → Path | None

    Try to find the root of the project from cwd. If none is found, return None.

    Raises:

      NotADirectoryError – if directory is not a directory.

reuse.vcs.all_vcs_strategies() → Generator[type[VCSStrategy]]

  Yield all VCSStrategy classes that aren’t the abstract base class.

reuse.vcs.find_root(cwd: str | PathLike[str] | None = None) → Path | None

  Try to find the root of the project from cwd. If none is found, return None.

  Raises:

    NotADirectoryError – if directory is not a directory.