如何在groovy中生成mercurial分支列表?
如何在groovy中生成远程mercurial分支列表?我想在Jenkins中添加动态选择器参数。Mercurial服务器作为hgweb运行。对于hgweb服务,Mercurial的分支库列表可从如何在groovy中生成mercurial分支列表?,groovy,mercurial,jenkins,Groovy,Mercurial,Jenkins,如何在groovy中生成远程mercurial分支列表?我想在Jenkins中添加动态选择器参数。Mercurial服务器作为hgweb运行。对于hgweb服务,Mercurial的分支库列表可从REPO-URL/branchs?style=raw 请参见作为示例的输出。您可以将与以下Groovy脚本一起使用: def hgUser = "user" def hgPassword = "password" def hgUrl = "repo_url" def args = [ "wge
REPO-URL/branchs?style=raw
请参见作为示例的输出。您可以将与以下Groovy脚本一起使用:
def hgUser = "user"
def hgPassword = "password"
def hgUrl = "repo_url"
def args = [
"wget",
"-q",
"-O",
"-",
"https://" + hgUser + ":" + hgPassword + "@" + hgUrl + "/branches?style=raw"
];
def builder = new ProcessBuilder(args)
builder.redirectErrorStream(true)
def process = builder.start()
def branches = process.text.split("\n")*.split().findAll{
it[2] != "closed" // Retain only non-closed branches
}*.head()
return branches.join(',')
注意
- 脚本调用
命令wget
- 我提供的用户+密码身份验证只是一个示例
def branchs=newurl('http://selenic.com/hg/branches?style=raw').text.split('\n')*.split()*.head()