From 97049e078fd4b412431b879e86b9f9ce25fbea83 Mon Sep 17 00:00:00 2001 From: mrussell42 Date: Mon, 6 Nov 2023 10:39:31 +0000 Subject: [PATCH] Fixes https://github.com/callowayproject/bump-my-version/issues/85 HG returns the tags in the order they were created so we want the last one in the list --- bumpversion/scm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bumpversion/scm.py b/bumpversion/scm.py index 241d9cec..fb1939e5 100644 --- a/bumpversion/scm.py +++ b/bumpversion/scm.py @@ -310,7 +310,7 @@ def latest_tag_info(cls, tag_pattern: str) -> SCMInfo: ) result.check_returncode() if result.stdout: - current_version = result.stdout.splitlines(keepends=False)[0].lstrip("v") + current_version = result.stdout.splitlines(keepends=False)[-1].lstrip("v") is_dirty = len(subprocess.check_output(["hg", "status", "-mard"])) != 0 # noqa: S603, S607 return SCMInfo(tool=cls, current_version=current_version, dirty=is_dirty)