|
Michael Robbins wrote:
>
>
> I'd like to do a little work with the output of a file comparison
> program. MATLAB's version is called "File Comparison Report" and
> it
> makes something labeled "File Difference."
>
> An aside here, TMW should call them both the same name.
>
> Anyway... I want to take the data and do some automated parsing on
> it. I'd like a list of changed lines, words, etc. Ideally, a
> structure like the one PROFILE makes would be great!
>
> If I could get output from a differencing program, like File
> Comparison Report, I could use it. I guess I could parse the "File
> Difference" screen since it has pretty convenient output. The line
> numbers are there and the columns have '<', '>', '.' and 'x'
> to
> identify the comparison--which is all I really need to identify the
> lines in question. Unfortunately, the lines are truncated which
> means
> I'd have to go to the original files and look up the actual text.
>
> It's doable and I will do it if I don't find an easier, better, or
> already-done solution.
>
> Any ideas are welcome.
>
> TIA
I started with visdiff.m, which is the mfile that controls the file
differences stuff in matlab. This is really nothing more than an html
constructor. (So I use this instead of trying to undo the actual
html... full lines of code are stil preserved here...) But it does
handle the output from diffcode.m, which does the actual comparison
of the 2 files provided. (Incidentally, visdiff also prepends a blank
line to the output of diffcode. This is the key to getting a correct
comparison.)
I'm working on something similar. I had some concern about others
editing my mfiles (tired of looking through thousands of lines of
code for something wrong). I looked into source control software, but
decided that I wanted something that the users wouldn't have to
interact with on any level. (Because my users would view that as a
hassle...) So I decided the easiest route to take would be to
overload the edit.m function, and am now generating reports on what
has changed over time. (The end goal is to use the report to
automatically "undo" any changes made - back to the original file.)
I'm not quite done with the project yet; but it sounds like you would
like something similar to what I've done. I'd be happy to share what
I have thus far if you're interested...
hth
-quo
|