views:

138

answers:

2

I do have some text sequences that are replaced by the SCM (Perforce in my case).

I do want to configure BeyondCompare to consider these sequences as unimportant differences in order to be able to ignore them when I compare files.

In my case it's about Python source files and the sequences are looking like

# $Id: //depot/.../filename#7 $
# $DateTime: 2010/09/01 10:45:29 $
# $Author: username $
# $Change: 1234 $

Sometimes these sequences can be outside comments, but even in this cases I would like to be able ignore these lines because they are not really changed.

A: 

There used be a Compare By Rules options where you could say that comments were Unimportant Differences, however I just checked my version (3.1.9) and Compare By Rules seems to have been removed? At least, I cannot find it. What version are you using?

James
+4  A: 

You need to define a new grammar element (let's call it "SCM") and mark it as unimportant (see the tutorial here; choose "Basic" and make sure to check "Regular Expression").

The grammar element should be (if I interpret your examples correctly):

^.*\$(Id|DateTime|Author|Change):.*$

This will ignore any line that contains $Id:, $DateTime: etc.

If you only want to ignore lines that start with # $..., use

^\s*#s*\$(Id|DateTime|Author|Change):.*$

And if you only want to ignore stuff between $ (and treat everything else as important), use

\$[^$\r\n]*\$

or

\$(Id|DateTime|Author|Change)[^$\r\n]*\$

depending on whether you care about those keywords or not.

Tim Pietzcker
I know that there is a small probability to mistake but aren't we supposed to ignore only the text between the $ signs on these lines?
Sorin Sbarnea
In your examples, the lines only consist of text between `$` signs, preceded by a comment `#` which you said was not always there (although I can hardly imagine that). Can you provide more examples?
Tim Pietzcker
Yes, I found code with `print("My version is $Change$ ")`.
Sorin Sbarnea
OK. I edited the answer. Hope I understand your requirements now.
Tim Pietzcker