PostGIS SVN moved

Paul just announced that Subversion repository of PostGIS source code has moved to OSGeo server. The new URL of SVN is: http://svn.osgeo.org/postgis/.

Only base location of the repository has changed, so the cheapest way to switch existing working copy that points to old location of SVN is to switch & relocate:

mloskot@dog:~/dev/postgis/_svn/trunk$ svn switch --relocate \
   http://svn.refractions.net/postgis/trunk/  \

https://svn.osgeo.org/postgis/trunk

For the sake of security, I would recommend committers to use https scheme which is well supported on OSGeo server.

Juggling SVN keywords

When working in a team and maintaining large source code repositories, it’s easy to forget to set svn:keywords property for newly added file or update the property when adding new keywords to files.

The first solution that may come to once mind is to involve cron job or define post-commit hook. The former is easier to setup but may be unsafe if commits are allowed by authenticated users. The second option seems appealing as we can avoid authentication problems, but it’s generally not recommended to set properties from a hook. See warning in red frame in the Hook Scripts chapter of the SVN book.

After short discussion with folks on #gdal IRC channel, we have came to the conclusion that the easiest and safest option will be to periodically run a script fixing the svn:keywords where needed. Such script will be executed by team members on their local machines and against working copy of GDAL sources. This way we assure that the commit process is well authenticated and under human control :-)

So, here is the script – svnkeywords.sh (backed up here here):

$ ./svnkeywords $HOME/dev/gdal/_svn/trunk
Entering '/home/mloskot/dev/gdal/_svn/trunk'
Setting svn:keywords property........done.

It is quite generic and can run against any sources tree maintained by Subversion. The only requirement is Unix OS with toolset like /bin/sh, find and grep. Happy using!

Bulk svn:keywords property update

How to set svn:keywords property recursively on a set of files?

It’s easy using a couple of GNU and OpenSource utilities. Following example presents how to set the Id keyword on all C/C++ header files in sample project.

$ cd myproject

Set svn:keywords to all .h and .hpp files

$ find . -regex '.*\.h' -o -regex '.*\.hpp' | xargs svn propset svn:keywords "Id"

Commit submit property changes back to the repository

$ cvs commit -m "Set svn:keywords property on all header files."

Here is a post explaining how to set the svn:keywords property automatically using private SVN configuration file: Subversion and keyword substitution (at fixlinux.com)