4 ms·
Do any source control systems have filetype-aware merge algorithms? We can do something smarter when merging XML than textual line diffs.
by cpeterso 8y ago
Do any source control systems have filetype-aware merge algorithms? We can do something smarter when merging XML than textual line diffs.
- yitchelle 8y agoTotally agree. Could AI or machine learning be used for this type of application? I don't know much about machine learning, but I could imagine that it could be used to learn the programming habits of a development team and, perhaps, use it as a context for determining its merging strategies.
- makapuf 8y agoOr any language grammar, in fact.
- jpeloquin 8y agoGit can be told to use custom diff and merge drivers for particular file extensions via .gitattributes: https://git-scm.com/docs/gitattributes https://git-scm.com/docs/gitattributes For example, I have used .gitattributes to make git use MS Word to merge docx files, and LabView to merge .vi files. TortoiseGit (for Windows) includes diff/merge driver scripts for use with MS Word files.
- jharger 8y agoWhile not a source control system, the JetBrains IDEs have a very good merge tool that is filetype aware. For example, WebStorm/IntelliJ Ultimate, when merging JavaScript, often has a "magic wand" option that can detect when merge conflicts are actually resolvable if you parse both sides first, and merge the AST. It doesn't always work quite right, but it's good enough that I use it quite often.
- fowl2 8y agoPlastic SCM claims to have C#, Java, C and VB.net semantic diff. Looks pretty impressive - sad that it's proprietary! https://www.plasticscm.com/features/semantic-version-control.html https://www.plasticscm.com/features/semantic-version-control...
- WorldMaker 8y agoMy experiments showed that you can get good character-based diffs from using a syntax highlighting tokenizer. [1] It was faster than a pure character diff algorithm, but the resulting diffs/patches are interoperable, and provided quite reasonably semantic diffs on the examples I tested. Most tokenizers are great too because they tend to operate very well with work-in-progress code or broken/edge-case code (because they are the same sorts of tools we use in our editors). I've not seen someone actually use it for source control, but the core idea is simple enough for the taking. [1] https://github.com/WorldMaker/tokdiff https://github.com/WorldMaker/tokdiff