有没有办法防止代码注释被标记为从版本控制获得的差异中的更改? (CVS/SVN)

发布于 2024-10-01 01:45:23 字数 102 浏览 2 评论 0原文

有没有办法防止代码注释被标记为从版本控制获得的差异中的更改? (CVS/SVN) 我讨厌显示 100 个更改的差异,而实际上由于 CVS 信息(如日志或 id)的注释中的更新而只有少数更改。

Is there a way to prevent code comments to be marked as changes in the diffs obtained from version control? (CVS/SVN) I hate the differences showing 100's of changes when there are only a handful due to the update in the comments for CVS info like log or id.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

万人眼中万个我 2024-10-08 01:45:23

您怎么能期望源代码控制系统存储文件的新版本,然后忽略它已存储新版本的事实呢?

How could you expect a source control system to store a new version of the file and then ignoring the fact it has stored a new version?

十雾 2024-10-08 01:45:23

注释本身将被视为更改 - 但是,您可以在提交到主干之前通过某种代码美化器运行代码(根据您自己的规则删除注释或其他内容),然后主干之间的差异将仅显示代码更改,而不是比上面的评论还要多。

Comments themselves would be counted as changes - however you could run the code through a code beautifier of sorts (to remove comments or other things according to your own rules) before committing to trunk, and then the diff between trunks would only show code changes rather than the comments on top of it.

多情癖 2024-10-08 01:45:23

我不这么认为。因为 SVN 不/无法理解文件中的内容。它只是向您显示文件中的内容。

I dont think so. Because SVN doesn't/can't understand what is into a file. It just show you what is into the file.

全部不再 2024-10-08 01:45:23

我使用像 Beyond Compare 这样的 diff 程序,它可以忽略空格和注释更改,但仅限于进行 diff 时。但是,如果文件确实发生了更改,那么大多数 vcs 都会将其列在其更改列表中。在 SVN 中,您可以设计一个提交钩子,根据您的规则检测 chagne 是否“重要”。如果 chagne 不是,那么它可以拒绝提交。

I use a diff program like Beyond Compare that can ignore whitespace and comment changes, but only when doing diffs. However if the file actually changed, then most vcs would list that in their changelist. In SVN you could engineer a commit hook that detects if a chagne is "significant" according to your rules. It could then reject the commit if the chagne is not.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文