comparison init.gradle @ 144:7fead80bdd6a

handle merge working directories (multiple parent branches)
author Dave Smith <smith@nwoca.org>
date Fri, 25 Oct 2013 21:27:11 +0100
parents 1963264c39c4
children cea4e793a3f4
comparison
equal deleted inserted replaced
143:1963264c39c4 144:7fead80bdd6a
25 gradle.ext.branchName = "" 25 gradle.ext.branchName = ""
26 gradle.ext.branchStream = "" 26 gradle.ext.branchStream = ""
27 try { 27 try {
28 gradle.ext.branchName = "hg branch".execute().text.trim() 28 gradle.ext.branchName = "hg branch".execute().text.trim()
29 def parents = "hg parents --template \"{branch} \"".execute().text.trim().split(" ") 29 def parents = "hg parents --template \"{branch} \"".execute().text.trim().split(" ")
30 println "working directory parents: $parents "
30 def parent = parents.find { it != 'default' } 31 def parent = parents.find { it != 'default' }
31 gradle.ext.branchName = parent ?: gradle.branchName 32 gradle.ext.branchName = parent ?: gradle.branchName
32 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim() 33 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
33 } catch (e) { } 34 } catch (e) { }
34 35
35 36
36 if (file('.hgflow').exists()) { 37 if (file('.hgflow').exists()) {
37 def flows = new Properties() 38 def flows = new Properties()
38 flows.load(file('.hgflow').newReader()) 39 flows.load(file('.hgflow').newReader())
39 flows.stringPropertyNames().each { 40 flows.stringPropertyNames().each {
40 if (!it.startsWith("[") && gradle.ext.branchName.startsWith(flows.getProperty(it))) { 41 if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) {
41 gradle.ext.branchStream = it 42 gradle.ext.branchStream = it
42 } 43 }
43 } 44 }
44 } 45 }
45 46