phystool.physgit

Module Contents

Classes

GitFile

GitPDBFile

GitTexFile

GitExtraFile

PhysGit

Functions

run_git_in_terminal

is_valid_git_remote

setup_git_repository

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

clone_git_repository

Data

logger

API

phystool.physgit.logger

“getLogger(…)”

exception phystool.physgit.PhysGitError

Bases: Exception

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

Bases: abc.ABC

SUFFIXES: tuple[str, str]

None

IN_DIR: pathlib.Path

None

class Status

Bases: enum.StrEnum

MODIFIED

“M”

MODIFIED_SUBMODULE

“m”

ADDED

“A”

DELETED

“D”

RENAMED

“R”

COPIED

“C”

UNTRACKED

“??”

IGNORED

“!!”

classmethod create(status: Status, path: pathlib.Path) phystool.physgit.GitFile
abstractmethod 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”)

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

Bases: phystool.physgit.GitFile

SUFFIXES

(“.sty”, “.cls”)

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

Bases: phystool.physgit.GitFile

SUFFIXES

(“.conf”, “”)

FILES

[“0_physdb.conf”, “.gitignore”]

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.

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(git_pdb_file: phystool.physgit.GitFile) None
commit(for_terminal: bool) str
get_remote_url() str
phystool.physgit.run_git_in_terminal() None
phystool.physgit.is_valid_git_remote(remote_url: str) bool
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

phystool.physgit.clone_git_repository(remote_url: str, to_path: pathlib.Path)