Mercurial: Windows script to add subrepository automatically

这一生的挚爱 提交于 2019-12-05 06:11:17

Here is a quick and dirty translation. Haven't tested as I got no Mercury around. The initial script seems to be easy enough to translate into 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"
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!