No announcement yet.

3-way merge improved

  • Filter
  • Time
  • Show
Clear All
new posts

  • 3-way merge improved

    I'm used to use Perforce merge called P4V (p4merge.exe) for merging but I like BC for its advanced features. Sadly the merging of BC3 disappointed me a bit.

    BC3 merging is too messy compared to P4V (compared to Tortoise built-in it's better but who wants that?). My disappointment comes from:
    - Comparing/Matching not accurate enough; frequently fails to match the correct block.
    - Interface too complex: Too many colors, unclear presentation, too many scroll bars...

    I suggest to take a look at P4V to possibly improve BC3 merging (and even comparing). For source code, which is the most frequent, I, as a user, don't care if the merging algorithm is very long because the source code is small anyway. It's not like for big files where a simple comparison is enough.

    To conclude, the 3-way merging is a good improvement that yet should be improved before I'd prefer it of the free tools available.

  • #2
    BC3 is highly configurable. Have you tried tweaking the settings in the Importance / Alignment and Tolerance tabs under your Session Settings?
    BC v4.0.7 build 19761


    • #3
      Yes indeed I have. The problems from BC2 seem to keep. I haven't checked if the C++ brackets matching has been improved. I heard the XML is going to be later on, but still for general cases it's not matching very well.

      It's frequent that a term got renamed a bit, especially when refactoring source code. Then BC3 tries to align only with matching lines without testing trying to make a partial matching for mismatching lines. What I mean by partial matching is to internally match "Register<CStringWrapper>();" as being 80% similar to "Register <Wrapper::CString>()". This way it could align better, may be using fuzzy logic.

      Such advanced matching would only be really useful for smaller files, as bigger files would require too much time loading. It could be achieved by some settings, either per file type or with a file size threshold.


      • #4
        I, too, see areas that need improvement in code-alignment. One suggestion for the Scooter team that would take care 90% of my mis-alignments would be to eliminate matching lines from both directions (top down and bottom up) before executing the alignment algorythms on the rest of the file.

        I often have files where new data has been inserted at the top, and the bottom half of the files are identical... but BC3 attempts to match lines throughout the entire file (and makes a big mess of it). When I manually align the identical sections at the bottom of the two files then everything else falls into place nicely. I would think that it would take less processing for BC3 to eliminate matching lines at the bottom of files than to only use top-down algorythms that mis-match and mis-align lines all the way through the files.

        Edit: An initial bottom-up pre-scan would be even more useful if it worked as follows:
        • Scan text files (files with line endings) from bottom up
        • Treat lines with only unimportant differences as identical
        • Stop at first line with important differences
        • Run algorithms against files above (and including) the lines with important differences then continue through the remaining lines to complete the syntax and difference coloring of the bottom of the files.
        Last edited by Michael Bulgrien; 26-Jun-2008, 12:51 PM.
        BC v4.0.7 build 19761


        • #5
          Yes, it would take less processing time, but Tim's very big on outputting lines as soon as we can so you can start using the comparison immediately instead of waiting for large comparisons to complete.

          At some point we are going to rework the alignment algorithm, but I can't say when, other than that there are other significant items with higher priority (eg, 3-way dir merge).

          Wernight: BC already performs closeness matching to align similar lines. AFAIK, BC2 was the first commercial product to do so, and I'm only aware of one other that does it now. It's not nearly easy as you'd think it would be, especially since it has to be extremely fast. We've tweaked it some in BC3; if you have files that are giving poor results you're welcome to send them in and we can try to tweak it further.
          Zoë P Scooter Software


          • #6
            Thanks Craig,

            Originally posted by Craig View Post
            Tim's very big on outputting lines as soon as we can so you can start using the comparison immediately
            I am not suggesting a change to the default behavior, but please consider adding it as a configurable option or tweak (preferably a session setting so that it can be session-specific for certain types of files). As I said, I often have files that do not align correctly because BC3 is unaware that the bottom of the files are the same!

            Even when I put the "Line alignment" slider all the way to the right (Slow and thorough) the alignment on these files can be terribly messed up. I can't use a comparison immediately no matter how fast you output the lines if the lines you are outputting are mis-aligned.
            Last edited by Michael Bulgrien; 26-Jun-2008, 02:05 PM.
            BC v4.0.7 build 19761


            • #7
              You can always switch to the "Alternate" alignment method. That does match from both the bottom and top at the same time, so it should do a better job.
              Zoë P Scooter Software


              • #8
                Thanks Craig. I'll keep that in mind.
                BC v4.0.7 build 19761


                • #9
                  I agree that a quick view of rough changes is very useful. In fact it could even be an automatic pop-up when holding the mouse on some file in BC3 to show briefly the changes.

                  It could then progressively compare deeper (and slower) and perfect the alignment. So could be a progressive comparison/alignment either automatic or manual:
                  - Automatic: While aligning better and better, shows the result. The user can't edit until it finished. A progress bar is visible (something like Vista progress bar could be). (automatic is better)
                  - Manual: After doing a quick load like currently, a button allows to do a deeper analysis.

                  Quick alignment is good to have an idea of changes. Like quickly checking before commiting files to a repository.

                  Deeper/Accurate alignment is good for merging or making more difficult comparisons where a quick alignment wastes a lot of time trying to understand the changes (especially when merging).

                  I'm not saying it's simple but should be possible to make it fast for big files and small files by quickly finding which area should match like follow: Create map of a computed checksum of different segments of the files. I say checksum but a sum isn't the best way, "just" compute a number that changes little if the code is similar. Then when trying to align a block, look for which block has similar code in the map. Starting with the best matching blocks and then enlarging to sections before and after until the whole file is align could be a way. Just a suggestion.
                  Last edited by Wernight; 30-Jun-2008, 06:09 AM.


                  • #10
                    Center, that's base, right? left?

                    Cut me if I'm wrong, it seems to me that what is in the center, left and right can be any of the following: base, yours, mine, in any order. The order being defined mostly by the use of /favorleft and /favorright. Now that's a little bit confusing.

                    I admit having this kind of tuning is great. I just wish the default settings would be more clearly explained in the help. Something like:
                    Originally posted by Wernight
                    Without additional command-line switches, the left panel commonly holds your version of the file, while the center pane will holds the common base version and right pane holds the newer version in the repository. When there is a conflict, the left pane is favored by default. To start BC3 this way you frequently use arguments looking like: BCompare.exe %mine %theirs %base %merged. For more details you may refer to our web page dedicated to Version Control Systems.