Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 merge.

Possible?

like image 826
Don MacAskill Avatar asked Apr 13 '11 19:04

Don MacAskill


1 Answers

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:

  1. Can bzr ignore empty lines when comparing revisions?

  2. Extending a version control system with custom delta algorithm

like image 152
AmanicA Avatar answered Sep 22 '22 14:09

AmanicA