如何将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

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

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

最新更新