Unified Diff in TFS

2019-02-03 05:08发布

Anyone know if this (generating a unified diff) is possible and if so, how?

Thanks.

标签: tfs
3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-03 05:11

It's tf diff /shelveset:<set> /format:unified. However, note that unlike most modern version-control systems, TFS can't actually work with patch files afaik. That is, you can't take the result of the diff and apply it to a set of files to get the resulting changes. (What most people do is zip up the files that changed and drop-and-replace that as a "patch". Ick.)

查看更多
做个烂人
3楼-- · 2019-02-03 05:11

This is an on-going feature diff (pardon the pun) with SubVersion and others, that is recognised by Microsoft. I believe a solution will appear soon, however until then I have come up with a solution:

  1. Build a windows forms application which will take 4 fields as command-line parameters (filepath1, label1, filepath2, label2) and returns a string unified diff of the two files (maybe output to a rich textbox or something). I have one, but it is a bit rough to put up on CodePlex I believe. There are a few managed Diff libraries.

  2. Set Visual Studio's Source control compare function to point to your diff app. Make sure it opens and compares correctly.

  3. Build a windows forms patch application, which will apply the patch to a folder. The application also has to check out each file as it is patched (fun!).

  4. Setup two workspaces, the usual one, and a MyWkSpace_PATCH. This is used to patch to.

I still have to finish of point 3, but this will give me somewhat similar functionality to SubVersion. Will let you know how point 3 goes!

查看更多
beautiful°
4楼-- · 2019-02-03 05:36

This is what I usually do:

Obviously this assumes that the source files are already checked out. If they are not, especially when you are applying patches across branches, write a simple shell script to go through the diff file, get the files path and tf edit them.

查看更多
登录 后发表回答