Difference between revisions of "Developer Documents"

From BRL-CAD
(talk about mime types)
(update the mime-type example with more details and link to my config file)
Line 9: Line 9:
 
= Developer FAQ =
 
= Developer FAQ =
  
== I'm trying to add a new file to the repository and I get an error on commit about mime types.  What do I do? ==
+
== I'm trying to add a new file to the repository and I get an error on commit about mime types.  What should I do? ==
  
You either set up your subversion config to auto-set mime types or you directly set the mime type on the file before you commit the file using svn propset.
+
You should set the mime type.
  
Sean provides a copy of his Subversion config file that accounts for many mime types.  You can download and install it with this:
+
Subversion uses file mime-types for lots of useful things like for web interface browsing of the repository.  You can either set up your subversion config to auto-set mime types or you can directly set the mime type on the file before you commit the file using svn propset.
 +
 
 +
Sean provides a copy of his Subversion configuration that includes property settings for many file types.  You can download and install it with this:
  
 
  '''curl http://brlcad.org/~sean/subversion.config > ~/.subversion/config'''
 
  '''curl http://brlcad.org/~sean/subversion.config > ~/.subversion/config'''
 +
 +
Once installed, run ''svn revert'' on your new file and then add it again.  The properties should be set if the config file is installed properly and it's a recognized file type.
  
 
This problem usually looks like this:
 
This problem usually looks like this:
  
 +
[sean@bz (Wed May 28 13:27:55) brlcad]$ svn commit some_new_file.c
 +
Sending      some_new_file.c
 
  Transmitting file data ...svn: Commit failed (details follow):
 
  Transmitting file data ...svn: Commit failed (details follow):
  svn: MERGE request failed on '/svnroot/brlcad/brlcad/trunk/regress'
+
  svn: MERGE request failed on '/svnroot/brlcad/brlcad/trunk'
 
  svn: 'pre-commit' hook failed with error output:
 
  svn: 'pre-commit' hook failed with error output:
 
  /var/local/mastertree/service-svn/hook-scripts/check-mime-type.pl:
 
  /var/local/mastertree/service-svn/hook-scripts/check-mime-type.pl:
 
   
 
   
  brlcad/trunk/regress/some_new_file.c : svn:mime-type is not set
+
  brlcad/trunk/some_new_file.c : svn:mime-type is not set
 
   
 
   
 
   
 
   
Line 41: Line 47:
 
     (http://svnbook.red-bean.com/), Chapter 7, Properties section,
 
     (http://svnbook.red-bean.com/), Chapter 7, Properties section,
 
     Automatic Property Setting subsection for more help.
 
     Automatic Property Setting subsection for more help.
 +
 +
[sean@bz (Wed May 28 13:28:55) brlcad]$ svn revert some_new_file.c
 +
Reverted 'some_new_file.c'
 +
[sean@bz (Wed May 28 13:29:55) brlcad]$ curl http://brlcad.org/~sean/subversion.config > ~/.subversion/config
 +
  % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
 +
                                  Dload  Upload  Total  Spent    Left  Speed
 +
100 10810  100 10810    0    0  30099      0 --:--:-- --:--:-- --:--:-- 81278
 +
[sean@bz (Wed May 28 13:30:55) brlcad]$ svn add some_new_file.c
 +
A        some_new_file.c
 +
[sean@bz (Wed May 28 13:31:55) brlcad]$ svn commit some_new_file.c
 +
... no mime type error ...

Revision as of 12:40, 28 May 2008

Projects under active development

Developer FAQ

I'm trying to add a new file to the repository and I get an error on commit about mime types. What should I do?

You should set the mime type.

Subversion uses file mime-types for lots of useful things like for web interface browsing of the repository. You can either set up your subversion config to auto-set mime types or you can directly set the mime type on the file before you commit the file using svn propset.

Sean provides a copy of his Subversion configuration that includes property settings for many file types. You can download and install it with this:

curl http://brlcad.org/~sean/subversion.config > ~/.subversion/config

Once installed, run svn revert on your new file and then add it again. The properties should be set if the config file is installed properly and it's a recognized file type.

This problem usually looks like this:

[sean@bz (Wed May 28 13:27:55) brlcad]$ svn commit some_new_file.c
Sending      some_new_file.c
Transmitting file data ...svn: Commit failed (details follow):
svn: MERGE request failed on '/svnroot/brlcad/brlcad/trunk'
svn: 'pre-commit' hook failed with error output:
/var/local/mastertree/service-svn/hook-scripts/check-mime-type.pl:

brlcad/trunk/some_new_file.c : svn:mime-type is not set


   Every added file must have the svn:mime-type property set. In
   addition text files must have the svn:eol-style property set.
   
   For binary files try running
   svn propset svn:mime-type application/octet-stream path/of/file
   
   For text files try
   svn propset svn:mime-type text/plain path/of/file
   svn propset svn:eol-style native path/of/file
   
   You may want to consider uncommenting the auto-props section
   in your ~/.subversion/config file. Read the Subversion book
   (http://svnbook.red-bean.com/), Chapter 7, Properties section,
   Automatic Property Setting subsection for more help.
[sean@bz (Wed May 28 13:28:55) brlcad]$ svn revert some_new_file.c
Reverted 'some_new_file.c'
[sean@bz (Wed May 28 13:29:55) brlcad]$ curl http://brlcad.org/~sean/subversion.config > ~/.subversion/config
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10810  100 10810    0     0  30099      0 --:--:-- --:--:-- --:--:-- 81278
[sean@bz (Wed May 28 13:30:55) brlcad]$ svn add some_new_file.c
A         some_new_file.c
[sean@bz (Wed May 28 13:31:55) brlcad]$ svn commit some_new_file.c
... no mime type error ...