remove git_dev checks

This commit is contained in:
Riley Housden 2022-08-20 01:04:19 -04:00
parent 33a1103f94
commit f8a064565a
Signed by: InValidFire
GPG key ID: 0D6208F6DF56B4D8

View file

@ -50,22 +50,6 @@ async def get_git_commits_ahead_behind(branch: str, remote: str) -> tuple[int, i
return commits_ahead, commits_behind return commits_ahead, commits_behind
async def get_git_dev(remote: str, branch: str) -> bool:
# dev environment tests
# difference between HEAD and remote
if await get_git_head_diff_branch(remote) != "":
return True
elif config.git_branch != branch: # branch has been changed
return True
# difference between index and remote
elif await get_git_index_diff_branch(remote) != "":
return True
# ahead in commits
elif (await get_git_commits_ahead_behind(branch, remote))[0] > 0:
return True
return False
async def get_git_update(dev_status: bool, branch, remote) -> bool: async def get_git_update(dev_status: bool, branch, remote) -> bool:
commits_behind, _ = await get_git_commits_ahead_behind(branch, remote) commits_behind, _ = await get_git_commits_ahead_behind(branch, remote)
if not dev_status and commits_behind > 0: if not dev_status and commits_behind > 0:
@ -78,7 +62,6 @@ async def get_git_status() -> dict:
output["commit_id"] = await get_git_latest_commit_id() output["commit_id"] = await get_git_latest_commit_id()
output["branch"] = await get_git_branch() output["branch"] = await get_git_branch()
output["remote"] = await get_git_remote() output["remote"] = await get_git_remote()
output["dev"] = await get_git_dev(output['remote'], output['branch'])
output['update'] = await get_git_update(output['dev'], output['branch'], output['remote']) output['update'] = await get_git_update(output['dev'], output['branch'], output['remote'])
return output return output
@ -98,7 +81,6 @@ async def ping(ctx: lightbulb.Context) -> None:
@lightbulb.command("update", "update the bot!", ephemeral=True) @lightbulb.command("update", "update the bot!", ephemeral=True)
@lightbulb.implements(lightbulb.SlashCommand) @lightbulb.implements(lightbulb.SlashCommand)
async def update(ctx: lightbulb.Context) -> None: async def update(ctx: lightbulb.Context) -> None:
if (await get_git_status())['dev'] is False:
await create_subprocess("git", "pull") await create_subprocess("git", "pull")
embed = hikari.Embed(title="Restarting", embed = hikari.Embed(title="Restarting",
description="Restarting to load an update!" description="Restarting to load an update!"