I am having problems with our merge tool as sometimes it fails to match the unchanged blocks in the two branches correctly. When this occurs the merge tool becomes useless, and the merge has to be done by hand.
Therefore I am looking for a tool that:
- Understand what VB.NET function/method definitions looks like and gives them a high importance when matching blocks.
- Knows that VB.NET will change the case of fields etc, whenever it feels like it, and therefore ignore differences in cases when finding the common blocks, but still merges the difference in case.
- Knows that ‘ and ‘// are both start of comments and will match them when finding the common blocks
Also what other requirements have I forgotten?
(The problem we are having is that our merge tool (Guiffy part of SCM source code control system) is written in Java, so has been tested well with Java and seems to work well in “real life” with our C# code, but it does not get on us well with our VB.NET code.)
Answering the comment by Ian Ringrose
"but why can't a merge tool understand a given language?"
There is a mismatch between the concepts of having source code in text format an having code as an AST (Abstract Syntax Tree), even if there was a representation for source comments in AST.
What you are looking for, is an IDE which would store code as an AST representation in XML format. Then just any text oriented merge tool would work for you, not only a Visual Basic specialized one.
XML is the one format where merging an interpreted source makes more sence then merging the source code.
As for general practices in case sensitive languages, formatting makes sence in terms of code reviewing, reformatting the code is classified as a refactoring, and it generally must be taken into consideration in version control process.
One of the reasons for that, is that code formatting and even encoding and carriage return settings of source files actually affect the project, not only the AST generated from the code. Code could contain metadata in comments, can be processed by a runtime procedure, which could depend even on the encoding and line ending settings.
For example, an ASPNET website html output depends on the character encoding, you output could coume out garbled if you misuse it. A third party tool processing the code could fail, if it's parser can't deal with a carriage return which is considered good for Microsoft compiler.
That is why merge tools mainly treat every character change as a real change, and even whitespace makes difference, even if you have an option to ignore it.
Araxis Merge which i'm currently evluating supports Ignore Case option.
Beyond Compare may be able to do what you want. It has syntax files for all major languages, though it is a line based tool like most others. It works flawlessly on the Java source I mostly work with, but you can define your own syntax files for special file types. You might be able to add rules to do the special application-specific changes you want to make. Its integration with SVN is flawless as an interactive tool.
My only complaints are that they don't support 64 bit Linux or headless CLI operation. I would love to use this on my build server that does not have a GUI, but it is impossible due to these two issues. If anyone out there knows of a purely-CLI based merge tool that supports syntax definition I would love to hear about it.
I use WinMerge pretty much exclusively now, I find it better than the Merge in Tortoise SVN and apparently it supports VB.Net.
I don't know if it can understand field cases and so on, but it's pretty powerful, so might me worth a try.
WinMerge.
Merge tools understand files and differences in files, they do not understand languages and the differences between them.
As most languages do make a distinction between upper case and lower case variables, this is how most merge tools will work. This is also true for VB.NET key words (If, Then
are OK, if, then
are not), so even if it were to ignore case it may not work well for you.
Personally, I use the perforce merge tool (p4merge).
p4merge is pretty awesome, and is available for free at perforce.com.
I don't know if it understands VB.net well, but it is a great tool.
Many years on from me having the problem....
Semanticmerge has hit the market, it claims to
Source code diff and merge based on language parsing (C#, VB.NET, Java), designed to deal
with code that has been moved and modified.
I have not had to use VB.NET for many years, but I expect that Semanticmerge would have solved my problems.