KDE svn2git 规则 - 定义多个文件夹

KDE svn2git rules - defining multiple folders

我的 SVN 结构如下:

- Project A
  - Folder 1
    - Folder a
    - Folder b
      - Folder 1
        - trunk
        - tags
          ...
      - Folder n
        - trunk
        - tags
  - Folder 2
  - Folder 3
- Project B

关于svn2git的KDE匹配规则的编写,是否正确:

create repository repo
end repository

match Project A/Folder 1/Folder b/([^/]+)/trunk/([^/]+)/
  repository repo/Project A/Folder b/([^/]+)
  branch master
end match

# Add a prefix to all tag branches so we can fix them later.
match Project A/Folder 1/Folder b/([^/]+)/tags/([^/]+)/
  repository repo/Project A/Folder b/([^/]+)
  branch tag--
end match

# Ignore all other directories.
match /
end match

此外,我是否必须事先在我的 Git 存储库中创建所有文件夹,还是 svn2git 会为我创建这些文件夹?

svn2git 将为您创建目录,但您必须在规则文件中明确定义存储库。如果您引用一个未定义的存储库(例如,因为匹配正则表达式匹配了您未创建的内容,那么迁移将停止并显示一条错误消息。

虽然你的规则不正确,我觉得应该更像

create repository repo
end repository

match /(Project A/Folder 1/Folder b/[^/]+/)trunk/
  repository repo
  prefix 
  branch master
end match

match /(Project A/Folder 1/Folder b/[^/]+/)tags/([^/]+)/
  repository repo
  prefix 
  branch refs/tags/
end match

# Ignore all other directories.
match /
end match