From 78d7767a856961a12cd895e5b77c9f0fc44e20e3 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Tue, 7 May 2024 09:55:47 +0000 Subject: [PATCH] fix: handle unexpected hg repo when parse scm version --- src/pdm/backend/hooks/version/scm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pdm/backend/hooks/version/scm.py b/src/pdm/backend/hooks/version/scm.py index 831604e..d8e71bb 100644 --- a/src/pdm/backend/hooks/version/scm.py +++ b/src/pdm/backend/hooks/version/scm.py @@ -287,7 +287,10 @@ def hg_parse_version(root: StrPath, config: Config) -> SCMVersion | None: root, ) tag: str | None - tag, node, branch = output.rsplit("-", 2) + try: + tag, node, branch = output.rsplit("-", 2) + except ValueError: + return None # unpacking failed, unexpected hg repo # If no tag exists passes the tag filter. if tag == "null": tag = None