-1

cvsimport is missing in Centos8. Unable to install. Now I tried to use fast-import. Most of the repos it is okay but it fails with some repo which has binary files. I think there is a bug in cvs-fast-export

$ cat ../repoexport.fi|git fast-import fatal: Unsupported command:
mark :11 fast-import: dumping crash report to
.git/fast_import_crash_19654 Unpacking objects: 100% (1/1), 21 bytes |21.00 KiB/s, done.

This is from the crash report

Most Recent Commands Before Crash
---------------------------------
  blob
  mark :1
  data 30790
  blob
  mark :2
  data 7060
  blob
  mark :3
  data 30650
  blob
  mark :4
  data 516323
  blob
  mark :5
  data 355588
  blob
  mark :6
  data 497407
  blob
  mark :7
  data 4397056
  blob
  mark :8
  data 807
  blob
  mark :9
  data 299008
  blob
  mark :10
  data 196608
  blob
  mark :11
* blob

Any solution to convert cvs to git?

Mort
  • 3,379
  • 1
  • 25
  • 40
Ramanan T
  • 179
  • 1
  • 10
  • 1
    You have mismatched versions of various programs. You'll need to upgrade all of them. In particular your cvs converter is trying to make use of `git fast-import` features that are not in your `git fast-import`, presumably because your Git version is behind. (CentOS is infamous for using ancient, low-capability versions of Git.) – torek Nov 19 '21 at 05:57
  • @torek, I am using 1.59 of cvs-fast-export and gcc 2.27. Any idea of compatible versions between them? – Ramanan T Nov 21 '21 at 23:20
  • No - but if you mean *git* 2.27, that's pretty recent, so that makes this more puzzling (perhaps a bug). If you do mean gcc 2, that's practically primordial, but there is no 2.27; the last 2.2 reease was 2.7.2.3 in Aug 1997 (https://gcc.gnu.org/releases.html). – torek Nov 22 '21 at 03:27
  • My apologies @torek i meant to say my git is "git-all-2.27.0-1.el8.noarch". – Ramanan T Nov 22 '21 at 13:13
  • OK. Git 2.27 is not super-recent (current is 2.34) but probably shouldn't be missing any commands. (The error message itself seems odd too.) The last time I converted a CVS repository to Git was in the Git 1.7 era though, so I don't know what the current converters do. The symptoms you were seeing are those you'd get from using a 1.7-ish Git with any modern CVS exporter. – torek Nov 22 '21 at 21:45
  • Have you tried `cvs2git` ? – Mort Nov 24 '21 at 14:49
  • @Mort, I couldnt download because this site is down http://cvs2svn.tigris.org/. my repository is about 4.4GB and it has some binary files such as docx and zips. thats where the problem is. Is there any where I can download? and is there any clear instructions? I would accept that solution if it works – Ramanan T Nov 25 '21 at 07:27
  • @RamananT I do know actually as I updated the SO documentation about this when I couldn't find it either. https://stackoverflow.com/tags/cvs2git/info There seems to be a mirror at https://www.mcs.anl.gov/%7Ejacob/cvs2svn/cvs2git.html . I had a CVS repo that sounds similar to yours and cvs2git was able to handle it. – Mort Nov 25 '21 at 14:24
  • Thanks @Mort, the instruction is good but site:www.mcs.anl.gov doesn't provide cvs2git download or provides the link to the unavailable site :(. Is there a copy some where else? – Ramanan T Nov 26 '21 at 07:12
  • Oh, good point. It seems like this guy is hosting it on GitHub and is not adding to it, but has done some recent maintenance. https://github.com/mhagger/cvs2svn – Mort Nov 26 '21 at 12:54
  • @Mort, thanks for the link. Tried and unfortunately cvs2git also failed with this error ERROR: The command 'cvs -Q -f -d :local:/home/user/path/to/cvs/repo/proj co -r1.1.1.2.1 -p -kb scripts/additions/320_str.20070501-001101.sql' failed with exit status=-9 and no output. – Ramanan T Dec 14 '21 at 05:28
  • Oh, that's too bad. You could try that command yourself to see if the ,v file is somehow corrupted. – Mort Dec 14 '21 at 13:06
  • @Mort The file it complains is plain text and I do not see any corruption. But I notice the file is in Attic folder not in the location where the error complains. Something to do with that. Probably this is a bug on this tool – Ramanan T Dec 15 '21 at 01:06
  • The stored sql file it is a text file, but the .sq,v file is in RCS format and you would not be able to tell by inspection if it was corrupted or not. But you could fairly easily run the CVS command that cvs2git says fails and see if it fails for you when run manually. Or you could make a copy of the repo, remove that one file, and try cvs2git on that. That would also show you if that particular file is indeed a problem. I have successfully run cvs2git on repos with 15 years of history, hundreds of thousands of commits, tens of thousands of tags. – Mort Dec 15 '21 at 13:44
  • 1
    Thanks @mort, that made wonders. If it is an answer I would accept this solution. The issue is just on that file. I didn't investigate the issue but just deleted and carried on. – Ramanan T Dec 16 '21 at 07:40

2 Answers2

1

Posting solution based on comment exchange above in original question

I suggest trying cvs2git.

@RamananT says

I Tried and unfortunately cvs2git also failed with this error ERROR: The command 'cvs -Q -f -d :local:/home/user/path/to/cvs/repo/proj co -r1.1.1.2.1 -p -kb scripts/additions/320_str.20070501-001101.sql' failed with exit status=-9 and no output.

I then suggested

You could try that command yourself to see if the ,v file is somehow corrupted. The stored sql file it is a text file, but the .sq,v file is in RCS format and you would not be able to tell by inspection if it was corrupted or not. But you could fairly easily

  • run the cvs command that cvs2git says fails and see if it fails for you when run manually. Or
  • you could make a copy of the repo, remove that one file, and try cvs2git on that. That would also show you if that particular file is indeed a problem.

Thanks @mort, that made wonders. If it is an answer I would accept this solution. The issue is just on that file. I didn't investigate the issue but just deleted and carried on

Mort
  • 3,379
  • 1
  • 25
  • 40
0

Thanks to @Mort I am able to solve the issue and successfully import CVS in to GIT (BitBucket). To help anyone out there here is the exact steps. This worked on Centos 8.

  1. Copy the cvs repo that need to be migrated

    scp -r cvs_repo_server:/path/to/cvs/repo/project1 ./

  2. create CVSROOT to satisfy cvs2git tool

    mkdir project1/CVSROOT

  3. delete problematic files that fails. How you find out is running the cvs2git in further below steps. It is trial and error

    rm <project1/path/to/cvs/problematic/file,v>

  4. clone and run cvs2git

    git clone https://github.com/mhagger/cvs2svn.git

    cd cvs2svn

    ./cvs2git --blobfile=blob.dat --dumpfile=dump.dat --username=cvs2git --fallback-encoding utf-8 ../project1/

    cd ..

  5. create repo in bitbucket and then clone empty repo

    git clone bitbucket/url/mig_project1

  6. cd in to cloned repo

    cd mig_project1

  7. import into git and push it

    cat ../cvs2svn/blob.dat ../cvs2svn/dump.dat | git fast-import

    git push --all

    git push --tags

Ramanan T
  • 179
  • 1
  • 10