[Discuss] Any Subversion geniuses out there?

Edward Ned Harvey blu at nedharvey.com
Fri Dec 2 08:11:43 EST 2011


> From: discuss-bounces+blu=nedharvey.com at blu.org [mailto:discuss-
> bounces+blu=nedharvey.com at blu.org] On Behalf Of Matt Shields
> 
>  What I was wondering is it possible in Subversion when a changeset is
> being committed that a hook could be used to change the mime-type.  So if
> the file being committed is a *.sql, then it would override whatever
> mime-type the client is saying and apply text/x-sql.

This question will be best answered by the subversion-users mailing list, 
http://subversion.apache.org/mailing-lists.html
but let's see what we can say about it here.

The mime type, I believe, is determined by the svn client, and it's
determined by file contents.  What do you get, if you run linux "file" on
the file?  What do you see if you try to open the file in vim or emacs?  

I'm sure you can change the mime-type as a precommit or postcommit hook
(probably best precommit) but I'm almost equally sure that it's not what you
want to do.  When they detect the contents and select a mime type, the
reason they're doing it is because svn internally employs all sorts of diff
and compression algorithms, to optimize both the network traffic and disk
storage.  If you go overriding the mime types against its natural wishes,
you run the risk of ...  Suboptimizing performance.  Is probably the
diplomatic way of saying effing everything up.

Another option you might consider, I believe, is that they have a mechanism
of some kind to allow you to inject a custom client-side diff utility for
certain files or mime types or something like that.  You might configure it
so that your client doing the diff might run something like the SQL
equivalent of "dos2unix" to convert a file format and then diff it, or
something like that.  Of course the odds of success doing this are
diminished by trac.  You might just have to use something like tortoisesvn
or whatever to perform these diffs.

In fact, tortoisesvn does some pretty excellent diffing.  What happens if
you try diffing with tortoise?




More information about the Discuss mailing list