comparison 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
comparison
equal deleted inserted replaced
183:358fdd20674a 184:acd8d3b58440
495 def stream = "none" 495 def stream = "none"
496 496
497 BranchInfo(name) { 497 BranchInfo(name) {
498 this.name = name 498 this.name = name
499 if (!name) { 499 if (!name) {
500 this.name = determineName() 500 this.name = determineName() ?: ''
501 } 501 }
502 this.name = this.name.replace('@', '-') 502 this.name = this.name.replace('@', '-')
503 determineStream() 503 determineStream()
504 } 504 }
505 505
517 def branch = "hg branch".execute().text.trim() 517 def branch = "hg branch".execute().text.trim()
518 def rawParents = 'hg parents'.execute().text 518 def rawParents = 'hg parents'.execute().text
519 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim() 519 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim()
520 return parent ?: branch 520 return parent ?: branch
521 } catch (e) { 521 } catch (e) {
522 if(new File('.hg/branch').exists()) { 522 ['.hg/branch', '../.hg/branch'].findResult {
523 return new File('.hg/branch').text 523 new File(it).exists() ? new File(it).text : null
524 } else {
525 return ''
526 } 524 }
527 } 525 }
528 } 526 }
529 527
530 void determineStream() { 528 void determineStream() {