projects ¤
Git utilities.
Classes:
Project dataclass
¤
Project(
LOCKS: dict[Project, Lock] = defaultdict(Lock),
DEFAULT_BRANCHES: tuple[str, ...] = ("main", "master"),
path: Path,
)
A class representing development projects.
It is instantiated with a path, and then provides many utility properties and methods.
Methods:
-
checkout
–Checkout branch, restore previous one when exiting.
-
delete
–Delete branch.
-
fetch
–Fetch.
-
lock
–Lock project.
-
pull
–Pull branch.
-
push
–Push branch.
-
unlock
–Unlock project.
-
unpulled
–Number of unpulled commits, per branch.
-
unpushed
–Number of unpushed commits, per branch.
-
unreleased
–List unreleased commits.
Attributes:
-
DEFAULT_BRANCHES
(tuple[str, ...]
) –Name of common default branches. Mainly useful to compute unreleased commits.
-
branch
(Head
) –Currently checked out branch.
-
default_branch
(str
) –Default branch (or main branch), as checked out when cloning.
-
is_dirty
(bool
) –Whether the project is in a "dirty" state (uncommitted modifications).
-
latest_tag
(TagReference
) –Latest tag.
-
name
(str
) –Name of the project.
-
path
(Path
) –Path of the project on the file-system.
-
repo
(Repo
) –GitPython's
Repo
object. -
status
(Status
) –Status of the project.
-
status_line
(str
) –Status of the project, as a string.
DEFAULT_BRANCHES class-attribute
¤
Name of common default branches. Mainly useful to compute unreleased commits.
default_branch property
¤
default_branch: str
Default branch (or main branch), as checked out when cloning.
is_dirty property
¤
is_dirty: bool
Whether the project is in a "dirty" state (uncommitted modifications).
checkout ¤
Checkout branch, restore previous one when exiting.
unpulled ¤
Number of unpulled commits, per branch.
unpushed ¤
Number of unpushed commits, per branch.
Status dataclass
¤
Status(
added: list[Path],
deleted: list[Path],
modified: list[Path],
renamed: list[Path],
typechanged: list[Path],
untracked: list[Path],
)