Using semanticmerge to contribute to an open source project?

Email us about your project and request a FREE full license: sm@codicesoftware.com.

×

a semantic merge tool... that understands your code

  • SemanticMerge Screenshot
  • SemanticMerge Screenshot
SemanticMerge Screenshot
Mac
Preview
    • Helps you keep the code clean

      All team members can freely refactor and rearrange their code because they know they’ll be able to merge it easily with SemanticMerge

    • Helps to better understand your code changes

      It doesn’t matter if one team member refactored an entire file, while another fixed a critical bug; you’ll understand what happened when you merge with SemanticMerge!

    • Merges are based on structure, not location

      Unlike a text-based merge, SemanticMerge parses the code and extracts the structure; therefore, position changes will no longer be an issue.

    • Avoids incorrectly identified automatic merges

      SemanticMerge can detect when a method* was modified in parallel, even when no “text-block-conflicts” occur; thus enabling you to review the changes. Traditional merge tools would have identified the change as a trivial 'automatic' merge.

      * Or any other language artifact

    • SemanticMerge deals with language-specific conflicts

      Add two different “usings” clauses (C#) on two different locations
      Add the same method twice in two different locations
      These two scenarios, among others, will be automatically resolved.

    • Keeps it simple

      SemanticMerge handles structure conflicts, but will use a text-based merge to handle conflicts inside the bodies of methods, functions, properties, etc...

Xmerge Included

Initial C language support included in the Windows and Mac versions

What it does?

As programmers we always expected merge to be this way: first parse the code, then get the structure and finally merge based on that.

This way a case like the one below, a nightmare for text- based merge tools, involving methods moved to different classes and modified, becomes trivial.

What int does?

Features

Location independent method* merge

The first “mind blowing” feature in Semantic Merge allows you to move your methods around, refactor, and cleanup the code, and Semantic Merge will still be able to resolve the merge because it merges on a method-by-method basis.

File conflicts

In the scenario below, a traditional text-based merge tool will have trouble trying to match “src” and “dst”, matching “method1()” with “method2()”, since “method2()” was moved up on “src”.

Semantic Merge doesn’t really care where “method1()” is, it just knows that it has been modified by two contributors and will place the result in the correct place.

* Applies to properties, classes, methods, namespaces… it is a “structure based” merge and not text-based.

What int does?
Semantic Merge tool detects the method conflict:
File conflicts
Semantic Merge tool detects the method conflict:
File conflicts
File conflicts

Visual Merge and Diff

Our goal with SemanticMerge is to encourage teams to refactor their code without fear because the tool will be able to merge them.
To merge (and diff) efficiently you first need to understand how the code has been modified, and sometimes there is nothing better than a good graphic. And this is what Visual Merge is all about.

File conflicts

Representing the conflict visually turns a complex refactor into a trivial operation: the “Listen()” method has been moved to two different locations and also modified in parallel, isn’t it easy to understand?

What int does?

SemanticDiff also benefits from the new Visual feature:

What int does?

Tracks what has been added on a location in an independent way:

Two developers start working from “base” file and then they add a “new_method(){}” in two different locations. During the merge, a text-based automatic merge tool would incorrectly solve the conflict by duplicating the code.

File conflicts

Semantic Merge would detect this situation and let you choose the final location on the destination.

In the case where “new_method()” is not 100% identical, a “two-way” merge of the method can be run to solve the conflict.

What int does?
Semantic Merge tool handles the merge scenario as follows:
File conflicts

Dealing with language specific constructs: ‘using’ clause in C#

This is not a dramatic scenario, but Semantic Merge can still help, where two developers add the same “using” clause in two different locations.

File conflicts

Regular text-based merge tools won’t detect the fact that the added ‘using’ clause is actually the same, which would typically only be detected at the build phase. Semantic Merge detects that it is the same “using” clause and will add only one of the two clauses.

What int does?
File conflicts

Method based conflicts – even if text blocks don’t collide

This is a very common scenario for developers: imagine that the same method is modified in parallel, but the modified text blocks don’t collide.

File conflicts

It can turn out to be an unwanted automatic conflict with a text-based merge tool… Semantic Merge knows that it is the same method and can run a manual merge even if the text blocks do not collide.

What int does?
Semantic Merge detects the method conflict even when the textblocks do not collide:
File conflicts
Running “merge” shows the 3-way merge tool focused only on the conflicting method:
File conflicts

A traditional text-based merge tool wouldn’t have detected the conflict but Semantic Merge does, giving the developer a chance to review the potential issue even if the merge is set in automatic mode (non-conflicting changes set to be handled automatically).

Fully refactor aware

Suppose you move one method to an existing subclass; meanwhile, another developer moves the subclass to a different location within the file and also modifies the method you moved on the original location. Semantic Merge is able to solve the situation and generate the result with no conflicts!

File conflicts

  • 1 “class core” moved to the new location
  • 2 “method2()” moved inside “class core”
  • 3 “method2()” getting the changes made on “dst” directly

Impressive, isn’t it?

The primary advantage is that you can now enable refactoring to occur even if it happens while bug fixing or other development is being done, which means you will end up with cleaner code and it will be much easier to maintain.

What int does?
File conflicts
File conflicts

Semantic Diff included

Sometimes understanding what happened to a file is far from trivial. You run a side-by-side diff but it’s hard to really understand what was going on with the code.

File conflicts

Semantic Diff is included with the Semantic Merge package and it explains exactly what happened, even when code was moved, methods sorted, classes split, and so on.

File conflicts
File conflicts

Able to cope with divergent refactors

Suppose there is a “StrLen()” method.

  • A The first developer decides to move it to “class Format”.
  • B The second developer decides to create a new class to handle the string related methods.

File conflicts

Semantic Merge will detect a “divergent move” conflict and will let you choose between one of the two moves.

BTW: if the method was concurrently modified, it will invoke a 3-way merge as well.

What int does?
Divergent move
Divergent move

Move and delete scenarios

Let’s review a different refactor scenario

  • A The first developer moves the “StrLen()” method to the class “Format”.
  • B The second developer decides to remove the “Format” class.

File conflicts

Semantic Merge is able to detect the “move/delete” conflict, and help you resolve it. You will have the choice to keep the delete or the move.

What int does?
Move delete

Semantic Merge fallback mechanism

Semantic Merge relies on code parsing. If any of the 3 files involved in the merge can’t be parsed, Semantic Merge won’t be able to proceed. If this happens, the fallback text-based merge tool will be launched*.

File conflicts

You can also revert to text-based merge once Semantic Merge has been launched, by clicking on “run mergetool”.

Move delete

*When you run Semantic Merge you’ll need to specify a 3-way text-based merge tool to deal with text conflicts. The Semantic Merge installer includes the default’s Plastic SCM mergetool known as Xdiff/Xmerge but you can setup any tool you prefer such as KDiff3, Araxis Merge, or others.

Bonus track included in the package – Xdiff and Xmerge tools

Semantic Merge includes the text-based Xdiff and Xmerge tools that are able to deal with refactored code at a text level and hence, become the perfect companion for the structural merge provided by Semantic Merge.

File conflicts
Detect code that was moved

Xdiff and Xmerge ("cross-difference" and "cross-merge") identify fragments of code that have been moved and link them for easy navigation. They use a similarity algorithm that identifies fragments of code that have been modified within a user-specified threshold. Even if the code was moved and then changed, it's still detected as the same block of code.

When Xdiff compares two revisions, it draws a link between the code fragments. You can navigate between the fragments or display the differences between the fragments in a separate window.

Move delete
Merge refactored code seamlessly

Xmerge can detect code that was moved by one developer and modified in the original location by another. The moved code is then merged with the changes in a separate merge window, easing the process and often resolving this complex scenario automatically.

These two blog posts on Xmerge have additional information and include screencasts:

Move delete

Documentation

Success stories

    • Dirk Rombauts
    • Dirk Rombauts

      Picklesdoc

      SemanticMerge takes the stress out of merging and lets me merge with confidence....

      View more
    • Name
    • Markus Schleipen

      Just Intelligence GmbH

      PerforceMerge, which is the tool we have been using until now, is awesome, but SemanticMerge simply outperformed it.

      View more
    • Name
    • Joey Smith

      YUICompressor

      SemanticMerge has allowed me to forge ahead with more confidence in my ability to manage, manipulate, and merge the contributions from YUICompressor's...

      View more
    • Name
    • Dan Turner

      Cloud House

      We like Semantic Merge because has an excellent UI that helps to merge changes quickly by focusing on conflicts in the logic rather than wading through...

      View more

Twitter love

What's next?

Scroll

Thanks for downloading!

Your download should start in a few seconds. if it doesn't, please use direct link.

×