![](/img/trans.png)
[英]Convert an SVN repository to git with reposurgeon without creating .gitignore files?
[英]Migrating a svn repository without trunk to git using reposurgeon
我正在尝试将旧的 svn 存储库转换为 git。在阅读了几篇描述使用 git-svn 执行此任务的缺点的帖子后,尤其是对于具有非标准布局的存储库,我决定给 reposurgeon 一个 go。之后最初使用来自 Ubuntu package 源 (4.3) 的版本,我切换到最新版本(4.14;从源构建)以防万一。
遗憾的是,到目前为止,我只能生成一个空的 git 存储库。 看来我还没弄清楚如何正确使用 reposurgeon。
这是我尝试转换的 svn 存储库的基本结构:
存储库中还有更多内容,但这就是它的要点。 这里要注意的重要一点是
现在我正在尝试运行最少数量的步骤。 我使用http://www.catb.org/~esr/reposurgeon/repository-editing.html#quickstart作为指南,因此在为存储库创建作者 map 之后,我执行了以下操作:
repotool mirror URL project-mirror
reposurgeon
read project-mirror
authors read <project-mirror.map
prefer git
rebuild project-git
当我在 reposurgeon 中运行read project-mirror
时(项目镜像是我使用 repotool 创建的镜像的目录),我得到以下 output:
reposurgeon: nonexistent source "test" on pathmap copy
reposurgeon: component "test" to be deleted is missing
reposurgeon: 1898910: missing required date field
* project-mirror
reposurgeon: 2 new log message(s)
首先创建一个 SVN 转储(在我的本地镜像上使用repotool export
或svnadmin dump
)并读取它会导致相同的结果。
运行rebuild project-git
会产生以下结果:
reposurgeon: not trying to checkout an empty repository
reposurgeon: rebuild is complete.
reposurgeon: preserved files restored.
这将创建一个空的 git 存储库:没有提交,没有分支,没有标签。 我不希望我在上面发布的命令链导致我想要的结果(毕竟它甚至在文档中提到到达那里是一个迭代过程),但我希望至少有一些提交和/ 或 git 存储库中的分支。
任何指向正确方向的指示将不胜感激。
PS:可能还需要注意,SVN 服务器在此过程中可以而且不得以任何方式进行更改。 我只有对相关存储库的读取权限。 我对这个 SVN 服务器没有任何形式的管理权限。
转换您的存储库不应该代表一个问题。 这里有一些值得检查的东西:
sourcetype svn
。branchify branches/* tags/development/* tags/production/*
指定嵌套标签结构您可能还想展平标签名称,例如
branchmap :tags/development/(.+):tags/dev_\1: \
:tags/production/(.+):tags/prod_\1:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.