def __has_worktree(self, path: str) -> bool: list_worktrees: str = run_git_command(path, ["worktree", "list"]) worktrees_lst: List[str] = list_worktrees.split("\n") worktrees_lst = list(filter(None, worktrees_lst)) if len(worktrees_lst) > 1: return True return False
def __get_num_stash(self, path) -> str: cmd = run_git_command( path, ["rev-list", "--walk-reflogs", "--count", "refs/stash"] ) out = cmd.replace("\n", "") return out
def __do_git_fetch(self, path) -> bool: repo_name = os.path.basename(path) print(f"Fetching from remote \"{repo_name}\"") run_git_command(path, ["fetch"]) return True
def __is_git_repository(self, path: str) -> bool: cmd = run_git_command(path, ["rev-parse", "--show-toplevel"]) cmd = "".join(cmd.split()) base_cmd = os.path.basename(cmd) base_path = os.path.basename(path) return bool(True if base_cmd == base_path else False)
def __get_details_text(cls) -> str: cmd = run_git_command(cls.path, ["status", "-sb"]) return cmd
def __current_branch_name(self, path: str) -> str: cmd = run_git_command(path, ["symbolic-ref", "--short", "HEAD"]) out = cmd.replace("\n", "") return out