open source basecamp

 
Blog

Posts Tagged ‘bzr’

Resolve conflicts with vimdiff

Wednesday, March 18th, 2009 by Marc Fournier

When several people work on the same set of files, for instance puppet recipes , conflicts happen now and then:

marc@lonquimay:/tmp/puppetmaster$ bzr merge -q
Text conflict in modules/mysql/manifests/classes/server.pp

As every decent machine has vim installed, you are only one step away from resolving these conflicts in a comprehensive and colorful way. Just type:

vimdiff modules/mysql/manifests/classes/server.pp.{THIS,OTHER}

Vim will open both files, splitted in the same window:

vimdiff screenshot

As usual with splits, you can switch back and forth with CTRL-W CTRL-W. Now position the cursor on one of the conflicting lines. Then type do to "obtain" the code block from the other file or dp to "push" it to the other file. You can of course edit any of the files as usual.

That’s it, don’t forget to bzr resolve the conflict !