Computing > Programming

[solved] how do you compare two folders? to extract source diff

<< < (4/4)

DiTBho:

--- Quote from: SiliconWizard on July 12, 2021, 06:06:03 pm ---I would personally have still probably written tools/scripts to "preprocess" the huge amount of directories and files, and after that, I would probably have used ...

--- End quote ---

With which algorithms? and to do what?

Yesterday, while I was waiting for my license to be activated, I wrote a C program that can find "added" and "removed" files and folders, but the real problem is understanding "what" a file or folder was renamed to.

My program can index each file, and I can re-use some old A.I. algorithms to extract a "match percentage", say document X in kernel-A is probably the ancestor of document Y in Kernel-B, documents have different file-names, the match percentage is ...

"Beyond Compare" does this analysis. I don't know how it does it  :-//

AntiProtonBoy:
Total commander is also a good one for windows users.

SiliconWizard:

--- Quote from: DiTBho on July 12, 2021, 07:07:23 pm ---
--- Quote from: SiliconWizard on July 12, 2021, 06:06:03 pm ---I would personally have still probably written tools/scripts to "preprocess" the huge amount of directories and files, and after that, I would probably have used ...

--- End quote ---

With which algorithms? and to do what?
--- End quote ---

I think I said it already? First comparing files and folders, and just output the ones that are different on each side. Without trying to automatically figure out which are potential renames, and which are just completely different. Of course there are other tools that can do this. Winmerge can also do that for you. But writing your own just gives you the opportunity to list differences in the exact way that you want, and that will make your life easier. That's the whole point. Most visual diff tools will just give you a long list of differences, which, when there are many files and folders, is not necessarily the best way to deal with that.


--- Quote from: DiTBho on July 12, 2021, 07:07:23 pm ---"Beyond Compare" does this analysis. I don't know how it does it  :-//

--- End quote ---

Now if you meant - which is I guess why you asked which algorithms I would use - not just listing which files or directories are different, but also determining which are potential renames, then that's more complex of course. If Beyond Compare does this, then it can be handy. But, I was just assuming that (unless the teams working on code were completely nuts) the number of file/directory renames was likely small compared to the total number of files and directories, and thus, that presenting differences in a way most convenient for you was more important than trying to automatically determine which were renames and which were just new stuff, something that I suggested doing manually in the end.

Now if Beyond Compare does everything you want and presents things in a convenient way for you, that's all good.

DiTBho:
I'm pretty tired, I've been working on this thing non-stop for two days, let me say ... Beyond Compare is really worth all the money it costs, it's really super helpful!

It allowed me to somehow bisected and isolated 84 files which are related and differ in changes for the most; then cross-comparing things (between kernel A and Kernel B), I found 5 of them manifest several problems, which are really silly

* a PHY not correctly initialized, the eth0 was up and seemed to work, but unable to communicate with the physical layer
* a "UNIX-V" flag not correctly checked, and misspelled, this somehow passed the compile-check but then the kernel crashed as soon as it tried to mount something
* a script trying to redefine CC but in the wrong way, this dropped all the passed cflags and made the compiler to compile a couple of modules in the wrong way
* a couple of very bad bad mistakes in the DTB file, two fields appeared truncated probably due to a bad copy&paste
Really silly mistakes, I think was lucky to catch them so fast. Now I need to sweep out the garbage and all the temporary debug flags from the final trunk; I am in the process of creating a git-repo for everything, forcing my colleagues to use it.


edit:
thanks again guys  ;D

bd139:
Been there. We had a file share and the only person allowed to edit stuff on it had to obtain the wooden spoon. This was until I bought a second wooden spoon and cocked their entire process up. This resulted in us moving to SVN and proper traceable version control  :phew:

Beyond compare is excellent for mirroring directories to removable media aka backups too. Excellent tool and well worth paying for. Have been a paying customer for about 15 years now :)

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version