如何创建移动tfs分支的脚本?

时间:2011-05-12 20:57:32

标签: tfs2010 rename tfvc tf-cli

我正在尝试创建一个脚本,将功能分支移动到存档区域。脚本如下所示:

mkdir C:\TempWorkspace
pushd C:\TempWorkspace

tf workspace /new /noprompt /s:http://rdsw02fdkserv:8080/tfs MoveToArchive
tf workfold /unmap $/ /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

tf workfold /map "$/Fusion Server/Development/%1" C:\TempWorkspace\%1 /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs
tf workfold /map "$/Fusion Server/Development/Archive" C:\TempWorkspace\Archive /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

tf move "$/Fusion Server/Development/%1" "$/Fusion Server/Development/Archive/%1"

tf checkin /comment:"Move %1 to archive"

tf workfold /unmap "$/Fusion Server/Development/%1" /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs
tf workfold /unmap "$/Fusion Server/Development/Archive" /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs
tf workspace /delete /noprompt MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

popd
del C:\TempWorkspace /q /f

执行移动时出现以下错误:

TF14097: Cannot rename $/Fusion Server/Development/B-01560 when it has a working folder mapping assigned to it.

如何做到这一点?

解决方案:

mkdir C:\TempWorkspace
pushd C:\TempWorkspace

tf workspace /new /noprompt /s:http://rdsw02fdkserv:8080/tfs MoveToArchive
tf workfold /unmap $/ /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

tf workfold /map "$/Fusion Server/Development/" C:\TempWorkspace\ /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

tf get .

tf move "$/Fusion Server/Development/%1" "$/Fusion Server/Development/Archive/%1"

tf checkin /comment:"Move %1 to archive"

tf workfold /unmap "$/Fusion Server/Development" /workspace:MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

tf workspace /delete /noprompt MoveToArchive /s:http://rdsw02fdkserv:8080/tfs

popd
del C:\TempWorkspace /q /f

1 个答案:

答案 0 :(得分:0)

您无法重命名分配了工作文件夹映射的文件夹。即,如果您有从$ / A到C:\ A的映射,则无法重命名$ / A.相反,取消映射$ / A并为其父$ /创建映射,然后您可以将$ / A重命名为$ / B.