only emit 'revision' attribute if different than default
diff --git a/collect-sling-repos.groovy b/collect-sling-repos.groovy
index adcf365..b2371a0 100755
--- a/collect-sling-repos.groovy
+++ b/collect-sling-repos.groovy
@@ -85,19 +85,22 @@
groupMap.keySet().removeAll(groupsBlacklist)
// TODO - should we establish a hierarchical structure, e.g. group 'validation' projects in the same reactor?
+final DEFAULT_BRANCH = 'master'
def xml = new MarkupBuilder()
-xml.mkp.xmlDeclaration(version: "1.0", encoding: "utf-8")
+xml.setOmitNullAttributes(true)
+xml.mkp.xmlDeclaration(version: '1.0', encoding: 'utf-8')
xml.manifest() {
- mkp.comment("Generated by collect-sling-repos.groovy")
- remote(name: "origin", fetch: ".")
- "default" (revision: "master", remote: "origin")
+ mkp.comment('Generated by collect-sling-repos.groovy')
+ remote(name: 'origin', fetch: '.')
+ 'default'(revision: DEFAULT_BRANCH, remote: 'origin')
slingRepos.forEach { repo ->
def groups = getGroups(repo, groupMap)
+ def branch = (repo.default_branch != DEFAULT_BRANCH) ? repo.default_branch : null
if ( groups ) {
- project(path: repoPath(repo), name: "${repo.name}.git", description: "${repo.description}", groups: getGroups(repo, groupMap), revision: "${repo.default_branch}")
+ project(path: repoPath(repo), name: "${repo.name}.git", description: repo.description, groups: getGroups(repo, groupMap), revision: branch)
} else {
- project(path: repoPath(repo), name: "${repo.name}.git", description: "${repo.description}", revision: "${repo.default_branch}")
+ project(path: repoPath(repo), name: "${repo.name}.git", description: repo.description, revision: branch)
}
}
}