如何配置 BeyondCompare 以忽略注释中 SCM 替换的文本?
我确实有一些被 SCM 替换的文本序列(在我的例子中是 Perforce)。
我确实想配置 BeyondCompare 将这些序列视为不重要的差异,以便在比较文件时能够忽略它们。
在我的例子中,它是关于Python源文件的,序列看起来像
# $Id: //depot/.../filename#7 $
# $DateTime: 2010/09/01 10:45:29 $
# $Author: username $
# $Change: 1234 $
有时这些序列可以在注释之外,但即使在这种情况下,我也希望能够忽略这些行,因为它们并没有真正改变。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要定义一个新的语法元素(我们称之为“SCM”)并将其标记为不重要(请参阅此处的教程;选择“基本”并确保选中“正则表达式”)。
语法元素应该是(如果我正确解释你的例子):
这将忽略任何包含
$Id:
,$DateTime:
等的行。如果你只想忽略以
# $...
开头的行,使用如果您只想忽略
$
之间的内容(并将其他所有内容视为重要),请使用或
取决于您是否关心这些关键词与否。
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):
This will ignore any line that contains
$Id:
,$DateTime:
etc.If you only want to ignore lines that start with
# $...
, useAnd if you only want to ignore stuff between
$
(and treat everything else as important), useor
depending on whether you care about those keywords or not.
Beyond Compare 的解析器当前 (v3/v4) 不支持嵌套元素,因此如果文本已被分类为注释、字符串等,则文件格式语法不能用于将 SCM 序列标记为对特定文件类型不重要 Beyond Compare 4.0 添加了对在整个比较中将任意文本
标记为不重要的支持,与语法分开。
+
按钮。\$(Id|DateTime|作者|更改):.*\$
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.
+
button at the bottom of the Unimportant text list.\$(Id|DateTime|Author|Change):.*\$