MSH: Some Handy Team Foundation Aliases

Microsoft’s Visual Studio Team System Team Foundation Version Control (that’s a mouthful) comes with a handy command line interface which is a life saver for allowing TFVC to be scripted. The utility you use is called TF.EXE.  You use it like so:
 
tf status
tf status . /recursive /workspace:*
tf status . /recursive /user:*
 
I use these enough that I have created some handy MSH alias functions around TF commands:
 
# Team Foundation Version Control "alias" functions
function tfco    { tf checkout $args }
function tfci    { tf checkin $args }
function tfmine  { tf status . /recursive /workspace:* }
function tflocks { tf status . /recursive /user:* }
function tfh     { tf hist $args /noprompt | more }
function tfd     { tf diff $args /noprompt | more }
Now I do have some issues with TF.EXE like it’s very annoying habit of output extra goop that has to be parsed out in script.  For instance, here’s some typical output of "tf dir":
 
MSH:9 # tf dir
$/Proj/Branches/Feature/Foo:
$Src
 
1 item(s)
 
Note that in order to use the output of this command you have to strip the first and last two lines.  Blech!  There is no -quiet mode.  Of course, we know what the right answer is.  The next version of TFVC needs a full blown set of MSH cmdlets to allow some very slick scriptability of TFVC.
 
Advertisements
This entry was posted in Monad. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s