TFS Equivalent of SVN Export
Here is a little trick to download the latest version of a source control folder from TFS. The idea is to use the Web Access API to retrieve the data.
Basically, you will get a Zip containing the HEAD version of the specified source control folder.
Here is the URL you have to use :
http://tfs-server:port/tfs/Collection/TeamProject/Team/_api/_versioncontrol/itemContentZipped?repositoryId=&path=url-encoded-source-control-path
The yellow parameters are mandatory, the green ones can be omitted.
Replace the parameters as described:
This URL is using Windows Authentication, so if you are using CURL (for example) on a non-Microsoft platform, you have to pass the --ntlm switch together with your windows credentials to retrieve the Zip package.
Basically, you will get a Zip containing the HEAD version of the specified source control folder.
Here is the URL you have to use :
http://tfs-server:port/tfs/Collection/TeamProject/Team/_api/_versioncontrol/itemContentZipped?repositoryId=&path=url-encoded-source-control-path
The yellow parameters are mandatory, the green ones can be omitted.
Replace the parameters as described:
- tfs-server is the TFS server hostname
- port is the TFS port (usually 8080)
- Collection is the name of your team project collection
- TeamProject is the name of your team project
- Team is the name of the team
- url-encoded-source-control-path is the URL encoded source control path (for example, $/Project1/Main/Sources/Folder/SubFolder becomes %24%2FProject1%2FMain%2FSources%2FFolder%2FSubFolder
This URL is using Windows Authentication, so if you are using CURL (for example) on a non-Microsoft platform, you have to pass the --ntlm switch together with your windows credentials to retrieve the Zip package.
Thanks a lot you save me a lot of time!
ReplyDelete