Exploring SVN Properties: MIME-Type and Keyword Substitution

‘Properties’ in Apache Subversion are a valuable way of associating metadata with versioned files or directories. In this SmartSVN tutorial, we’ll explore some of the Subversion internal properties in greater detail, before showing you how to remove a property.

MIME Type

The ‘svn:mime-type’ property indicates a file’s MIME type and allows the client to decide if contextual merging is safe during updates. SmartSVN automatically determines the coarse MIME-type of a new file, but in certain cases you may want to change SmartSVN’s assignment using the svn-mime-type property.

To set the MIME type property in SmartSVN:

1) Right-click the file where the svn:mime-type property will be set, and select ‘MIME-Type..’ from the ‘Properties’ menu.

2) In the subsequent ‘Change MIME-Type’ dialog, you can choose from the defaults ‘Text’ or ‘Binary’ type. Alternatively, define a ‘Custom’ type by explicitly specifying the corresponding MIME-type, for example image/jpeg, application/pdf etc.

3) By default, SmartSVN checks whether MIME-Types are well-formed, and not arbitrary strings. If you want to disable this check, select the ‘Force’ option.

4) Select ‘OK’ to go ahead and apply this new property.

Keyword Substitution

Subversion has the ability to substitute ‘keywords’ into the contents of a file itself. These keywords are useful for automatically maintaining information (such as author, revision number, etc.) that would be too time-consuming to update manually.

Note, the Keyword Substitution property can only be applied to text files.

1) To activate keyword substitution, right-click on the file in question and select ‘Keyword Substitution…’ from the ‘Properties’ menu.

2) In the ‘Change Keyword Substitution’ dialog, choose from a list of supported keywords:

Author – the username of the person who created the revision.
Date –
the UTC the revision was created (note, this is based on the server’s clock not the client’s.)
Revision –
describes the last revision in which the selected file was changed in the repository.
ID –
a compressed combination of the keywords ‘Author,’ ‘Date’ and ‘Revision.’  
URL –
a link to the latest version of the file in the repository.
Header –
similar to ‘ID,’ this is a compressed combination of the other keywords, plus the URL information.

You can choose to ‘Unset’ or ‘Set’ each keyword. The ‘Don’t Change’ option maintains the current substitution from the keyword.

Deleting a Property 

Once you start working with Properties in Subversion, sooner or later you will need to remove properties. To set or delete a property to multiple files or directories:

1) Open the ‘Properties’ menu and select ‘Set or Delete Property.’

2) Open the ‘Property’ drop down menu to see the available Subversion internal properties.

3) Select the Property you wish to remove. In this example, we’ll remove all explicit mergeinfo from our project. To achieve this, select ‘svnmergeinfo’ and select the ‘Delete Property’ checkbox.


4)
Select ‘OK’ to remove the mergeinfo.

Remember, you can download your free edition of SmartSVN Foundation at http://smartsvn.com/

0 Responses to “Exploring SVN Properties: MIME-Type and Keyword Substitution”


  • No Comments

Leave a Reply