comparison init50-git.gradle @ 345:172495bee8a1

use git branch --all to find release branches.
author Marc Davis <marc.davis@mcoecn.org>
date Wed, 14 Jun 2023 14:42:03 -0400
parents 0bef709263cd
children de8c350c511a
comparison
equal deleted inserted replaced
344:0bef709263cd 345:172495bee8a1
807 } 807 }
808 } 808 }
809 .findAll { it != null } 809 .findAll { it != null }
810 .sort { v1, v2 -> v2 <=> v1 } 810 .sort { v1, v2 -> v2 <=> v1 }
811 811
812 def branches = "git branch --remote".execute().text.split("\n") 812 def branches = "git branch --all".execute().text.split("\n")
813 .findAll { 813 .findAll {it.contains('release') || it.contains('hotfix') }
814 println "Found branch ($it)"
815 it.contains('release') || it.contains('hotfix')
816 }
817 .collect { it.replaceAll('\\s+', ' ').split('/').last() - 'v' } 814 .collect { it.replaceAll('\\s+', ' ').split('/').last() - 'v' }
818 .collect { new Version(*it.split('\\.')*.toInteger()) } 815 .collect { new Version(*it.split('\\.')*.toInteger()) }
819 816
820 def results = (branches + versions).sort { v1, v2 -> v2 <=> v1 } 817 def results = (branches + versions).sort { v1, v2 -> v2 <=> v1 }
821 results.each { println it }
822 println "Selected version : ${results.first().nextSnapshot()}"
823 if (results.isEmpty()) { 818 if (results.isEmpty()) {
824 return new Version().nextSnapshot() 819 return new Version().nextSnapshot()
825 } else { 820 } else {
826 return results.first().nextSnapshot() 821 return results.first().nextSnapshot()
827 } 822 }