Merge pull request #935 from frappe/mergify/bp/main/pr-930
fix: git command error (backport #930)
This commit is contained in:
commit
2e1da1a627
@ -45,7 +45,6 @@ def get_boot():
|
|||||||
"user": frappe.db.get_value("User", frappe.session.user, "time_zone")
|
"user": frappe.db.get_value("User", frappe.session.user, "time_zone")
|
||||||
or get_system_timezone(),
|
or get_system_timezone(),
|
||||||
},
|
},
|
||||||
"app_version": get_app_version(),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,25 +53,6 @@ def get_default_route():
|
|||||||
return "/crm"
|
return "/crm"
|
||||||
|
|
||||||
|
|
||||||
def get_app_version():
|
|
||||||
app = "crm"
|
|
||||||
branch = run_git_command(f"cd ../apps/{app} && git rev-parse --abbrev-ref HEAD")
|
|
||||||
commit = run_git_command(f"git -C ../apps/{app} rev-parse --short=7 HEAD")
|
|
||||||
tag = run_git_command(f"git -C ../apps/{app} describe --tags --abbrev=0")
|
|
||||||
dirty = run_git_command(f"git -C ../apps/{app} diff --quiet || echo 'dirty'") == "dirty"
|
|
||||||
commit_date = run_git_command(f"git -C ../apps/{app} log -1 --format=%cd")
|
|
||||||
commit_message = run_git_command(f"git -C ../apps/{app} log -1 --pretty=%B")
|
|
||||||
|
|
||||||
return {
|
|
||||||
"branch": branch,
|
|
||||||
"commit": commit,
|
|
||||||
"commit_date": commit_date,
|
|
||||||
"commit_message": commit_message,
|
|
||||||
"tag": tag,
|
|
||||||
"dirty": dirty,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def run_git_command(command):
|
def run_git_command(command):
|
||||||
try:
|
try:
|
||||||
with open(os.devnull, "wb") as null_stream:
|
with open(os.devnull, "wb") as null_stream:
|
||||||
|
|||||||
@ -6,22 +6,6 @@
|
|||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<CRMLogo class="mb-3 size-12" />
|
<CRMLogo class="mb-3 size-12" />
|
||||||
<h3 class="font-semibold text-xl text-ink-gray-9">Frappe CRM</h3>
|
<h3 class="font-semibold text-xl text-ink-gray-9">Frappe CRM</h3>
|
||||||
<div class="flex items-center mt-1">
|
|
||||||
<div class="text-base text-ink-gray-6">
|
|
||||||
{{ appVersion.branch != 'main' ? appVersion.branch : '' }}
|
|
||||||
<template v-if="appVersion.branch != 'main'">
|
|
||||||
({{ appVersion.commit }})
|
|
||||||
</template>
|
|
||||||
<template v-else>{{ appVersion.tag }}</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Tooltip
|
|
||||||
:text="`${appVersion.commit_message} - ${appVersion.commit_date}`"
|
|
||||||
placement="top"
|
|
||||||
>
|
|
||||||
<LucideInfo class="size-3.5 text-ink-gray-8 ml-1" />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="border-t my-3 mx-2" />
|
<hr class="border-t my-3 mx-2" />
|
||||||
@ -95,6 +79,4 @@ let links = [
|
|||||||
icon: LucideHeadset,
|
icon: LucideHeadset,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
let appVersion = window.app_version
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user