feat: +software develop tool lib

This commit is contained in:
莘权 马 2024-03-19 23:03:17 +08:00
parent a221d1c418
commit 155a5a8c65
6 changed files with 304 additions and 11 deletions

View file

@ -52,7 +52,7 @@ class GitRepository:
self._dependency = None
self._gitignore_rules = None
if local_path:
self.open(local_path=local_path, auto_init=auto_init)
self.open(local_path=Path(local_path), auto_init=auto_init)
def open(self, local_path: Path, auto_init=False):
"""Open an existing Git repository or initialize a new one if auto_init is True.
@ -68,7 +68,7 @@ class GitRepository:
if not auto_init:
return
local_path.mkdir(parents=True, exist_ok=True)
return self._init(local_path)
self._init(local_path)
def _init(self, local_path: Path):
"""Initialize a new Git repository at the specified path.
@ -283,3 +283,7 @@ class GitRepository:
continue
files.append(filename)
return files
def log(self) -> str:
"""Return git log"""
return self._repository.git.log()