开发者

Can I migrate single file from CVS to SVN?

开发者 https://www.devze.com 2023-01-14 03:31 出处:网络
There is a file sitt开发者_开发知识库ing in CVS repository of a project now, which needs to be moved to another project using SVN. And I want to keep the history of the commits.

There is a file sitt开发者_开发知识库ing in CVS repository of a project now, which needs to be moved to another project using SVN. And I want to keep the history of the commits.

Is there a way to do so?


If this is to be a new Subversion repository, then it is trivial: just create a fake CVS repository containing the single file (as described below) and convert it using cvs2svn.

If the Subversion repository already exists, and the new file is to be the start of a new subproject in that repository, then you can do a conversion to a Subversion dumpfile (using cvs2svn's --dumpfile option), then load it into the existing repository using

$ svnadmin load --parent-dir=/newproject /path/to/svnrepo <dumpfile.out

This will create a new subproject in Subversion including directories /newproject/trunk, /newproject/branches, and /newproject/tags and (for example) the trunk version of your file will be located at /newproject/trunk/myfile.

Please be aware that the history of the new file will be migrated as a single series of Subversion commits on top of the commits that are already in your Subversion repository. Thus the Subversion commits will probably not be in chronological order, which breaks date-based searching in the Subversion repository.

Either way, you will need to start by creating a fake CVS repository containing the single file:

$ CVSREPO=$HOME/fakecvs
$ mkdir $CVSREPO
$ mkdir $CVSREPO/CVSROOT    # This directory is needed by cvs2svn but can be empty
$ mkdir $CVSREPO/proj
$ cp /path/to/myfile,v $CVSREPO/proj/

Then convert from the path $CVSREPO/proj using cvs2svn:

$ cvs2svn [options...] $CVSREPO/proj
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号