changeset 159:0c48cfd1938b

allow projects to override branchName
author Dave Smith <smith@nwoca.org>
date Wed, 06 Nov 2013 02:13:31 +0000
parents 01c8e1e27d97
children 6af68acaf9b2
files init.gradle
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/init.gradle	Fri Nov 01 17:41:12 2013 +0100
+++ b/init.gradle	Wed Nov 06 02:13:31 2013 +0000
@@ -19,27 +19,30 @@
 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14,'0')
 
 gradle.ext.hgRepositoryUrl = ""
-gradle.ext.branchName = ""
-gradle.ext.branchStream = ""
+try {	
+	gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
+} catch (e) {  }
+
+if (!gradle.hasProperty('branchName') ){
+	println "init: determining branch properties"
+	gradle.ext.branchName = ""
+	gradle.ext.branchStream = ""
 
 	gradle.ext.branchName = "hg branch".execute().text.trim()
 	def rawParents = 'hg parents'.execute().text
 	def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim()	
 	gradle.ext.branchName = parent ?: gradle.branchName
-	
-try {	
-	gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
-} catch (e) {  }
-
+		
 
-if (file('.hgflow').exists()) {
-	def flows = new Properties()
-	flows.load(file('.hgflow').newReader())
-	flows.stringPropertyNames().each {
-		if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) {
-			gradle.ext.branchStream = it
+	if (file('.hgflow').exists()) {
+		def flows = new Properties()
+		flows.load(file('.hgflow').newReader())
+		flows.stringPropertyNames().each {
+			if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) {
+				gradle.ext.branchStream = it
+			}	
 		}	
-	}	
+	}
 }
 
 loadEnvironments()