views:

62

answers:

3

Subversion's svn import command allows repeatedly importing an external directory tree into source control. It's also important to note the original directory tree is not modified, ie it does not become a checkout/working directory.

What is the equivalent in TFS 2010 (Team Foundation Server), using the command line?

+1  A: 

TFS does not support this concept.

You could include a script in source control that developers would be able to run to pull files from an external VCS into their workspace. This script could also be included as part of the automated build process.

Jason Stangroome
I can understand if this is not built in, in that case an alternative script/batch file would be a useful answer.
Bernard Vander Beken
+1  A: 

You can create a batch file that first creates a temporary workspace, then add the files and perform a checkin, and then removes the workspace again:

tf workspace /new Temp /collection:http://MyTfsServer:8080/tfs/defaultcollection /noprompt

tf add *.* /recursive /noprompt

tf checkin /recursive /noprompt

tf workspace /delete Temp /collection:http://MyTfsServer:8080/tfs/defaultcollection /noprompt

Ewald Hofman
A: 

As has already been stated, you're going to be looking at using a work-around.

You could look at using MSBuild to do this, so it's part of your build process. To access TFS, you can either shell out to TF.EXE, or use the MSBuildExtensionPack (see this question also).

Hopefully you have a single project within your solution that is dependant on the content that is elsewhere in your source code, so you have an obvious location to put your MSBuild custom code.

I'd envisage the MSBuild code would:

  1. Get the applicable content, overwriting existing content.
  2. Remove source control bindings - this blog post looks like it might have pointers.

It isn't beautiful, but it's unlikely you'll find a beautiful solution in the absence of import. This approach has the advantage that putting your customisation within a .csproj means that you don't need any kind of custom build process to ensure the content is updated. It'll simply happen everytime the project you use is built.

If you know people building your script will have the content you want to import checked out in a predictable location relative to the solution being built, you could simply copy from that location, instead of using TF get.

SamStephens