views:

253

answers:

1

I finally found an answer to my question when I wanted to post it! However I'll still post it, including my answer, in case it helps someone else:

When converting from CVS to Subversion cvs2svn failed on some files with the message

"xxx is not a valid ,v file"

What's the problem?

+1  A: 

As it turns out CVSNT omits the last 0xa from some files where cvs2svn needs them. This can be easily fixed with the following c# code:

static void Main(string[] args)
{
  foreach (string file in Directory.GetFiles(args[0], "*,v", SearchOption.AllDirectories))
  {
    using (FileStream sin=File.Open(file, FileMode.Open, FileAccess.ReadWrite))
    {
      sin.Position=sin.Length-1;
      if (sin.ReadByte()==0x40)
      {
        Console.WriteLine("fixed "+file);
        sin.WriteByte(0xa);
      }
    }
  }
}
chris