I'm trying to create a script that will move a feature branch to an archive area. The script looks like this:
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
I get the following error when the move is performed:
TF14097: Cannot rename $/Fusion Server/Development/B-01560 when it has a working folder mapping assigned to it.
How can this be done?
Solution:
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
You can't rename a folder that has working folder mappings assigned to it. Ie, if you have a mapping from $/A to C:\A, you cannot rename $/A. Instead, unmap $/A and create a mapping for its parent $/, then you can rename $/A to $/B.