git svn 迁移因 svn 1.8 而失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27240428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:36:25  来源:igfitidea点击:

git svn migration failing with svn 1.8

gitsvnversion-controlosx-lion

提问by saschwarz

I'm following the steps in: http://git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client

我正在按照以下步骤操作:http: //git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client

to move an svn repository to git. My local svn version is:

将 svn 存储库移动到 git。我的本地 svn 版本是:

$ svn --version svn, version 1.8.10 (r1615264) compiled Aug 25 2014, 10:52:18 on x86_64-apple-darwin12.5.0

$ svn --version svn, version 1.8.10 (r1615264) compiled Aug 25 2014, 10:52:18 on x86_64-apple-darwin12.5.0

git version:

版本:

$ git --version git version 2.1.0

$ git --version git version 2.1.0

When I clone the repository I get an error reading the local file system format:

当我克隆存储库时,读取本地文件系统格式时出错:

$ git svn clone file:///tmp/test-svn -s
Initialized empty Git repository in /private/tmp/test-svn/.git/
Couldn't open a repository: Unable to connect to a repository at URL 'file:///tmp/test-svn': Unable to open an ra_local session to URL: Unable to open repository 'file:///tmp/test-svn': Expected FS format between '1' and '4'; found format '6' at /usr/local/Cellar/git/2.1.0/lib/perl5/site_perl/Git/SVN.pm line 310

According to this svn release note FS format 6 was introduced in svn 1.8: http://subversion.apache.org/docs/release-notes/1.8.html#revprop-packing

根据这个 svn 发行说明 FS 格式 6 是在 svn 1.8 中引入的:http: //subversion.apache.org/docs/release-notes/1.8.html#revprop-packing

Could it be the git 2.1 Perl script isn't yet compatible with this svn release? More importantly how can I get this svn repository converted to git?

可能是 git 2.1 Perl 脚本与这个 svn 版本不兼容吗?更重要的是,我怎样才能将这个 svn 存储库转换为 git?

回答by saschwarz

I got an answer on the git-users email list.

我在 git-users 电子邮件列表中得到了答复。

The solution is to run a local svnserver and use the svnprotocol when running git svn cloneinstead of the fileprotocol. That avoids git-svnneeding to parse the svn 1.8 file format.

解决办法是在本地运行一个svnserver,svn运行时使用协议git svn clone而不是file协议。这避免了git-svn需要解析 svn 1.8 文件格式。

Suppose your repository is in a directory /path/to/repository/test-svn. Change into the /tmpdirectory and run

假设您的存储库在一个目录中/path/to/repository/test-svn。切换到/tmp目录并运行

svnserve -d -r /path/to/repository

Then you can run

然后你可以运行

git svn clone svn://127.0.0.1/test-svn -s

Afterwards, stop the svnserver and delete the temporary svn repository.

之后,停止 svnserver 并删除临时 svn 存储库。