<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mohamed Mahmoud (El-Geish) : Difference</title><link>http://blogs.msdn.com/mohamedg/archive/tags/Difference/default.aspx</link><description>Tags: Difference</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to: Diff shelved files?</title><link>http://blogs.msdn.com/mohamedg/archive/2009/04/18/how-to-diff-shelved-files.aspx</link><pubDate>Sat, 18 Apr 2009 10:34:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9554899</guid><dc:creator>mohamedg</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mohamedg/comments/9554899.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mohamedg/commentrss.aspx?PostID=9554899</wfw:commentRss><description>You can run: tf diff /shelveset:shelvesetName;DOMAIN\ownerUserName Please note that this will diff the shelved changes against the unmodified version, not necessarily the latest version, just like what the you get from clicking compare in the shelveset...(&lt;a href="http://blogs.msdn.com/mohamedg/archive/2009/04/18/how-to-diff-shelved-files.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9554899" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mohamedg/archive/tags/VSTF/default.aspx">VSTF</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Source+Control/default.aspx">Source Control</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Difference/default.aspx">Difference</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Shelve/default.aspx">Shelve</category></item><item><title>How to: Change file encoding?</title><link>http://blogs.msdn.com/mohamedg/archive/2009/03/18/how-to-change-file-encoding.aspx</link><pubDate>Wed, 18 Mar 2009 07:36:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9485835</guid><dc:creator>mohamedg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mohamedg/comments/9485835.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mohamedg/commentrss.aspx?PostID=9485835</wfw:commentRss><description>&lt;p&gt;While merging or comparing files using the DiffMerge tool, and files have different encoding, you will see this message:&lt;/p&gt;  &lt;p&gt;&amp;quot;The character encodings on these files are different. Only files with the same character encoding can be merged or compared.&amp;quot;&lt;/p&gt;  &lt;p&gt;If you look at the properties window of a file in the Source Control Explorer or run &lt;strong&gt;tf prop itemSpec&lt;/strong&gt;, you will see the encoding of the file as stored on the server the last time the encoding was set either explicitly using the /type argument during tf add or tf checkout, or implicitly when TFS tried its best effort to detect the file's encoding during the add operation. This encoding stored on the server may not match the latest version’s physical encoding, as someone could have checked-in the file in a different encoding or explicitly changed the encoding stored on the server. To solve this issue, you can detect the encoding using the properties dialog or set it to match the file’s physical encoding if you know it. The other thing that I can think of is that the encoding of the local files that we are trying to merge has been changed by a tool or an IDE. Open both files (source and target) in Source Control Explorer, detect and save their encoding, open the target file locally using Visual Studio and Save As With Encoding to make it match the merge source encoding.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9485835" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mohamedg/archive/tags/VSTF/default.aspx">VSTF</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Source+Control/default.aspx">Source Control</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Merge/default.aspx">Merge</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Difference/default.aspx">Difference</category></item><item><title>How to: Tell if files are identical using TFS APIs?</title><link>http://blogs.msdn.com/mohamedg/archive/2009/03/09/how-to-tell-if-files-are-identical-using-tfs-apis.aspx</link><pubDate>Mon, 09 Mar 2009 20:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9468014</guid><dc:creator>mohamedg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mohamedg/comments/9468014.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mohamedg/commentrss.aspx?PostID=9468014</wfw:commentRss><description>&lt;P&gt;In a previous post, I answered this question using Diff APIs, which will require the items to be downloaded first. Here's a faster way to do it (thanks to &lt;A class="" href="http://blogs.msdn.com/michalma/" target=_blank mce_href="http://blogs.msdn.com/michalma/"&gt;MichalMa&lt;/A&gt;):&lt;/P&gt;
&lt;P&gt;Use &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getitem.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getitem.aspx"&gt;GetItem&lt;/A&gt; or &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getitems.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getitems.aspx"&gt;GetItems&lt;/A&gt; method to get&amp;nbsp;the &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.aspx"&gt;Item&lt;/A&gt; objects for the files. If &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.contentlength.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.contentlength.aspx"&gt;ContentLength&lt;/A&gt; and &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.hashvalue.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item.hashvalue.aspx"&gt;HashValue&lt;/A&gt; for the items match, and HashValue is not null, then items should be identical. You can do the same check with &lt;A class="" href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.pendingchange.hashvalue.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.pendingchange.hashvalue.aspx"&gt;PendingChange.HashValue&lt;/A&gt; too to compare local files that have pending changes. Note that HashValue is the&amp;nbsp;&lt;A class="" href="http://en.wikipedia.org/wiki/MD5" target=_blank mce_href="http://en.wikipedia.org/wiki/MD5"&gt;MD5&lt;/A&gt; HashValue for the contents of the file, and it's been shown that it's not &lt;A class="" href="http://en.wikipedia.org/wiki/Collision_resistance" target=_blank mce_href="http://en.wikipedia.org/wiki/Collision_resistance"&gt;collision resistant&lt;/A&gt;&amp;nbsp;although it's extremely rare to see such collisions.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9468014" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mohamedg/archive/tags/VSTF/default.aspx">VSTF</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Source+Control/default.aspx">Source Control</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Difference/default.aspx">Difference</category></item><item><title>How to: Diff files using TFS APIs?</title><link>http://blogs.msdn.com/mohamedg/archive/2009/03/08/how-to-diff-files-using-tfs-apis.aspx</link><pubDate>Sun, 08 Mar 2009 09:51:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9465059</guid><dc:creator>mohamedg</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mohamedg/comments/9465059.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mohamedg/commentrss.aspx?PostID=9465059</wfw:commentRss><description>&lt;p&gt;You can use the &lt;a href="http://msdn.microsoft.com/en-us/library/bb138238.aspx" target="_blank"&gt;Difference.DiffFiles&lt;/a&gt; method which compares two files using the internal diff engine, and return the linked list of &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.common.diffsegment.aspx"&gt;DiffSegment&lt;/a&gt;s: &lt;/p&gt;  &lt;p&gt;DiffSegment ds = Difference.DiffFiles(fileA, FileType.Detect(fileA, null), fileB, FileType.Detect(fileB, null), new DiffOptions());&lt;/p&gt;  &lt;p&gt;Console.WriteLine(ds.Next == null ? &amp;quot;Identical&amp;quot; : &amp;quot;Different&amp;quot;);&lt;/p&gt;  &lt;p&gt;// If you don’t have the files locally on disk, you’ll need to download them first:   &lt;br /&gt;// The path can be a temp file:    &lt;br /&gt;// Path.Combine(Environment.GetEnvironmentVariable(&amp;quot;tmp&amp;quot;), &amp;quot;diff_&amp;quot; + someRandomValue);&lt;/p&gt;  &lt;p&gt;string fileA = &amp;quot;Local path for file A&amp;quot;;   &lt;br /&gt;string fileB = &amp;quot;Local path for file B&amp;quot;;    &lt;br /&gt;VersionControlServer vcs = new TeamFoundationServer(&amp;quot;http://tfs:8080&amp;quot;).GetService(typeof(VersionControlServer));    &lt;br /&gt;    &lt;br /&gt;vcs.DownloadFile(&amp;quot;$/Proj/a&amp;quot;, fileA);    &lt;br /&gt;vcs.DownloadFile(&amp;quot;$/Proj/b&amp;quot;, fileB);&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9465059" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mohamedg/archive/tags/VSTF/default.aspx">VSTF</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Source+Control/default.aspx">Source Control</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/How+To/default.aspx">How To</category><category domain="http://blogs.msdn.com/mohamedg/archive/tags/Difference/default.aspx">Difference</category></item></channel></rss>