我可以将单个文件从 CVS 迁移到 SVN 吗?

发布于 2024-09-17 18:49:24 字数 76 浏览 2 评论 0原文

现在项目的 CVS 存储库中有一个文件,需要使用 SVN 将其移动到另一个项目。我想保留提交的历史记录。

有办法这样做吗?

There is a file sitting 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦开始←不甜 2024-09-24 18:49:24

如果这是一个新的 Subversion 存储库,那么这很简单:只需创建一个包含单个文件的假 CVS 存储库(如下所述)并使用 cvs2svn

如果 Subversion 存储库已经存在,并且新文件将成为该存储库中新子项目的开始,那么您可以转换为 Subversion 转储文件(使用 cvs2svn 的 --dumpfile 选项),然后将其加载到现有存储库中使用

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

这将在 Subversion 中创建一个新的子项目,包括目录 /newproject/trunk、/newproject/branches 和 /newproject/tags,并且(例如)文件的 trunk 版本将位于 /newproject/trunk/myfile。

请注意,新文件的历史记录将作为一系列 Subversion 提交迁移到 Subversion 存储库中已存在的提交之上。因此,Subversion 提交可能不会按时间顺序排列,这会破坏 Subversion 存储库中基于日期的搜索。

无论哪种方式,您都需要首先创建一个包含单个文件的假 CVS 存储库:

$ 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/

然后使用 cvs2svn

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文