Udostępnij za pośrednictwem


How to: Copy Workspace Mappings?

A common scenario that you may see is the need to share/sync workspace mappings amongst team members. A developer adds a new dependency in a certain project and changes his/her mappings to get this library, and everyone else in the team now needs to do the same thing. Since workspace mappings are stored on the server, you can copy the mappings of any workspace to any of your workspaces, or create a new workspace using a template from another workspace. For example, let's say that you maintain the master workspace that everyone else is required to clone, once this workspace is changed, you can email your team so that they update their mappings. To view mappings of your workspace, they can run:

tf workspace /s:https://tfs:8080 WorkspaceName;DOMAIN\YourUserName

Then the workspace dialog will pop up and they can select all mappings (Ctrl+A) then copy them (Ctrl+C), then edit mappings in their workspaces by pasting the new mappings over the old ones.

Another option is to create a batch file that runs the same command above with the /i option, finds the mappings, parses them in a FOR loop to run tf workfold /map on each one, it should look like the following:

FOR /F "tokens=1,2,3 delims=:" %i IN ('tf workfold /s:https://tfs:8080 /w:MasterWorkspaceName;DOMAIN\YourUserName ^| find "$/" ^| find /v "(cloaked)"') DO tf workfold /map "%i" "%j:%k" /s:https://tfs:8080 /w:localWorkspaceName

Please note that if you run this command on the command prompt directly, variables like i should be written as %i, while if you run it using a batch file, it should be written as %%i

Comments