tags:

views:

902

answers:

2

Hi,

I am using WinCVS as client and CVSNT as my source control server. Some of the files I wanted to add to my CVS repo, were added as Unicode files. Now, I want to recommit the same as ANSI (aka ASCII) files. However, despite deleting the old files from the repo, every time I add the file with the same name, it automatically assigns Unicode encoding to the file.

Is there a way out? Or in other words, can I change the encoding of a file, once it is added to CVS?

A: 

Firstly, I'd recommend using TortoiseCVS as it has better CVSNT support. Whie CVS and CVSNT are very similar, CVSNT is not CVS. TortoiseCVS Add dialog will show the file types as it guesses they are and you can override the filetype there.

For the existing situation, assuming that you don't want to keep the history of the Unicode files, you may try the following.

OK, first the warning:

THOU SHALT NOT EDIT THE CVS REPOSITORY BY HAND (unless thou art truly desperate)

Now for the instructions to break said rule, at your own risk.

  1. Make a backup of your CVSNT repository directory (simple ZIP file will do)
  2. On the client, ensure that the Unicode files are actually deleted locally and in the repository.
  3. In the CVSNT repository directory:
    1. Find the module directory where you originally added the files
    2. Find the Attic directory
    3. Delete the files and any ,v extensions of them.
  4. On the client:
    1. Verify that the files have ANSI encoding (plain ol' text files)
    2. cvs add the files again
Ken Gentle
unless this is a very old CVSNT installation, there will be no Attic folder - the Attic is only supported for backwards-compatibility when operating on a repository that was created with a server that still used it.
Oliver Giesen
there's also no need to delete repo files as CVSNT is perfectly capable of versioning changes to the file type (see my answer) - at least in any version of CVSNT that was released during the last three years or so...
Oliver Giesen
What I described works with the CVSNT releases I've used (don't have access at the moment) - can't argue with the Attic, but every CVSNT repository I've seen has them (may be migrations of older repositories).
Ken Gentle
+1  A: 

There's a couple of things that (might) come into play here:

  • you can disable automatic file type detection in WinCvs itself: go to Admin|Preferences|Globals, the option named "Supply control when adding files" - in theory you should be able to use the regular Add command from the toolbar after you have done this

  • make sure you don't have any entries in your cvswrappers (both client- and server-side) that define the file types you're adding as unicode

  • recent versions of WinCvs come bundled with a macro for adding files with a specific k-mode for the cases not covered by the WinCvs UI (look for Macros|Add|Extended Add Selection... - you should probably explicitly force it to use "Text" (aka -kt) to make sure the server performs no file type auto-detection either

  • CVSNT supports versioning of file type changes. The command sequence for this in your case would be cvs update -kt followed by cvs commit -f

  • recent versions of WinCvs also come bundled with a macro for performing the latter, it's under Macros|CVS|Change File Options

[I am the author of both of the macros quoted here so feel free to contact me if they're giving you any trouble - you can find my contact information inside the macros themselves]

Oliver Giesen
The 'force text' options won't necessarily convert Unicode to ASCII will it? UTF-16 to 7/8 bit ASCII?
Ken Gentle
The last option (Macros|CVS|Change File Type) worked for me; you are cool, dude!My text was ASCII any how and your macro was exactly what I was looking for; I don't think that the macro "actually converts the contents/ encoding of the file." Kindly correct me if I am wrong.
Jaywalker
no, they won't convert the file, they only change CVSNT's "meta data" about it which affects how it will be treated on checkout, checkin and diff
Oliver Giesen