如何将svn中的文件复制到依赖于变量值的新目录中?

时间:2016-07-31 07:43:27

标签: powershell svn

我目前正在PowerShell中编写一个脚本,用于计算标记目录中的新标记。我想将文件从一个SVN目录复制到另一个目录,该目录取决于我计算的新标签号。

以下是剧本中的行:

$tag = Write-Host "$($svnMavenTagPrefix)$($nextMavenTagVersion)"

svn copy http://tlvsvn1/svn/repos-bls/MassAnalytics/trunk/ http://tlvsvn1/svn/repos-bls/MassAnalytics/tags/${tag}

由于某种原因它不起作用,我收到以下错误:

svn: E205007: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: E205007: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found

如何将文件复制到新标签?

1 个答案:

答案 0 :(得分:1)

Write-Host cmdlet打印您传递的字符串作为参数,但不会向输出写入任何内容,因此$tag为空。我建议你使用格式字符串:

$tag = '{0}{1}' -f $svnMavenTagPrefix, $nextMavenTagVersion
$url = 'http://tlvsvn1/svn/repos-bls/MassAnalytics/tags/{0}' -f $tag

svn copy http://tlvsvn1/svn/repos-bls/MassAnalytics/trunk/ $url