changeset 143:1963264c39c4

handle merge working directories (multiple parent branches)
author Dave Smith <smith@nwoca.org>
date Fri, 25 Oct 2013 21:21:28 +0100
parents 45d2396e9fc8
children 7fead80bdd6a
files init.gradle
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/init.gradle	Fri Oct 25 19:53:31 2013 +0100
+++ b/init.gradle	Fri Oct 25 21:21:28 2013 +0100
@@ -25,8 +25,11 @@
 gradle.ext.branchName = ""
 gradle.ext.branchStream = ""
 try {
-   gradle.ext.branchName = "hg branch".execute().text.trim()
-   gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
+	gradle.ext.branchName = "hg branch".execute().text.trim()
+	def parents = "hg parents --template \"{branch} \"".execute().text.trim().split(" ")
+	def parent = parents.find { it != 'default' } 
+	gradle.ext.branchName = parent ?: gradle.branchName
+	gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
 } catch (e) {  }
 
 
@@ -36,10 +39,10 @@
 	flows.stringPropertyNames().each {
 		if (!it.startsWith("[") && gradle.ext.branchName.startsWith(flows.getProperty(it))) {
 			gradle.ext.branchStream = it
-		}
-	
-	}
+		}	
+	}	
 }
+
 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
 gradle.environment.put('branchName',gradle.branchName)
 gradle.environment.put('branchStream',gradle.branchStream)