5

What is the easiest way to apply the changes from a specific changeset from one TFS instance on another instance?

What I want is to get some sort of patch file from instance A that I can apply to instance B. Since there are two different instances, a traditional branch/merge approach cannot be used. And as far as I know, TFS has poor support for patch files in the traditional Unix-sense.

Do I really need to inspect a changeset on instance A and manually zip the relevant files which I can then extract into the source tree of instance B?

Tormod Fjeldskår
  • 5,952
  • 1
  • 29
  • 47
  • If you explain why you have two different TFS instances that might help. – Holistic Developer Oct 01 '12 at 03:30
  • Customer C has decided to switch from Vendor A to Vendor B for maintaining their enterprise software solution. For a period of some months, A will still be responsible for fixing bugs while B will be responsible for change requests. As stated in question, A and B does not share a TFS server, and the bug fixes that A make in their source tree need to find their way to B's server. – Tormod Fjeldskår Oct 01 '12 at 06:09
  • For applying the patch you could use the `patch` command, as explained here: https://stackoverflow.com/questions/3418277/how-to-apply-git-diff-patch-without-git-installed. Installing `Git Bash` will provide this command. But I don't know if `patch` is compatible with patches created by the `tf diff` command. – Nicolas Apr 28 '23 at 07:39

3 Answers3

3

Turns out that the "patch" route was a dead end due to lack of support in TFS. The solution we ended up with was to perform a nightly job which basically does the following:

  1. Get all code from remote repo with a read-only user.
  2. Overwrite all content of a separate branch in our repo with the content from the other.
  3. Perform a merge from that separate branch to the main branch whenever we want to bring their changes into our main branch.
Tormod Fjeldskår
  • 5,952
  • 1
  • 29
  • 47
1

This answer explains how to create a patch file using the tf diff command. However, there is no built-in way to apply that patch file to another instance or branch. I have not seen any third-party tools to do so either.

Community
  • 1
  • 1
Holistic Developer
  • 2,458
  • 1
  • 18
  • 27
  • I have looked at the 'tf diff' command, but the only way I've found to diff on a specific changeset N is to run it on the source root with versionspec CN-1~CN, which takes forever and also does not handle added or removed files, only modified files. – Tormod Fjeldskår Oct 01 '12 at 08:24
1

I wrote a blog post about a similar issue where I used the TF.exe command and 7Zip to create a TFS patch file that could then be applied on another TFS server or workspace. I posted the the Powershell scripts at Github, which can be used to Zip up any pending changes on one workspace and then apply them to a different server. It would have to be modified to use a changeset instead of pending changes, but that shouldn't be too difficult to accomplish.

Greg Bray
  • 14,929
  • 12
  • 80
  • 104