From 83d3a71c973a12d9acd2d843a506746e2455a660 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Fri, 17 Jan 2014 10:27:49 +0100 Subject: [PATCH] gentoo_build: Improve error message for existing tag. --- gentoo_build | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gentoo_build b/gentoo_build index e546600..972c590 100755 --- a/gentoo_build +++ b/gentoo_build @@ -315,10 +315,12 @@ def tag_from_debian_changelog(logger): version = changelog.full_version # Replace valid Debian version chars that are invalid for git tagging new_tag = version.replace('~', '_').replace(':', ',') - tag_head_commit(logger, new_tag) + resolve_existing_msg = (" Have you forgotten to create a new Debian " + "changelog entry?") + tag_head_commit(logger, new_tag, resolve_existing_msg) return new_tag -def tag_head_commit(logger, new_tag): +def tag_head_commit(logger, new_tag, resolve_existing_msg=""): """Tags the head commit with the given tag name.""" repo = git.Repo('.') current_commit = repo.commit(repo.active_branch) @@ -338,9 +340,10 @@ def tag_head_commit(logger, new_tag): sys.exit(1) remote_tag = [t for t in repo.tags if t.name == new_tag] if len(remote_tag) > 0: - msg = 'Tag {tag} was already created for commit {commit}.' - logger.error(msg.format(tag=new_tag, - commit=remote_tag[0].commit.hexsha[0:7])) + msg = ('Tag {tag} was already created for commit ' + '{commit}.'.format(tag=new_tag, + commit=remote_tag[0].commit.hexsha[0:7])) + logger.error(msg + resolve_existing_msg) sys.exit(1) logger.info("Tagging commit {commit} with {tag}" "...".format(commit=current_commit.hexsha[0:7], tag=new_tag)) -- 2.39.5