6

RyanWilcoxは、次のコマンドを使用してサブリポジトリを自動的に追加できるスクリプトをhereに投稿しました。

$ cd $TOP_OF_HG_PROJECT
$ addsubrepo.sh $URL_TO_HG_PROJECT relative_path/you/want_to/put_the_subrepo

それを Windows バッチまたは PowerShell スクリプトに変換するにはどうすればよいですか?

4

1 に答える 1

2

これが素早く汚い翻訳です。マーキュリーがないのでテストしていません。最初のスクリプトは、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"
}
于 2011-05-10T05:48:51.207 に答える