Apply specific changeset from one TFS instance to

2019-06-22 14:59发布

问题:

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?

回答1:

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.


回答2:

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.



回答3:

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.