From: Benjamin Drung Date: Wed, 5 Mar 2014 12:19:10 +0000 (+0100) Subject: Fix crash with python-git >= 0.3 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=2613194008c533458fe03ade3ac5dd3a4d54d3b0;p=profitbricks%2Fjenkins-build-scripts.git Fix crash with python-git >= 0.3 The Commit id attribute was renamed to hexsha in python-git >= 0.3 --- diff --git a/debian_build.py b/debian_build.py index 8831f32..53d1832 100755 --- a/debian_build.py +++ b/debian_build.py @@ -206,11 +206,15 @@ if __name__ == '__main__': # compatible remote_tag = [tag for tag in gitrepo.tags if tag.name == new_tag] if not do_autoincrement and len(remote_tag) > 0: - # FIXME: .id attribute but avl. in wheezy based git lib - if remote_tag[0].commit.id == curr_commit_id: + tagged_commit = remote_tag[0].commit + if hasattr(tagged_commit, 'hexsha'): + tagged_commit_hexsha = tagged_commit.hexsha + else: + tagged_commit_hexsha = tagged_commit.id + if tagged_commit_hexsha == curr_commit_id: message = 'Tag {name} was already created for commit {sha}.'.format( name=remote_tag[0].name, - sha=remote_tag[0].commit.id[0:7], + sha=tagged_commit[0:7], ) logger.debug(message) do_tagging = False @@ -218,7 +222,7 @@ if __name__ == '__main__': else: logger.error('Tag {name} was already created for commit {sha}.'.format( name=remote_tag[0].name, - sha=remote_tag[0].commit.id[0:7], + sha=tagged_commit[0:7], )) exit_error() else: