phystool.physgit

Module Contents

Classes

GitFile

GitPDBFile

GitTexFile

PhysGit

Functions

run_git_in_terminal

setup_git_repository

Initialize the local git repository and link it to its remote.

Data

logger

API

phystool.physgit.logger

“getLogger(…)”

exception phystool.physgit.PhysGitError(msg: str)

Bases: Exception

class phystool.physgit.GitFile(status: Status, path: pathlib.Path)

Bases: abc.ABC

SUFFIXES: tuple[str, str]

None

SEARCH_DIR: pathlib.Path

None

class Status(*args, **kwds)

Bases: enum.Enum

NEW

“??”

MODIFIED

“M”

REMOVED

“R”

classmethod is_tracked(path: pathlib.Path)
abstract add(path: pathlib.Path) None
message() str
get_files() list[str]
get_diff() str
display_diff() None
class phystool.physgit.GitPDBFile(status: Status, path: pathlib.Path)

Bases: phystool.physgit.GitFile

SUFFIXES

(“.tex”, “.json”)

SEARCH_DIR

None

add(path: pathlib.Path) None
class phystool.physgit.GitTexFile(status: Status, path: pathlib.Path)

Bases: phystool.physgit.GitFile

SUFFIXES

(“.sty”, “.cls”)

SEARCH_DIR

None

add(path: pathlib.Path) None
class phystool.physgit.PhysGit

Initialization

Helper class to manage PDBFile stored in config.DB_DIR. If the directory is not a valid git repository it raises InvalidGitRepositoryError.

Takes a set of .tex/.json paths as input and returns the number of checked files with a list containing information about those files. That list contains the list of modified files (.tex and/or .json) for each selected pdb_file.

To have a nicer git diff experience, this helper class uses bat and delta (named git-delta in debian package manager).

interactive_staging() None
stage(uuid: str) None
commit(for_terminal: bool) str
get_diff(uuid: str) str
get_remote_url() str
phystool.physgit.run_git_in_terminal()
phystool.physgit.setup_git_repository(remote_url: str) None

Initialize the local git repository and link it to its remote.

Remote_url:

url of an empty remote repository