пятница, 28 марта 2014 г.

Setting Up SemanticMerge for Mercuarial (Hg)

SemanticMerge seems to be able to change you diff/merge workflow completely. Just check it out! It’s enough to say that SemanticMerge shows you how your class members have been changed in the last commit on diff! No more ugly and stupid text comparisons, only smart semantic-oriented matches. There are only C# and Java for the moment, but it has much more to come (JavaScript and C++ are announced).
Given that I use Mercurial for about everyting I do, let’s have a look at the process of setting SemanticMerge up for popular Mercurial GUI clients: TortoiseHg and Atlassian SourceTree.


TortoiseHg is easy to be configured using mercurial configuration file. It provides easy access to this file through UI “Edit File” button in File –> Settings –> Global Settings menu:
What we need to change here:
Add next lines to the corresponding sections:
extdiff =
merge = semantic
vdiff = semanticdiff
semantic.executable = C:\Users\<UserName>\AppData\Local\PlasticSCM4\semanticmerge\semanticmergetool.exe
semantic.args=-b=$base -s=$local -d=$other -r=$output -l=csharp
**.** = semantic
cmd.semanticdiff = C:\Users\<UserName>\AppData\Local\PlasticSCM4\semanticmerge\semanticmergetool.exe
If you already have something defined in this sections, just add outined lines to every particular section.
After that save your changes, close the window with mercurial.ini file, restart your tortoisehg worbench, navigate to the same settings page and select “semantic” and “semanticdiff” as your merge and diff tools.


In SourceTree we need to perform changes under Tools->Options->Diff menu.
In External Diff/Merge section made the next changes:
Under diff command specify your SemanticMerge installation:
Please note that it seems to be a bug in SourceTree so just leave Arguments field blank: it will work OK.
For Merge set the next:
Diff command is the same, in the Arguments specify the next:
-d \"$LOCAL\" -s \"$REMOTE\" -b \"$BASE\" -r \"$MERGED\"
This command should be self-explaining.
Press OK and it should start working immediately (use External Diff button to use).

Комментариев нет:

Отправить комментарий