git_deploy: remove untracked file warnings
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
fe52bc5b6d
commit
871c551134
|
@ -686,10 +686,9 @@ class GitRepo:
|
||||||
return not (await self.is_ancestor("HEAD", descendent))
|
return not (await self.is_ancestor("HEAD", descendent))
|
||||||
|
|
||||||
def log_repo_info(self) -> None:
|
def log_repo_info(self) -> None:
|
||||||
warnings = ""
|
warnings = self._generate_warn_msg()
|
||||||
if self.repo_warnings:
|
if warnings:
|
||||||
warnings = "\nRepo Warnings:\n"
|
warnings = "\nRepo Warnings:\n" + warnings
|
||||||
warnings += '\n'.join([f" {warn}" for warn in self.repo_warnings])
|
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Git Repo {self.alias} Detected:\n"
|
f"Git Repo {self.alias} Detected:\n"
|
||||||
f"Owner: {self.git_owner}\n"
|
f"Owner: {self.git_owner}\n"
|
||||||
|
@ -715,10 +714,10 @@ class GitRepo:
|
||||||
)
|
)
|
||||||
|
|
||||||
def _check_warnings(self) -> None:
|
def _check_warnings(self) -> None:
|
||||||
|
self.repo_warnings.clear()
|
||||||
if self.upstream_url == "?":
|
if self.upstream_url == "?":
|
||||||
self.repo_warnings.append("Failed to detect repo url")
|
self.repo_warnings.append("Failed to detect repo url")
|
||||||
return
|
return
|
||||||
self.repo_warnings.clear()
|
|
||||||
upstream_url = self.upstream_url.lower()
|
upstream_url = self.upstream_url.lower()
|
||||||
if upstream_url[-4:] != ".git":
|
if upstream_url[-4:] != ".git":
|
||||||
upstream_url += ".git"
|
upstream_url += ".git"
|
||||||
|
@ -738,21 +737,30 @@ class GitRepo:
|
||||||
"Repo is dirty. Detected the following modifed files: "
|
"Repo is dirty. Detected the following modifed files: "
|
||||||
f"{self.modified_files}"
|
f"{self.modified_files}"
|
||||||
)
|
)
|
||||||
if self.untracked_files:
|
|
||||||
self.repo_warnings.append(
|
|
||||||
f"Repo has untracked source files: {self.untracked_files}"
|
|
||||||
)
|
|
||||||
if len(self.managing_instances) > 1:
|
if len(self.managing_instances) > 1:
|
||||||
instances = "\n".join([f" {ins}" for ins in self.managing_instances])
|
instances = "\n".join([f" {ins}" for ins in self.managing_instances])
|
||||||
self.repo_warnings.append(
|
self.repo_warnings.append(
|
||||||
f"Multiple instances of Moonraker managing this repo:\n"
|
f"Multiple instances of Moonraker managing this repo:\n"
|
||||||
f"{instances}"
|
f"{instances}"
|
||||||
)
|
)
|
||||||
|
self._generate_warn_msg()
|
||||||
|
|
||||||
|
def _generate_warn_msg(self) -> str:
|
||||||
|
extra_warnings = []
|
||||||
|
if self.untracked_files:
|
||||||
|
extra_warnings.append(
|
||||||
|
f"Repo has untracked source files: {self.untracked_files}"
|
||||||
|
)
|
||||||
ro_msg = f"Git Repo {self.alias}: No warnings detected"
|
ro_msg = f"Git Repo {self.alias}: No warnings detected"
|
||||||
if self.repo_warnings:
|
warn_msg = ""
|
||||||
ro_msg = f"Git Repo {self.alias} Warnings Detected:\n"
|
if self.repo_warnings or extra_warnings:
|
||||||
ro_msg += "\n".join(self.repo_warnings)
|
ro_msg = f"Git Repo {self.alias}: Warnings detected:\n"
|
||||||
|
warn_msg = "\n".join(
|
||||||
|
[f" {warn}" for warn in self.repo_warnings + extra_warnings]
|
||||||
|
)
|
||||||
|
ro_msg += warn_msg
|
||||||
self.server.add_log_rollover_item(f"umgr_{self.alias}_warn", ro_msg, log=False)
|
self.server.add_log_rollover_item(f"umgr_{self.alias}_warn", ro_msg, log=False)
|
||||||
|
return warn_msg
|
||||||
|
|
||||||
def _verify_repo(self, check_remote: bool = False) -> None:
|
def _verify_repo(self, check_remote: bool = False) -> None:
|
||||||
if not self.valid_git_repo:
|
if not self.valid_git_repo:
|
||||||
|
|
Loading…
Reference in New Issue