I see there are commercial apps to do this for a fee, but Is there an open source utility program available to do this file / folder / or module line-by-line comparison between two similar Arduino sketches that will simply highlight the differences it finds in the code and/or comments?
WinMerge
Open a parent folder in Visual Studio Code or VSCodium. Right-click the first file and click “Select for compare”, then right-click the second file and click “Compare with selected”.
Old school: diff
Cygwin for Windows
Terminal for OSX
a7
I'll try it.. Thanks
I'll see if I can find this and try it too.. Thanks
It's already built-in on Windows.
Open a cmd window
cd to the folder with the files
enter:
fc file1.ino file2.ino
Gosh, this looks too good to be true.. it's exactly what I was hoping for.. but might be overkill for a nubie like me.. I'll try it tho.. Thanks very much
Really? Ok sure... I'll definitely try this but I'm pretty clumsy at doing almost anything on the command line
Hi You replied 1st so I've installed WinMerge and it seems very straightforward and easily does the line by line compare and highlighting between the Selected and the Compare with Selected as files 1 and 2 and I like the simplicity but don't see a way to compare more that the 1st Tab of .ino source code. Is there a way to make WinMerge compare two complete sketches that have identical Tabs?
Maybe it's worth trying NPP (Notepad++) - there is a plugin for smart file comparison.
I have Notepad++ and use it but was unaware of the Plug-in .. I will get it and try that too.. Thanks
Probably.
I installed the "compare" plug in and found it's very easy to navigate to the individual .ino , or .h , or .cpp files in each tab within the sketch and do the file compare which then shows code moves and difference comparisons in all the lines of comments or code easily. I think I'll stick with NPP for a while mostly since it was so easy to use compared with the other perhaps more powerful alternatives. others kindly subtitled.
I'm assuming I can edit these files within this NPP app right?
Can I also launch the arduino compiler from in NPP too?
or, perhaps it's best to close out of NPP and launch Arduino on the newly edited version like I normally do. Which?
Sure. Just do this:
- Select File > Open from the WinMerge menus.
- Select the folder of one of the sketches in the "Left" field of the "Select Files or Folders" menu.
- Select the folder of the other sketche in the "Right" field of the "Select Files or Folders" menu.
- Click the OK button.
Sounds awesome .. I’ll try it . thanks
I have been trying to migrate to using all cross-platform applications recently and I do use the VS Code "Compare Selected" feature and diff
from the command line quite a bit. However, I still find myself going back to WinMerge from time to time. It is a nice application.
VS looks really amazing , I haven’t scratched the surface of what it can do but saw right away that I’ll need to watch the tutorial
Videos and invest more time learning it ..to be able to use it. I really like the color coding and formatting it appears to do.
Does it have a debugger for Arduino C/C++ code in it?
“Visual Studio” != “Visual Studio Code”, they are two completely separate pieces of software.
Yes, you can either use something like GDB and OpenOCD manually, using VSCode as the debugger frontend, or use PlatformIO to configure all of that for you.