Skip to content

Commit

Permalink
Merge pull request #24 from zvercodebender/master
Browse files Browse the repository at this point in the history
Bitbucket(Stash) plugin commit trigger issue
  • Loading branch information
Rick Broker authored Feb 6, 2020
2 parents 973f8a5 + 67e028d commit 7ad4fc7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/resources/stash/CommitTrigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#


import org.slf4j.LoggerFactory as LoggerFactory
import sys
import json

Expand All @@ -34,6 +34,7 @@ def findNewCommit(oldCommitMap, newCommitMap):

return branch, commitId

logger = LoggerFactory.getLogger("stash")
if server is None:
print "No Bitbucket server provided."
sys.exit(1)
Expand All @@ -60,9 +61,11 @@ def findNewCommit(oldCommitMap, newCommitMap):
newCommit = {}
for branch in info["values"]:
if branch["displayId"] not in excludeBranches.strip(" ").strip(",").split(","):
branchid = branch["displayId"]
lastcommit = branch["latestCommit"]
newCommit[branchid] = lastcommit
if (branchName is None) or (branch["displayId"] == branchName):
logger.debug("branchName = %s" % branchName)
branchid = branch["displayId"]
lastcommit = branch["latestCommit"]
newCommit[branchid] = lastcommit

# trigger state is perisisted as json
newTriggerState = json.dumps(newCommit)
Expand Down

0 comments on commit 7ad4fc7

Please sign in to comment.