tags:

views:

456

answers:

3

In order to take in account Richard's comment and Steen's answer of I have to specify independently of type mime file and independently of the type file marked in CVS, I am looking for how to treat all files as binary file in cvs2svn ? Perhaps is not possible ?

Please Richard (or others), may you tell me how to know the marked type in CVS for a given file ?


Hello, How to treat all files as binary file ?
All 16 pass (of cvs2svn) are correctly done but several binary files are corrupted (like .gif). There are not treated as binary file!

The command line I used is:

python C:\noinstaller\cvs2svn-2.2.0\cvs2svn -s "SVN_REPO" "CVS_REPO" --use-cvs
--encoding=latin1 --mime-types=svn-mime-types --eol-from-mime-type 
--keywords-off --sort=C:\noinstaller\UnxUtils\usr\local\wbin\sort.exe

After the reading of the CVS2SVN FAQ, I had tried many other options, but same the same file are always corrupted.

Thanks. Christian.

+4  A: 

Subversion use a heuritic algorithm to determine whether a file is binary or not. Firstly, it checks if the mime-types-file configuration parameter is set and uses this to map files to mime-types. If not such configuration is found, it looks at the 1024 first bytes, and if more than 15% are not within ASCII range or any of them are null values, the file is considered binary. To specifically set a mime-type of a given file-type, you must use auto props.

Please note that if subversion determines your file to be of mime-type image/x-xbitmap or image/x-xpixmap, it will be treated as a text file

Auto-props affect the svn add and svn import actions and are set using the runtime configuration, which are specified through either command line options or in the config file for subversion, found in the subversion installation conf directory. The following values should be set:

# default is 'no', so we enable auto props with
enable-auto-props = yes

# specify absolute path to mime.types like file, e.g.
mime-types-file = /etc/mime.types

This should map your binary files correctly.

EDIT: From the cvs2svn manual:

--auto-props=FILE

Specify a file in the format of Subversion's config file, whose [auto-props] section can be used to set arbitrary properties on files in the Subversion repository based on their filenames. (The [auto-props] section header must be present; other sections of the config file, including the enable-auto-props setting, are ignored.) Filenames are matched to the filename patterns case-insensitively, consistent with Subversion's behavior. The auto-props file might have content like this:

[auto-props]
*.txt = svn:mime-type=text/plain;svn:eol-style=native
*.doc = svn:mime-type=application/msword;!svn:eol-style

So, using the command line switch --auto-props and an auto-props file, you should be able to get the wanted functionality of the cvs2svn script

Steen
I work with brainkiller, and I thank you for your answer (+1 by the way). However it seems the problem is within the mime-types-file option: out "mime-types" file does not appear to be taken into account. If it was, we could make sure everything is treated as binary.
VonC
+3  A: 

As to the question of how to have cvs2svn treat all files as binary, I can only point to the section in the FAQ relating to EOL

Starting with version 2.0, the default behavior of cvs2svn is to treat all files as binary except those explicitly determined to be text.

Also from the FAQ:

If a file is marked as binary in CVS (with cvs admin -kb, then cvs2svn will always treat the file as binary.

To see if a file is marked as binary, look for the -kb option on the file in CVS. In WinCVS, there are columns for this as well as Encoding.

Unfortunately, I don't have a solution for you, but I would try and simplify your command arguments to focus on what exactly isn't working right for those files. Using an --auto-props file will give you ultimate control over each file. If your CVS file is "clean" (meaning all files are properly committed as text and binary), the --default-style=native parameter supposedly gives the best results.

Good luck and let us know what works for you.

Richard Morgan
Thank you Richard, and +1 for those pointers. Brainkiller and I are looking into it right now. One issue is that we cvs2svn on a Windows platform, from a CVS repo from Unix...
VonC
@VonC: Funny, I am in the process of doing the same thing. CVS on Unix -> SVN on Windows. Unfortunately, SOX prevents me from touching the systems so I can't experiment with you. At any rate, our binaries are working fine using --default-style=native.
Richard Morgan
@Richard Morgan: are you using the python-script cvs2svn in 2.2.0 version ?
VonC
@VonC: actually, I think it's just 2.0. Looks like I should investigate upgrading. Thanks.
Richard Morgan
Thanks for your advices
TaintedLove
+1  A: 

I deduce it is impossible to force cvs2svn to consider all files as binary file.

TaintedLove
Sorry you're having no luck; here's yet another post that help http://markmail.org/thread/iup7e3kdhsurgvja
Richard Morgan