copy from https://gitorious.org/fromcvs/fromcvs/source/184311d27b7da36665f74bf05ee95858e9f8b9b9: