Category Archives: Subversion

Colorize svn diff

Install colordiff and configure Subversion's diff-cmd.

Installing colordiff

On Mac OS X, you can install colordiff using MacPorts.

$ sudo port install colordiff

On Debian or Ubuntu, you can install colordiff using apt.

$ sudo apt-get install colordiff

On other systems, you can download source tarball from http://www.colordiff.org/ and install colordiff.

Configure Subversion

~/.subversion/config

[helpers]
diff-cmd = colordiff

Execution example

$ svn diff | less -R

svn add all files except ignored files, svn del all missing files at once

To schedule all files and directories in your working copy for addition to the repository recursively, you can do it like below.

$ svn add * --force

Because svn add * can't add files which are not under version control yet in directories which are under version control, --force is needed. But in this case ignored files and directories in current directory are also added.
It also attempts to add files under version control, so many warnings show. It's ugly.

At last I found out there is no good way as long as I am using svn only.

To add all files except ignored files and delete all missing files at once, you can create an alias which filters output of svn status using grep and replaces it using sed like below.

~/.bashrc

alias svndel="svn st | grep '^!' | sed -e 's/\![ ]*/svn del /g' | sh"
alias svnadd="svn st | grep '^?' | sed -e 's/\?[ ]*/svn add /g' | sh"

It's very convenient!

Source: svn に登録されていないファイルをまとめて svn add:Goodpic
svn addがめんどくさいので | firegoby