Can bzr ignore empty lines when comparing revisions?

丶灬走出姿态 提交于 2019-12-13 02:50:00

问题


I would like to set up a bzr repository that does not require me to deal with the addition or subtraction of empty lines.

Is it possible to do this?

Are there any potential disadvantages? My code is in R and bash.


回答1:


When comparing repositories or revisions using bzr diff, you can use diff-options to pass options through to the standard UNIX diff command.

I've been unable to find a way to handle whitespace changes (tab to spaces, or spaces to tabs) gracefully. I've also been unable to find a way to handle any sort of whitespace changes when performing a merge.

//show the difference between two revisions, omitting whitespace-only changes.
cd my_repo
bzr diff --diff-options='-w' ../my_other_repo

or

//show changes from 451 through 455, omitting whitespace-only changes.
bzr diff -r450..455 --diff-options='-w'


//this is what I use for doing quick code reviews (no whitespace, 15 lines of context)
bzr diff --diff-options='-w -U 15'



回答2:


Maybe one of the following solutions can be implemented:

1) Write a plugin that provides a custom merge algorithm that ignores such differences, using a merge hook. Every installation that does merges will need the plugin that does this. I can provide more pointers on how to do this if you are interested.

2) Write a plugin that uses a content filter to strip redundant empty lines when committing. Not really what you want though.



来源:https://stackoverflow.com/questions/5274210/can-bzr-ignore-empty-lines-when-comparing-revisions

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