How do you copy an SVN label to a folder?
svn serverpath/tags/label destdir
How do you copy a TFS label to a folder? Watch my hands:
tf workspace /server:mytfsserver /new myworkspace /noprompt
tf workfold /map tfspath .
tf get tfspath /version:Llabel /recursive
tf workspace /delete myworkspace /noprompt
Why such a striking difference? SVN is built around “all parameters are explicit” principle. Export this to that. End of story. TFS on the other hand uses multiple levels of “invisible” server stored settings.
tf get command does not accept the destination. It takes the destination folder from a list of mappings from a TFS workspace.
2. It does not take workspace name as a parameter either (well, it may, but then you can’t use label syntax). Instead, it relies on some mysterious algorithm to find “implicit” or “current” workspace. I could not find exact description of this algorithm during casual browsing of MSDN, but it seems to derive current workspace from current directory — another hidden and unreliable dependency.
3. If current workspace cannot be determined,
tf just exists, proudly saying something like “unable to determine workspace”.
4. There is no explicit way to “switch to” a workspace. You just create it and it becomes tied to the directory current at the time of creation. Or something like that. Not really fully documented (or I could not find where). Then you need to add any mappings you want to it.
5. When you are done, don’t forget to delete your workspace, so the global namespace is not polluted with temporary stuff. I would not even ask what happens if some other process on the same machine tries to get the same project into another directory at the same time.
tf workspace /delete command would ask are you really sure to delete the thing. You can give it a /noprompt switch to shut up, but this switch is not documented at the time of writing (MSDN documentation).
tf workspace /new is even more interesting – by default it would open A GUI DIALOG!. Dear Microsoft people! Opening GUI dialogs from command line tools is a bad, bad, bad idea. Command line tools tend to run in batch modes on computers that nobody looks at. There will be no one there to enter the data and click “OK”. Mixing the GUI world and the command line world is inconvenient at best.
Bottom line: this is the first line I had to deal with the tf utility and I am appalled by the design of the whole thing. You can finally get what you need, but it is very, very painful.