Team Explorer Everywhere: What is the best way to retrieve a single file?

512 Views Asked by At

I apologize for being a newb to MicroSoft products, but I have a need to support TFS integration into an existing tool. I have looked around and figured that Team Explorer Everywhere is the way to go since it is cross platform and seems to be user-friendly enough to wrap in python and expose a certain subset of functionality.

What I need to do is actually quite simple and I believe that my problems stem from a lack of understanding on my part. I need to retrieve a single zip file from TFS, deploy this file to an application server, create a second zip file containing logs and other deployment artifacts, add the second zip to the Team project and check it all back in to TFS.

All the code for the deployment is written up to and including creating the second zip file, what I cannot figure out is a simple checkout/checkin procedure.

This is the course I have tried:

C:\> mkdir collection
C:\> cd collection
C:\collection> tf workspace /new /comment:TEMP /collection:http://www.tfs.server.com:8080/tfs/testCollection /location:local tempWorkspace
C:\collection> tf workfold /map /collection:http://www.tfs.server.com:8080/tfs/testCollection $/serverFolder .
C:\collection> tf get

Now here for some reason my folder is empty. I know there are files in this folder and they are in this collection, there might be a simple reason why my folder is empty, but at this point in troubleshooting I figured there must be a simpler way to retrieve one file (maybe not), but I figured I should ask because this seems like a lot compared to:

$ git clone https://url/for/repo

Anyway Thank you so much for looking at my question, any guidance would be greatly appreciated.

1

There are 1 best solutions below

1
On BEST ANSWER

OK, so it appears that typos along with some misunderstandings were the cause of my dilemma. I am answering my own question because I feel as though some might come across this problem in the future.

My biggest mistake (which is coupled with what I believe to be a bug) was a typo in the server-path which is required for some of the following commands. I mistyped the server-path in the "tf workfold -map" command which succeeded and when a subsequent "tf get" command was issued I received the "VERY HELPFUL" output indicating that "all files are up to date".

Here is a list of common tasks which would need to be performed for a task set such as mine, but would also be useful as a cheat sheet for learning to work with TFS:

Create a workspace and get all files

mkdir $TEMP_DIR$
tf workspace -new $TEMP_WORKSPACE$ -collection:$SERVER_URL$/$COLLECTION_NAME$
tf workfold -map $SERVER_PATH$ -workspace:$TEMP_WORKSPACE$ $TEMP_DIR$
cd $TEMP_DIR$
tf get

Where:

$TEMP_WORKSPACE$  = any string will do (Should be configurable)
$SERVER_URL$      = The URL of your TFS server (usually ends with "/tfs" and by default is on port 8080)
$COLLECTION_NAME$ = The name of the collection (i.e. DefaultCollection)
$TEMP_DIR$        = Any valid directory (Relative paths are not allowed)
$SERVER_PATH$     = The path to the team project

Add a file to repo and checkin

NOTE: Must be in a directory which is mapped using the above workfold command

tf add $FILENAME$

Where:

$FILENAME$ = Name of file to add (Must exist!)

Check-in changes

NOTE: Must be in a directory which is mapped using the above workfold command

tf checkin -comment:$COMMENT$

Where:

$COMMENT$  = A comment to associate with the changeset

Get the status of workspace

NOTE: Must be in a directory which is mapped using the above workfold command

tf status

Unmap local directory

tf workfold -unmap -collection:$SERVER_URL$/$COLLECTION_NAME$ -workspace:$TEMP_WORKSPACE$ $TEMP_DIR$

Where:

$TEMP_WORKSPACE$  = any string will do (Should be configurable)
$SERVER_URL$      = The URL of your TFS server (usually ends with "/tfs" and by default is on port 8080)
$COLLECTION_NAME$ = The name of the collection (i.e. DefaultCollection)
$TEMP_DIR$        = Any valid directory (Relative paths are not allowed)

Delete workspace

tf workspace -delete -collection:$SERVER_URL$/$COLLECTION_NAME$ $TEMP_WORKSPACE$

Where:

$TEMP_WORKSPACE$  = any string will do (Should be configurable)
$SERVER_URL$      = The URL of your TFS server (usually ends with "/tfs" and by default is on port 8080)
$COLLECTION_NAME$ = The name of the collection (i.e. DefaultCollection)