List Info

Thread: non text/* mime-types




non text/* mime-types
user name
2007-02-07 19:18:13
I converted a rather large cvs repository with cvs2svn-1.5.0
over the
weekend and was very please with the performance and
features.

However, today someone noticed that they couldn't do svn
blame on a
tcl file.  A little Googling revealed that this is a well
known
problem.  svn:mime-type's that don't begin with test/ get
treated as
binary files.  That includes tcl and xml files in the
normal
/etc/apache2/mime.types files.

My two suggestions are:
1) Document this issue in the cvs2svn-example.options file
at the very least and
2) Provide a decent cvs2svn mime-types file with text/x-tcl
and
test/xml, etc. already defined.

I am planning to do a dump | filter | load to fix everything
in the
repos, rather than just fix the HEAD's of specific trunks
and
branches.  I added the simple script below.

Thanks again for the tool.


==========================================
#!/usr/bin/env python
# filter svn:mime-type's in an 'svnadmin dump' data stream
and reoutput it
import sys

TCL_MIME_TYPE = "text/x-tcl"
TCL_MIME_TYPE_LEN = len(TCL_MIME_TYPE)

XML_MIME_TYPE = "text/xml"
XML_MIME_TYPE_LEN = len(TCL_MIME_TYPE)

fin = sys.stdin
fout = sys.stdout

while True:
    line = fin.readline()
    if line == '':
        break
    #print line
    if "svn:mime-typen" == line:
        fout.write(line)
        value_size = fin.readline()
        value_str = fin.readline()
        if value_str == "application/x-tcln":
            fout.write("V %dn" %
TCL_MIME_TYPE_LEN)
            fout.write("%sn" % TCL_MIME_TYPE)
        elif value_str == "application/x-xmln":
            fout.write("V %dn" %
XML_MIME_TYPE_LEN)
            fout.write("%sn" % XML_MIME_TYPE)
        else:
             fout.write("%s" % value_size)
             fout.write("%s" % value_str)
    else:
        pass
        fout.write(line)

------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribecvs2svn.tigris.org
For additional commands, e-mail: users-helpcvs2svn.tigris.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )