0

我们使用 SubGit 将项目从 SVN 迁移到 GIT,并且遇到了项目问题,它改变了它们在 SVN 中的位置

假设 PROJECT-A 及其 trunk、tags 和 brunches 文件夹位于http://svn.server/repo/sub-folder/PROJECT-A中。在其历史的某个时刻,整个项目被移动到另一个文件夹,然后恢复。

r10001:   svn mv –m “moving to a wrong location” http://svn.server/repo/sub-folder/PROJECT-A http://svn.server/repo/wrong-folder/.
r10002:   svn mv –m “moving project back to sub-folder” http://svn.server/repo/wrong-folder/PROJECT-A http://svn.server/repo/sub-folder/.

应用 SubGit 后我们在 GIT 中的提交是moving project back to sub-folder和所有后续提交。然而,之前发生的一切都moving to a wrong location不会被迁移,尽管svn log显示了提交的整个历史。

subgit 是否可以选择在提供的 SVN url 下导入(安装)所有提交?与它一起工作的货币--stop-on-copy

4

1 回答 1

2

SubGit 始终与您指定的 SVN URL 一起工作,并且永远不会注意到它之外的任何内容。这就是为什么如果你指定

http://svn.server/repo/sub-folder/PROJECT-A

作为 SVN URL,它将完全忽略

http://svn.server/repo/wrong-folder/PROJECT-A

因为它超出了这个 URL。

幸运的是,有一种针对您的情况的解决方法。尝试以下配置:

[svn]
  ...
  url = http://svn.server/repo
  trunk = sub-folder/PROJECT-A/trunk:refs/heads/master
  branches = sub-folder/PROJECT-A/branches/*:refs/heads/*
  tags = sub-folder/PROJECT-A/tags/*:refs/tags/*
  shelves = sub-folder/PROJECT-A/shelves/*:refs/shelves/*
  branches = wrong-folder/PROJECT-A/trunk:refs/heads/wrong/master
  branches = wrong-folder/PROJECT-A/branches/*:refs/heads/wrong/*
  tags = wrong-folder/PROJECT-A/tags/*:refs/tags/wrong/*
  branches = wrong-folder/PROJECT-A/shelves/*:refs/shelves/wrong/*

我想,你理解这个想法:使用存储库根作为 SVN URL 并为分支路径添加前缀。

或者,您可以尝试使用--layout auto“subgit configure”功能:

subgit configure --svn-url http://svn.server/repo --layout auto --trunk sub-folder/PROJECT-A/trunk repo.git

“subgit configure”的这个变体将扫描 SVN 历史记录,并检测主干复制到和从中复制的所有目录,并将它们视为目录。然后它将生成repo.git/subgit/config具有相应主干/分支/标签/货架选项的文件。我不建议你 100% 依赖这个自动建议。您可以使用这些生成的选项作为灵感,但我鼓励您手动编写映射。

于 2017-11-06T12:56:48.897 回答