Jaywalker
Jaywalker

Reputation: 3119

Changing File Type Once Added to CVSNT

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?

Upvotes: 2

Views: 6275

Answers (3)

nuander
nuander

Reputation: 1403

None of the suggestions here helped me but this worked

  1. backup the file
  2. in cvsnt delete the file and commit
  3. restore the file
  4. in cvsnt add the file from the command line "add -kt -- myfile.html"
  5. commit the added file

note: file type is specified with the -k switch followed by file type

Upvotes: 0

Oliver Giesen
Oliver Giesen

Reputation: 9439

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]

Upvotes: 4

Ken Gentle
Ken Gentle

Reputation: 13357

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

Upvotes: 0

Related Questions