From 406cd942d21cda3be1035a0225ec68c358b87dae Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 25 Aug 2016 18:23:33 -0400 Subject: [PATCH] Fix manual run under bitbucket repos with many tags/branches Fixes #1766 Depends on merging of https://github.com/coreos/py-bitbucket/pull/3 and then a regeneration of the requirements.txt --- buildtrigger/bitbuckethandler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/buildtrigger/bitbuckethandler.py b/buildtrigger/bitbuckethandler.py index 529b635cc..aa840e528 100644 --- a/buildtrigger/bitbuckethandler.py +++ b/buildtrigger/bitbuckethandler.py @@ -513,19 +513,19 @@ class BitbucketBuildTrigger(BuildTriggerHandler): def get_branch_sha(branch_name): # Lookup the commit SHA for the branch. - (result, data, _) = repository.get_branches() - if not result or not branch_name in data: + (result, data, _) = repository.get_branch(branch_name) + if not result: raise TriggerStartException('Could not find branch commit SHA') - return data[branch_name]['node'] + return data['target']['hash'] def get_tag_sha(tag_name): # Lookup the commit SHA for the tag. - (result, data, _) = repository.get_tags() - if not result or not tag_name in data: + (result, data, _) = repository.get_tag(tag_name) + if not result: raise TriggerStartException('Could not find tag commit SHA') - return data[tag_name]['node'] + return data['target']['hash'] def lookup_author(email_address): (result, data, _) = bitbucket_client.accounts().get_profile(email_address)