简体   繁体   English

如何在同一SVN信息库中为大量项目制作git-svn仓库?

[英]How can I make git-svn repos for a large number of projects in the same SVN repository?

I've got a SVN repository that looks something like: 我有一个看起来像这样的SVN存储库:

\project1
 - branches
 - tags
 - trunk
\project2
 - branches
 - tags
 - trunk
\subfolder
  \project3
    - branches
    - tags
    - trunk
   \another-subfolder
     \project4
       - branches
       - tags
       - trunk
etc

There's probably 100 projects or so in here. 这里大概有100个项目。 I'd like to create git-svn repos for each of these, preferably one that mirrors the structure of SVN. 我想为每一个创建git-svn仓库,最好是一个镜像SVN结构的仓库。

My initial thought was to write a script that walk the SVN tree and do a git svn -d clone for each project, but I'm wondering if there's a better way to do this (or if someone's built a tool so I don't have to do it myself). 我最初的想法是编写一个遍历SVN树并为每个项目执行git svn -d clone的脚本,但是我想知道是否有更好的方法可以做到这一点(或者是否有人构建了一个工具,所以我没有必须自己做)。 Is this reasonable, or are there better ways to perform this task? 这是否合理,或者有更好的方法来执行此任务?

I wouldn't consider Split large Git repository into many smaller ones as a duplicate of this question, especially if you want to maintain the link between svn and your git repos, and be able to ' git svn dcommit ' back to the SVN repo. 我不会考虑将大型Git存储库拆分成许多较小的存储库来作为此问题的副本,尤其是如果您想维护svn和git存储库之间的链接,并且能够将git svn dcommit '返回到SVN存储库。

You can use some tools like svn2git or svneverever , a Python tool which will help you detect all the right project directories in order to write a svn2git rules file for those. 您可以使用svn2git或svneverever之类的工具,这是一个Python工具,可以帮助您检测所有正确的项目目录,以便为这些目录编写svn2git规则文件。

The other approach is illustrated by this article (for multiple branches, but can be applied to multiple projects as well): "Git-SVN? No, Git+SVN". 另一种方法是通过说明这篇文章 (多个分支机构,但可以适用于多个项目以及):“混帐,SVN没有,混帐+ SVN”。
Ie checkout the right part of your svn repo and initialize a git repo in it. 即签出您的svn仓库的右边部分,并在其中初始化一个git仓库。
See also " Clone multiple SVN projects with git-svn " for an example of this approach . 有关此方法的示例,另请参见“ 使用git-svn克隆多个SVN项目 ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM