upgrade-zulip: The "git rev-parse" command can parse "git describe" output directly.

This commit is contained in:
Alex Vandiver 2023-06-14 18:34:35 +00:00 committed by Tim Abbott
parent a9bc5e94e7
commit 1276653ec8
1 changed files with 1 additions and 5 deletions

View File

@ -495,12 +495,8 @@ def run_hooks(kind: Literal["pre-deploy", "post-deploy"]) -> None:
env["HOME"] = get_zulip_pwent().pw_dir env["HOME"] = get_zulip_pwent().pw_dir
def resolve_version_string(version: str) -> str: def resolve_version_string(version: str) -> str:
matches = re.search(r"-\d+-g([a-f0-9]{7,})$", version)
to_parse = version
if matches is not None:
to_parse = matches.group(1)
return subprocess.check_output( return subprocess.check_output(
["git", "rev-parse", to_parse], cwd=deploy_path, preexec_fn=su_to_zulip, text=True ["git", "rev-parse", version], cwd=deploy_path, preexec_fn=su_to_zulip, text=True
).strip() ).strip()
if args.from_git: if args.from_git: