0

我有以下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--\1
end match

# Ignore all other directories.
match /
end match

另外,我是否必须事先在我的 Git 存储库中创建所有文件夹,或者 svn2git 会为我做这件事吗?

4

1 回答 1

1

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

你的规则虽然不正确,但我认为它应该更像

create repository repo
end repository

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

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

# Ignore all other directories.
match /
end match
于 2018-02-01T10:13:37.447 回答