Is there a way to prevent code comments to be marked as changes in the diffs obtained from version control? (CVS/SVN)

折月煮酒 提交于 2019-12-12 01:45:02

问题


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.


回答1:


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?




回答2:


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.




回答3:


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.




回答4:


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.




回答5:


It might come down to answering another question:

Is it useful to have versioning information like history log and file ID on the source file?



来源:https://stackoverflow.com/questions/4127980/is-there-a-way-to-prevent-code-comments-to-be-marked-as-changes-in-the-diffs-obt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!