]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
gentoo_build: Improve error message for existing tag.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Fri, 17 Jan 2014 09:27:49 +0000 (10:27 +0100)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Fri, 17 Jan 2014 09:27:49 +0000 (10:27 +0100)
gentoo_build

index e5466001ef273e05d9687fe24a743bbbceaf54db..972c5909a78055b3d6cc81a64dc2e8998017be86 100755 (executable)
@@ -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))