Tuesday, May 1, 2012

bugs-everywhere with msysgit

[UPDATED 2013-05-30] Read about how I installed BE in a virtualenv.

Bugs-everywhere (BE) is kind of neat idea - keep the bugs in your repo.

On MS Windows to get the editor to work for BE comments you need to add a Windows path to an editor since it calls Python's os.system, and not a shell command. If you are using msysgit this can conflict with git since it will read $EDITOR and execute it as a shell command.

To circumvent this, add $GIT_EDITOR which is read by git before $EDITOR. See git-var.

This is easily done if you've set up BE in a virtualenv and especially easy if you have virtualenvwrapper. Either way add to the script file.

postactivate/activate for virtualenvwrapper/virtualenv

# reset git var to vi, GIT_EDITOR is read before EDITOR
export GIT_EDITOR=vi
# set bugs-everywhere EDITOR to vim
# must use windows path since it calls os.system
export EDITOR=\"\"%PROGRAMFILES%\\Git\\share\\vim\\vim73\\vim.exe\"\"
predeactivate/deactivate for virtualenvwrapper/virtualenv

# remove bugs-everywhere EDITOR
unset EDITOR
# remove git var GIT_EDITOR
unset GIT_EDITOR
note that you need double quotes around the Windows path because it get's expanded twice.

Fork me on GitHub