Skip to content

Commit

Permalink
Merge pull request entagen#44 from foosel/markSelectedBranches
Browse files Browse the repository at this point in the history
Mark the branches matched by the branchNameRegex
  • Loading branch information
jamesdh committed Mar 31, 2014
2 parents 364d170 + 8ede824 commit af18a93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/groovy/com/entagen/jenkins/GitApi.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ class GitApi {
List<String> branchNames = []

eachResultLine(command) { String line ->
println "\t$line"
// lines are in the format of: <SHA>\trefs/heads/BRANCH_NAME
// ex: b9c209a2bf1c159168bf6bc2dfa9540da7e8c4a26\trefs/heads/master
String branchNameRegex = "^.*\trefs/heads/(.*)\$"
String branchName = line.find(branchNameRegex) { full, branchName -> branchName }
if (passesFilter(branchName)) branchNames << branchName
Boolean selected = passesFilter(branchName)
println "\t" + (selected ? "* " : " ") + "$line"
// lines are in the format of: <SHA>\trefs/heads/BRANCH_NAME
// ex: b9c209a2bf1c159168bf6bc2dfa9540da7e8c4a26\trefs/heads/master
if (selected) branchNames << branchName
}

return branchNames
Expand Down

0 comments on commit af18a93

Please sign in to comment.