Click here to Skip to main content
15,881,812 members
Articles / All Topics

TFS and the KISS principle

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
25 Oct 2010Apache2 min read 11.4K   1
TFS and the KISS principle

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:

mkdir destdir
cd destdir
tf workspace /server:mytfsserver /new myworkspace /noprompt
tf workfold /map tfspath .
tf get tfspath /version:Llabel /recursive
tf workspace /delete myworkspace /noprompt
cd ..

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.

  1. The 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 the 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.
  6. 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).
  7. 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.

This article was originally posted at http://www.ikriv.com/blog?p=637

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Technical Lead Thomson Reuters
United States United States
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.

Please visit my web site: www.ikriv.com.

Comments and Discussions

 
GeneralAbsolutely could not agree more. Pin
Br.Bill26-Oct-10 14:07
Br.Bill26-Oct-10 14:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.