瑞安·威尔考克斯 https://stackoverflow.com/users/224334/ryanwilcox已发布脚本于here https://stackoverflow.com/questions/2408772/how-do-i-add-a-subrepo-to-an-existing-repository-in-mercurial/2409375#2409375,可以使用以下命令自动添加子存储库:
$ cd $TOP_OF_HG_PROJECT
$ addsubrepo.sh $URL_TO_HG_PROJECT relative_path/you/want_to/put_the_subrepo
如何将其转换为Windows批处理或powershell脚本?
这是一个快速而肮脏的翻译。没有测试过,因为我周围没有水星。最初的脚本似乎很容易翻译成 Powershell。
# Project and relative paths as script parameters
param([string]$project, [string]$relPath)
# Let's see if there is an item .hg. If not, report error and quit
if((test-path ".hg") -eq $false ) {
"You MUST run this at the top of your directory structure and use relative paths"
return
}
# Call Mercury
& hg clone $project $relPath
# Add data to .hgsub using composite formatting string
add-content -path ".hgsub" -value $("{0} = {1}" -f $relPath, $project)
# Check that .hgsub exists and issue Mercury commands if it does
if(test-path ".hgsub") {
hg add .hgsub
hg commit
} else {
"failure, see error messages above"
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)