利用者:Brecht

提供: wiki
移動先: 案内検索

Work

Git

Using git svn to do local commits & branches. The reason I'm not cloning from the gitorious mirror is to be able to do commits to svn.

# svn checkout
git svn clone https://svn.blender.org/svnroot/bf-blender/trunk/blender
# svn update, commit (must be in master branch to do this)
git svn rebase
git svn dcommit

I have bash configured to show the git branch in terminal, to avoid the (for me) very common mistake of committing, merging or branching in the wrong branch.

__git_ps1 () 
{
    local b="$(git symbolic-ref HEAD 2>/dev/null)";
    if [ -n "$b" ]; then
        printf "%s " "${b##refs/heads/}";
    fi
}

PS1="\u@\h \[\\033[1;90m\]\$(__git_ps1)\[\\033[0m\]\W\\$ "

My workflow is to keep the master branch clean and only containing extra commits that can be committed to svn, never any work in progress stuff. For simple bug fixes I commit to master directly, for bigger changes I create branches which are then merged to master later.

Vim

Scripts:

Some useful things in ~/.vimrc

set incsearch
set hls
syntax on
set ts=4
set autoindent
set smartindent
set ruler
set history=50
set shiftwidth=4
set title
set mouse=a

if has("autocmd")
    " Restore cursor position
    au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
endif

au BufNewFile,BufRead *.cl set filetype=c
au BufNewFile,BufRead *.osl set filetype=c

let g:DirDiffIgnore = "Id,Revision"
let g:DirDiffExcludes = "CVS,.svn,.git"

Bash

Some aliases for quick cmake build from any source directory and running blender.

function cmake_make_any_dir()
{
    local prevdir=$(pwd);
    while [ ! -f ../$1/CMakeCache.txt ]; do
        cd ../
    done
    cd ../$1;
    make -j4 $2;
    cd $prevdir;
}

alias mk="cmake_make_any_dir build"
alias mki="cmake_make_any_dir build install"
alias mkd="cmake_make_any_dir debug"
alias mkdi="cmake_make_any_dir debug install"

alias bl="../build/bin/blender.app/Contents/MacOS/blender"
alias gbl="gdb --args ../build/bin/blender.app/Contents/MacOS/blender"
alias dbl="gdb --args ../debug/bin/blender.app/Contents/MacOS/blender"