Skip to content

Commit d6feccf

Browse files
authored
fix: handle unexpected hg repo when parse scm version (#237)
1 parent 9915cb6 commit d6feccf

File tree

1 file changed

+4
-1
lines changed
  • src/pdm/backend/hooks/version

1 file changed

+4
-1
lines changed

src/pdm/backend/hooks/version/scm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,10 @@ def hg_parse_version(root: StrPath, config: Config) -> SCMVersion | None:
287287
root,
288288
)
289289
tag: str | None
290-
tag, node, branch = output.rsplit("-", 2)
290+
try:
291+
tag, node, branch = output.rsplit("-", 2)
292+
except ValueError:
293+
return None # unpacking failed, unexpected hg repo
291294
# If no tag exists passes the tag filter.
292295
if tag == "null":
293296
tag = None

0 commit comments

Comments
 (0)