comparison init.gradle @ 153:8dbc79c5bbb0

remove --template and parse manually
author Dave Smith <smith@nwoca.org>
date Fri, 25 Oct 2013 21:54:20 +0100
parents 2226a55023e4
children 6666e1cd8bae
comparison
equal deleted inserted replaced
152:2226a55023e4 153:8dbc79c5bbb0
22 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14,'0') 22 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14,'0')
23 23
24 gradle.ext.hgRepositoryUrl = "" 24 gradle.ext.hgRepositoryUrl = ""
25 gradle.ext.branchName = "" 25 gradle.ext.branchName = ""
26 gradle.ext.branchStream = "" 26 gradle.ext.branchStream = ""
27 try { 27
28 gradle.ext.branchName = "hg branch".execute().text.trim() 28 gradle.ext.branchName = "hg branch".execute().text.trim()
29 def parents = 'hg parents --template "\\{branches\\}\n"'.execute().text 29 def rawParents = 'hg parents'.execute().text
30 println "raw parents: $parents" 30 println "raw parents: $rawParents"
31 parents = parents.trim().split("\n") 31 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")[1].trim()
32 println "working directory parents: $parents "
33 def parent = parents.find { it != 'default' }
34 gradle.ext.branchName = parent ?: gradle.branchName 32 gradle.ext.branchName = parent ?: gradle.branchName
33
34 try {
35 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim() 35 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
36 } catch (e) { println e } 36 } catch (e) { }
37 37
38 38
39 if (file('.hgflow').exists()) { 39 if (file('.hgflow').exists()) {
40 def flows = new Properties() 40 def flows = new Properties()
41 flows.load(file('.hgflow').newReader()) 41 flows.load(file('.hgflow').newReader())