Is there any way to get the tfs workspace?

I have an nant script that is calling on the tfs command line program (tf) to do some beanching and merging. I've cloacked these directories (excluded them, agent side checkout) in Team City because they are rather large and I don't need the files in them. So I had planned to uncloak the directory do the the merge and branch and then cloak them again using tf. But, the uncloak and cloak commands need to specify a workspace. While we only have a single agent running now and I could hardcode the workspace, In the future we will have multiple agents and they will have different workspaces. Is there a way to get the name of the workspace the agent is using? You must have access to this info somewhere because when using the agent side checkout all the files are mapped into that wokspace.

--actually the hardcoding won't work as TC will delete the workspace and add a different one at times.

thanks
eric

4 comments
Comment actions Permalink

TeamCity tfs checkout on agent creates a workspace like 'TeamCity-<some digits>' for checkout your project.
The workspace name could change from build to build.

Why do you need the name of workspace? Most tf commands are able to guess the workspace name by
local paths.

TeamCity checks workspace for every checkout. If workspace is changed it would recreate or change it to
reflect checkout rules.

0
Comment actions Permalink

The decloak command needs the work space.
We have a directory that contains all of our previously released versions. If I do not exclude this dir it taks 30+ min to check out, and will only get worse as we add mor versions.
My nant script was going to build and test the code then branch it to the previous versions directory.
Currently our script can do this as long as the devloper provides their workspace name so that the previous versions directory can be uncloaked, branched too and then recloaked. (cloaking does not require the workspace)
If TeamCity checks the workspace for every checkout, could it not make the workspace name available vai a system param?

thanks
eric

0
Comment actions Permalink

Could you please try calling

tf.exe workfold <path to checkout director>

This command will write the workspace name.
I've checked documentation of the command and found out that it is not necessary to
specify workspace for that command to cloak/decloak files.
http://msdn.microsoft.com/en-us/library/0fa04bx6(VS.80).aspx

Could you please describe details on your tf.exe usage if this case does not work for you.

Thanks!

0
Comment actions Permalink

Your suggestion gave me the nudge I needed. I was playing with the command line outside of the checkout directory
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>tf workfold /decloak c:\tfsprod\Shared\EjbTestPreviousVersion

Once I added C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE to my path and called tf from within the checkout directory then everything worked.
C:\TFSProd\Shared>tf workfold /decloak c:\tfsprod\shared\ejbtestpreviousversion

thanks for the help
eric

0

Please sign in to leave a comment.