How can I do a merge in Bazaar (bzr merge) that ignores whitespace?
As our team and codebase continue to get bigger, we're seeing more and more cases where Bazaar insists there's a conflict during a merge operation, but in reality it's just a minor whitespace change - which we'd like it to silently ignore.
bzr diff has --diff-options, but there doesn't seem to be a similar option for bzr 开发者_StackOverflow中文版merge.
Possible?
You can write plugins for Bazaar that provide custom merge algorithms: http://doc.bazaar.canonical.com/development/en/user-guide/hooks.html#example-a-merge-plugin http://doc.bazaar.canonical.com/development/en/user-reference/hooks-help.html#merge-file-content
I think the issue is when you merge like this the algorithm must choose one of the sides to accept. Also all whitespace changes may not be trivial like whitespace within a quoted string. It would be really nice if one can somehow configure bzr to ignore trailing whitespace changes when merging (i.e. pick the left-hand-parent when the only change is a trailing whitespace).
How I deal with this currently is to not allow checking in trailing white space using my bzr-textchecker plugin, at some point I'd like it to be able to automatically remove the trailing whitespace.
Related questions:
Can bzr ignore empty lines when comparing revisions?
Extending a version control system with custom delta algorithm
精彩评论