Showing posts with label beyond compare. Show all posts
Showing posts with label beyond compare. Show all posts

Compare Branches with Beyond Compare

After I do a big merge I always like to compare my source and target branches to review the differences. My tool of choice for this is Beyond Compare as its folder compare is extremely quick and it lets me easily exclude file types and folders that of no consequence and generate noise.

This is a good starting point for the filters. It excludes your compiled code, test results, files with user settings which don't usually get checked in. 
Filter Expression: -*.dll;-*.suo;-*.pdb;-*.user;-UpgradeLog.htm;-*.lnk;-*.vspscc;-*.vssscc;-bin\;-obj\;-.vs\;-TestResults\;-.git\

This is what it looks like in Beyond compare which is a bit easier to digest

You can also save this filter by clicking "Add To Presets" and it will be added to your file filter dropdown ready to go for next time!

How to ignore non-trival differences in files with Beyond Compare

If you want to ignore something that can't be handled by a replacements because the to-state isn't easily defined such as mismatching page numbers you need to use a regular expression grammer to ignore certain strings.
In my case I needed to ignore Page numbers in a document footer
Here is how to do it:
  1. Load your comparison in Beyond Compare
  2. Click the Rules toolbar button (referee icon).
  3. On the Importance tab, click Edit Grammar.
  4. Click New.
  5. In Text matching enter your regex e.g. "Page\s\d{1,3}\sof\s\d{1,3}"
  6. Tick Regular Expression
  7. Click OK.
  8. Click OK.
  9. Un-check the element in the Grammar elements list to make it unimportant.
  10. Click OK
Your grammar should now be marked as unimportant (blue text)

Using Beyond Compare with visual studio

Beyond Compare is the best merge and compare tool I’ve ever had the pleasure of using but I have found the experience of integrating it with visual studio can depend greatly on using the right parameters.
Using a different merge/compare tool with visual studio is a fairly straight forward thing to do but if you’re using something like winmerge but beyond compare has a lot more bells and whistles to fiddle with. Below is my preferred setup.

How To:

Under Tools > Options > Source Control > Visual Studio Team Foundation Server



Select Configure User Tools. Add both Compare and Merge operations.



Beyond Compare
Compare:
   Tool: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
   Arguments: %1 %2 /title1=%6 /title2=%7 /solo
Merge:
   Tool: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
   Arguments: %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9 /solo