Can bzr ignore empty lines when comparing revision

2019-08-18 07:23发布

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.

2条回答
Fickle 薄情
2楼-- · 2019-08-18 08:11

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'
查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-18 08:22

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.

查看更多
登录 后发表回答