Archive for the 'Development' Category

Subversion and keyword substitution

Monday, July 24th, 2006

Last year I migrated a large CVS repository over to Subversion. One of the issues I missed during the migration was that unlike CVS, Subversion did not automatically set new files to expand keywords such as $Id$ to the very useful string:

$Id: MySpecialClass.java 12234 2004-05-21 00:23:08Z derek $

I did some research into the problem and unfortunately there wasn’t anything on the server side I could do to force this setting on all files as they are added and checked in to the SVN repository. To automatically enable keyword substitution you must do two things.

First, uncomment the enable-auto-props = yes line in ~/.subversion/config in each users home directory.

### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes

Then you must configure the file types to which you will apply keyword substitution:

### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL

I appended ;svn:keywords=Date Author Id Revision HeadURL to the entry for .c files in ~/.subversion/config. Uncomment other file types in the file and adjust them as needed. Feel free to add new lines to the file for other source files such as .php and .java. These settings will take effect for all new files that you add to the repository.

If you happen to have existing files in the repository that need to have the keyword property set you can set it by running the svn propset svn:keywords “Author Date Id Revision HeadURL command.

svn:keyword documentation

How to Look Like a UNIX Guru

Tuesday, February 7th, 2006

http://www.cs.usfca.edu/~parrt/course/601/lectures/unix.util.html

Here’s a very useful set of instructions that every developer that deploys on unix/linux should know.

“If you want to be a serious server developer, you will need to have a certain facility with a number of UNIX tools; about 15. You will start to see similarities among them, particularly regular expressions, and soon you will feel very comfortable. Combining the simple commands, you can build very powerful tools very quickly–much faster than you could build the equivalent functionality in C or Java, for example.”

My favorite of all the commands mentioned is rsync. I use it daily to move things around between servers and even on the same machine. I’ll discuss rsync and how I use it later.