Multi-line comments

Support for our DiffMerge utility.

Moderator: SourceGear

Post Reply
mruptown
Posts: 2
Joined: Thu Jun 04, 2009 7:30 am

Multi-line comments

Post by mruptown » Thu Jun 04, 2009 8:13 am

Howdy DiffMerge!

Long time listener, first time caller. Great product.

I'm currently attempting to diff two large codebases and would like to exclude/ignore ALL comments (Java, XML, HTML). This includes multi-line comments.

I have the following entries all "unchecked":

Tools -> Options -> Rulesets -> (File-type-of-choice) -> Edit... -> Content Handling -> (Appropriate "Comment" entry) -> Edit... -> "Classify Differences As Important"

Can't seem to get multi-line comments ignored. Advice would be most appreciated!

Thanks,

Joel

Pertinent info:
Ubuntu Linux 9.04 64-bit
DiffMerge Version: 3.3.0 (1001)

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Multi-line comments

Post by jeffhostetler » Thu Jun 04, 2009 10:10 am

Do single line comments get ignored properly?

You might check in the Edit Context dialog and make sure that
you have the start and end patterns set and that "Ends at EOL"
is turned off.

jeff

mruptown
Posts: 2
Joined: Thu Jun 04, 2009 7:30 am

Re: Multi-line comments

Post by mruptown » Thu Jun 04, 2009 10:56 am

Yep, the EOL checkbox is unchecked as well. Still not ignoring multiline comments. Finding multiline comments in files is actually quite complicated ( http://ostermiller.org/findcomment.html ). Is there a spot where I can enter in a full regular expression for DiffMerge to ignore? If so, what regular expression syntax does DiffMerge use?

Would attaching sample files be useful?

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Multi-line comments

Post by jeffhostetler » Fri Jun 05, 2009 11:19 am

We had to reload the forum db from a backup and lost a few messages
on this thread.

The last post before the loss asked about multi-line patterns
in the lines-to-omit feature. Yes, the lines-to-omit only does one-line pattern
matching with the regex. (You can optionally ignore n lines following it for
something like page/column headers in a report, but that's different.)

If you were comparing 2 large folders of files and wanted to ignore the
$Revision$ lines, I'd use the lines-to-omit feature. It'll still show the other
comment changes as differences.

I think you said that you just had 2 large files and wanted to scan them
while ignoring all comments. In this case, I'd try to get the more complete
comment syntax regex working as described in the link you referenced.
Then turn on the hide-unimportant changes. If all goes well, the summary
counts at the bottom of the screen should be just the code changes.

If you had other questions that I haven't addressed, please repost them.

thanks
jeff

hartwig192
Posts: 1
Joined: Thu Oct 08, 2009 2:53 am

Re: Multi-line comments

Post by hartwig192 » Thu Oct 08, 2009 3:08 am

Hi,
I tried the option to mark comments in c source files as important/unimportant. This is very useful, when comparing single files.
But is there a way to use this option to ignore comments when comparing directories?

The problem for me is, that only files with differences in the source code (not the comments) should be displayed as different. I would like to have files with differences in the comments, but not in the code, to be displayed as equivalent, like it is done for differences in e.g. the number of blanks.

Example:

Code: Select all

// comment
int test(int i)
{
    return (i + 1) // increment
}

Code: Select all

// another comment
int test(int i)
{
    return (i + 1) // increment value
}
2 Files containing these code should be treated as equivalent.
The omit lines option is not well suited since a comment may appear at the end of a source code line.

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Multi-line comments

Post by jeffhostetler » Fri Oct 09, 2009 9:50 am

Currently, no. Sorry.

It'd be nice for folder windows to be able to make use of the Content Handling
settings (important/unimportant for literals vs comments), but it currently doesn't.
I didn't do it because it'd make the folder window even more sluggish than it is now.

j

Post Reply