添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
好帅的扁豆  ·  fabricjs ...·  8 月前    · 
完美的砖头  ·  jQuery 尺寸 | 菜鸟教程·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

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 Sep 6, 2010 at 14:59

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]*\$
\$(Id|DateTime|Author|Change)[^$\r\n]*\$

depending on whether you care about those keywords or not.

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 Sep 6, 2010 at 17:59 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 Sep 6, 2010 at 18:09 I cannot get this to work. It seems that the comment grammar rule picks it up before the custom grammar. Is it possible to mark SCM element changes inside a comment as unimportant, while comment changes in general are still important? – Tor Klingberg Jun 20, 2014 at 9:59

Beyond Compare's parser doesn't currently (v3/v4) support nested elements, so file formats grammars can't be used to mark an SCM sequence as unimportant for a specific file type if the text is already classified as a comment, string, etc.

Beyond Compare 4.0 added support for marking arbitrary text as unimportant across an entire comparison, separate from the grammar.

  • Load the files you're interested in
  • Click the Session Settings button (aka Rules w/ umpire icon) or use the Session->Session Settings menu item.
  • Switch to the Importance tab
  • Click the + button at the bottom of the Unimportant text list.
  • Add the plain text or regular expression to Text to find edit and check the Regular Expression checkbox if necessary. In this case the regular expression would be:
    \$(Id|DateTime|Author|Change):.*\$
  • Click Ok.
  • By default these changes will only affect the current comparison. You can change the combobox at the bottom of the Session Settings dialog from Use for this view only to Also update session defaults to make it affect all future comparisons for all file types.
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.