46

When viewing files in a shelveset, I would like the option of comparing the files to my current local version. Unfortunately, the only options available are "With Unmodified", "With Workspace" (I guess this one would be the answer, if it wasn't disabled) and "With Latest".

Any ideas?

danijels
  • 5,211
  • 4
  • 26
  • 36
  • 3
    +1. I think what OP looking for is a Visual Studio provided option to compare shelveset version with local workspace version. I would also like to have a folder comparison of shelveset with local and it should show only the files that differ. Basically in the same way it does server to local folder comparison in Source Explorer. – IsmailS Jul 15 '10 at 06:23
  • 13
    It's ridiculous that in 2015, we are still having to result to these hack-y methods to perform such a basic, simple action. Why is there still no "With Local" option? – Jason L. Sep 09 '15 at 17:19
  • 2
    @JasonL. I think the answer to that is clearly that the TFS developers all use GIT or Mercurial and therefore don't realize the shortcoming in their own garbage software. – Chad Schouggins Jun 21 '16 at 01:33
  • 2
    It's been raised but not actioned: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/5535263-enable-compare-shelved-file-with-local-edits – Tanner Apr 13 '18 at 08:54
  • VS 2017 still lacks this feature. – Elaskanator Feb 04 '19 at 17:16

9 Answers9

9

In VS2015 Update 3:

  1. Go to Pending Changes > Actions > Find Shelvesets
  2. Select the Shelveset you want to compare to, right click and choose View Shelveset Details
  3. Right Click on the file, choose Open
  4. Right Click on the tab, choose Copy Full Path
  5. In Solution Explorer, right click file, choose Compare...
  6. Paste the full path into Source Path and click OK
Graham
  • 609
  • 6
  • 9
  • This does not work. The "Workspace Version", I assume, is the actual _checked in_ file that your modified file is based on. – sandos Nov 25 '16 at 10:46
  • The previous directions compared to the latest local checked in version (which may or may nor have be the latest server version). I've updated to reflect the current working state. – Graham Feb 22 '17 at 23:45
  • This does work. However, it's very tedious to do this one file at a time with a large set of changes. The fact that this capability exists just makes me even more disappointed that Microsoft doesn't see the value of adding it as an option to the Compare dialog Source/Target drop-down menus. – Dale Harris May 21 '20 at 15:59
8

Up to How can I easily diff/compare 2 shelvesets in TFS?

Use VS2013 ShelvesetComparer or VS2012 ShelvesetComparer, shelve local version into another shelveset, then compare between two shelvesets...

Though this will make another unneeded shelveset, and you can't edit local in file compare editor.

Community
  • 1
  • 1
ChrisTorng
  • 742
  • 7
  • 18
8

Export Shelveset to a local folder using Team Foundation Sidekicks and use file comparison tool to compare with local version.

jnesis
  • 101
  • 1
  • 4
3

I don't think that it is possible to compare a shelved version with a local version in Visual Studio, however I'll be very happily corrected on the matter.

Martin Woodward
  • 11,770
  • 31
  • 45
3

Although this isn't the ideal way to do it, depending on your comparison tool you may be able to tell it to compare the shelved version to a local version (workspace). I use Beyond Compare, and this allows you to open a file to compare to. So from the shelveset I do a compare to Latest, and then replace the 'latest' with my local workspace version.

Unfortunately I've just checked the built in comparison tool and it doesn't provide this option.

Alex McMahon
  • 268
  • 1
  • 4
  • 11
2

Here's a simple hack that works:

  1. Click on 'Unshelve'
  2. Select proper shelveset
  3. Click on the 'Details' button
  4. Right click on the file you wish to compare
  5. Click on 'View'
  6. This opens up in your text editor, save it to your desktop or wherever you like.
  7. Open your file diff program and compare the saved version to your local version.

In a nutshell, save a copy of the shelved version you retrieve from the server and just do a manual compare using your diff tool.

TJB
  • 13,367
  • 4
  • 34
  • 46
1

In TFS, create a new (temporary) workspace, and map it onto a new local folder. get latest version into the new workspace, then unshleve the sheleveset into the new workspace. This gives you a temporary local copy of the source with the sheleveset applied. Then change back to the orignal workspace, click on file => source control => compare. Then enter the local folder paths of the original workspace and the new temprary workspace, to compare your original local version with the lcoal shelevest version.

PSty
  • 19
  • 1
1

I have been looking for a way to do this for quite some time. I wonder how hard it would be to create a vs.net plugin to do this for you.

0

This is a little laborious but it does the job:

  1. Right click any file in Solution Explorer and select 'Unshelve Pending Changes...' from the context menu.

  2. Double click the relevant shelveset in the Unshelve dialog.

  3. Double click the file that you want to compare. This will open the sheleveset version of the file in notepad.

  4. Save the file somewhere on your local machine.

  5. Close all the dialogs.

  6. Right click the local workspace version of your file in Solution Explorer and select 'Compare' from the context menu.

  7. Change the target path to that of the file that you saved earlier and click OK.

lexx
  • 637
  • 3
  • 9
  • I don't think this is correct. Just tried with tfpt2008 and the review option only compares with previous or latest. – TheSean Nov 06 '09 at 13:48
  • I'm sorry to say that you are right TheSean. Looks like I made a mistake on this one. I will edit my answer accordingly. – lexx Nov 06 '09 at 16:13
  • Thanks for pointing out my mistake TheSean. Hopefully my new answer should do the job even if it is a bit of a long process just to compare two files. – lexx Nov 06 '09 at 16:33
  • This is much much easier than using TFS power tools – BentOnCoding Nov 10 '11 at 17:31