Is there a migration tool from CVS to Git?

前端 未结 12 1803
栀梦
栀梦 2020-11-27 13:34

I intend to switch over from CVS to Git. In the case of SVN, there seems to be cvs2svn. Is there a similar tool to easily migrate from CVS to Git?

相关标签:
12条回答
  • 2020-11-27 13:53

    I read the answer by Vanuan and mhagger's comments to it. Unfortunately mhagger didn't post how to do it with cvs2git. It is all very well written up here: http://www.mcs.anl.gov/~jacob/cvs2svn/cvs2git.html

    I used cvs2git instead of git-cvsimport because the documentation of git-cvsimport suggests to use it instead to avoid the problems of git-cvsimport: https://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html#issues

    It follows essence of it that worked for me to create a git repository from a sourceforge CVS repository on Debian Sid:

    $ apt-get install cvs2svn cvs
    $ mkdir project.cvs
    $ rsync -av rsync://${PROJECT}.cvs.sourceforge.net/cvsroot/${PROJECT}/ project.cvs
    $ cvs2git --blobfile=git-blob.dat --dumpfile=git-dump.dat --username=cvs2git project.cvs
    $ mkdir project.git
    $ cd project.git
    $ git init
    $ cat ../git-blob.dat ../git-dump.dat | git fast-import
    

    The rsync step is needed because cvs2git needs access to the whole history. A simple checkout is not enough.

    0 讨论(0)
  • 2020-11-27 13:54

    I found cvs-fast-export did an excellent job. I had to download and compile it myself, but didn't have any significant issues doing so.

    0 讨论(0)
  • 2020-11-27 13:57

    I've tried cvs2git, git-cvsimport and parsecvs.

    cvs2git sometimes (as far as I remember) creates bogus branches for tags.

    git-cvsimport does not support multiple tags for a changeset. It is possible however to grab some additional changes for cvsps to support it and change the original git-cvsimport to something which uses updated cvsps (I've tried it and it seems to work). On the advantage side it supports incremental updates and has some logic to properly import merges (but it REQUIRES appropriate format for commit message).

    parsecvs so far gave me the best results. Unfortunately the code available on the web does not compile cleanly with the latest git. The change while not trivial is doable.

    EDIT: It looks like ESR took over both cvsps and parsecvs so there is some hope for CVS->GIT migration. BUT he already mentioned on some mailing list that he may declare some of the tools he took over recently officially dead.

    0 讨论(0)
  • 2020-11-27 13:59

    I'm the maintainer of cvs-fast-export. I used to maintain cvsps and parse2cvs and have closely evaluated cvs-fastimport and cvs2git.

    CVS to git conversion is a hard, nasty problem with rebarbative edge cases. All the existing conversion tools have known limitations, some quite serious.

    I recommend trying cvs-fast-export first. It produces better, faster conversions than anything else, except in rare cases where it fails cleanly and bails out. If you get the rare but dreaded "branch cycle error", try cvs2git.

    Do not trust cvs-fastimport, it is quite buggy and often screws up branch joins.

    For more, see http://www.catb.org/esr/cvs-fast-export/

    0 讨论(0)
  • 2020-11-27 14:01

    cvs2svn has a cvs2git mode.

    0 讨论(0)
  • 2020-11-27 14:06

    You can use git cvsimport. It requires cvsps to be installed, but you need to install 2.x, as 3.x is not incompatible anymore.

    Then import CVS repository on empty git. Sample usage:

    git cvsimport -C RepoName -r cvs -o master -k -v -d:pserver:anonymous@reponame.cvs.sourceforge.net:/cvsroot/path ModuleName
    

    On OSX you install cvsps-2.1 in the following way (having brew):

    brew tap homebrew/versions
    brew install cvsps2
    brew link  cvsps2
    

    You can also use cvs2git tool which can convert a CVS repository to git. However you need to have access to a CVSROOT directory.

    Check cvs2git documentation for installation steps.

    Example usage:

    cvs2git --blobfile=git-blob.dat --dumpfile=git-dump.dat --username=cvs2git /path/to/cvs/repo
    

    This would create two output files in git fast-import format. The names of these files are specified by your options file or command-line arguments. In the example, these files are named cvs2git-tmp/git-blob.dat and cvs2git-tmp/git-dump.dat.

    These files can be imported into empty git repository by:

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

    Then delete the TAG.FIXUP branch and run gitk --all to view the results of the conversion.

    Check for more, by running: cvs2git --help.

    0 讨论(0)
提交回复
热议问题