开发者

Can bzr ignore empty lines when comparing revisions?

开发者 https://www.devze.com 2023-02-16 11:38 出处:网络
I would like to set up a bzr repository that does not require me to deal with the addition or subtrac开发者_运维知识库tion of empty lines.

I would like to set up a bzr repository that does not require me to deal with the addition or subtrac开发者_运维知识库tion of empty lines.

Is it possible to do this?

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


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'


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号