丢失SVN在“svn mv”之后提交

时间:2017-11-02 10:53:43

标签: subgit

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

我们假设PROJECT-A及其主干,标签和早午餐文件夹位于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网址下导入(安装)所有提交? Currenlty与--stop-on-copy

一样

1 个答案:

答案 0 :(得分:2)

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

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

作为SVN网址,它将完全忽略

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

因为它超出了此网址。

幸运的是,你的情况有一个解决方法。请尝试以下配置:

[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/*

我想,您理解这个想法:使用repository root作为SVN URL并在分支路径中添加前缀。

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

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文件,其中包含相应的trunk / branches / tags / shelf选项。我不建议你100%依靠这个自动建议。您可以将这些生成的选项用作灵感,但我鼓励您手动编写映射。

相关问题