diff --git a/pandas/_version.py b/pandas/_version.py index 036c927df45d3..d000539421b91 100644 --- a/pandas/_version.py +++ b/pandas/_version.py @@ -238,14 +238,14 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): # tag full_tag = mo.group(1) if not full_tag.startswith(tag_prefix): + fmt = ("tag '{full_tag}' doesn't start with prefix " + "'{tag_prefix}'") + msg = fmt.format(full_tag=full_tag, tag_prefix=tag_prefix) if verbose: - fmt = "tag '{full_tag}' doesn't start with prefix " \ - "'{tag_prefix}'" - print(fmt.format(full_tag=full_tag, tag_prefix=tag_prefix)) - pieces["error"] = ("tag '{full_tag}' doesn't start with " - "prefix '{tag_prefix}'".format( - full_tag, tag_prefix)) + print(msg) + pieces["error"] = msg return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] # distance: number of commits since tag