diff init20.gradle @ 184:acd8d3b58440

handle branches while in subproject
author smith@nwoca.org
date Mon, 22 Dec 2014 20:56:20 +0000
parents 358fdd20674a
children e1762e4ad070
line wrap: on
line diff
--- a/init20.gradle	Mon Dec 22 20:44:29 2014 +0000
+++ b/init20.gradle	Mon Dec 22 20:56:20 2014 +0000
@@ -497,7 +497,7 @@
     BranchInfo(name) {
         this.name = name
         if (!name) {
-            this.name = determineName()
+            this.name = determineName() ?: ''
         }
         this.name = this.name.replace('@', '-')
         determineStream()
@@ -519,10 +519,8 @@
             def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim()
             return parent ?: branch
         } catch (e) {
-            if(new File('.hg/branch').exists()) {
-                return new File('.hg/branch').text
-            } else {
-                return ''
+             ['.hg/branch', '../.hg/branch'].findResult {
+                new File(it).exists() ? new File(it).text : null
             }
         }
     }