【问题标题】:Migrating a svn repository without trunk to git using reposurgeon使用 reposurgeon 将没有中继的 svn 存储库迁移到 git
【发布时间】:2020-11-06 20:59:02
【问题描述】:

我正在尝试将旧的 svn 存储库转换为 git。在阅读了几篇描述使用 git-svn 执行此任务的缺点的文章后,特别是对于具有非标准布局的存储库,我决定尝试一下 reposurgeon。在最初使用 Ubuntu 软件包源 (4.3) 中的版本后,我切换到最新版本(4.14;从源代码构建)以防万一。

遗憾的是,到目前为止,我只能生成一个空的 git 存储库。看来我还没有弄清楚如何正确使用 reposurgeon。

这是我要转换的 svn 存储库的基本结构:

  • 分支机构
    • 1.0.x
    • 1.1.x
  • 标签
    • 发展
      • 1.0.0
      • 1.0.1
      • 1.0.2
      • 1.1.0
    • 生产
      • 1.0.0
      • 1.0.1

存储库中还有更多内容,但这就是它的要点。这里要注意的重要一点是

  1. 没有后备箱
  2. 标签结构不平整

现在我正在尝试运行最少的步骤。我使用http://www.catb.org/~esr/reposurgeon/repository-editing.html#quickstart 作为指导方针,因此在为存储库创建作者地图后,我执行了以下操作:

repotool mirror URL project-mirror
reposurgeon
  read project-mirror
  authors read <project-mirror.map
  prefer git
  rebuild project-git

当我在 reposurgeon 中运行 read project-mirror 时(project-mirror 是我使用 repotool 创建的镜像的目录),我得到以下输出:

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 exportsvnadmin 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 服务器没有任何形式的管理权限。

【问题讨论】:

  • 问题解决了吗?

标签: git svn version-control version-control-migration reposurgeon


【解决方案1】:

转换您的存储库应该不是问题。以下是一些值得检查的事项:

  1. 指定源类型;为此使用sourcetype svn
  2. 通过branchify branches/* tags/development/* tags/production/*指定嵌套标签结构

您可能还想扁平化标签名称,例如与

branchmap :tags/development/(.+):tags/dev_\1: \
          :tags/production/(.+):tags/prod_\1:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-08
    • 1970-01-01
    • 2020-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多