# HG changeset patch # User smith@nwoca.org # Date 1419281069 0 # Node ID 358fdd20674a215aa481367a24462a4a16b9b3f4 # Parent 0de8c0720fb4a9187d999fe02daf395f483964d9 determine branch when hg not available diff -r 0de8c0720fb4 -r 358fdd20674a init20.gradle --- a/init20.gradle Fri Dec 19 20:25:12 2014 +0000 +++ b/init20.gradle Mon Dec 22 20:44:29 2014 +0000 @@ -489,7 +489,8 @@ } -@ToString class BranchInfo { +@ToString +class BranchInfo { def name def stream = "none" @@ -512,10 +513,18 @@ } def determineName() { - def branch = "hg branch".execute().text.trim() - def rawParents = 'hg parents'.execute().text - def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim() - return parent ?: branch + try { + def branch = "hg branch".execute().text.trim() + def rawParents = 'hg parents'.execute().text + 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 '' + } + } } void determineStream() {