本文介绍了如何升级git-svn使用的SVN版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用git-svn并喜欢它。但是我们只是将我们的repo换成了需要1.5.0或更高版本的svn版本。目前,我已经得到了这个:

  svn version 1.7.3.1(svn 1.4.4)

trysound -m:android holmesj $ svn --version
svn,版本1.6.15(r1038135)
编译11月29日2010,13:32:56

因此,当我尝试dcommit时,出现以下错误消息:

  ... 
...
存储库挂钩失败:提交被启动挂钩(退出代码1)输出:
只有客户端> = 1.5.0可以提交到这个存储库。
有关升级说明,请参阅:
http://twiki.corp.yahoo.com/view/Subversion/SubversionFAQ#Upgrade
位于/ usr / local / git / libexec / git-core / git-svn第573行

这真的很糟糕,我不想停止使用git-svn 。这会严重的会让人感觉很糟糕。如果我只需要将所有的git提交转换成一个大的svn提交,就会很糟糕。

任何人都知道如何更新git-svn使用的svn版本?我在OSX 10.5上运行这个脚本

解决方案

git-svn是用perl编写的,并且使用了SVN :: Core模块,所以它使用模块指向的任何版本的svn库。为了让git-svn使用更新版本的svn,你可以更新系统的SVN :: Core模块......一个 sudo cpan SVN :: Core 就足够了。或者,您可能能够替换/ usr / lib中的svn库。



我无法执行上述任一操作,因为我没有管理员权限在我的工作机器上。这是我为克服这一点所做的。如果你走这条路线,你可能需要调整下面的一些路径。我使用〜/ local / lib 〜/ local / bin 等。

设置以下shell变量:

  export PERL_MB_OPT = -  install_base $ HOME / local
export PERL_MM_OPT =INSTALL_BASE = $ HOME / local

然后运行 cpan SVN :: Core 。在某些时候,它会问你想传递任何参数来配置?,我回答的是 - libdir = / Users / sean / local / lib --prefix = / Users / sean /本地。这将创建一个新的svn库副本,以及它的perl绑定,它将以〜/ local / lib / perl5 / 结尾。



现在,在我的git安装(来自源代码)中,git-svn执行此操作:

  use lib(split(/:/,$ ENV {GITPERLLIB} ||/ Users / sean / local / lib / perl5 / site_perl)); 

因此,我将新安装的SVN模块从〜/ local / lib / perl5 / 〜/ local / lib / perl5 / site_perl 。有几件事要搬迁;你的 lib / perl5 目录应该是这样的:

stack.imgur.com/QVyzt.pngalt =alt text>



(将GITPERLLIB设置为 $ HOME可能更容易/ local / lib / perl5 并将Git.pm移出 site_perl



我显然不是perl guru,所以可能有更好的方法来完成这一切。然而,我可以确认它是有效的: git-svn version 1.7.3.1(svn 1.6.12)


I've been using git-svn and love it. But we just switched our repo to one that requires a svn version of 1.5.0 or greater. Currently, I've got this:

triedsound-lm:android holmesj$ git svn --version
git-svn version 1.7.3.1 (svn 1.4.4)

triedsound-lm:android holmesj$ svn --version
svn, version 1.6.15 (r1038135)
   compiled Nov 29 2010, 13:32:56

So, when I try to dcommit, I get this error message:

...
...
A repository hook failed: Commit blocked by start-commit hook (exit code 1) with output:
Only clients >= 1.5.0 may commit to this repository.
For upgrade instructions please see:
    http://twiki.corp.yahoo.com/view/Subversion/SubversionFAQ#Upgrade
 at /usr/local/git/libexec/git-core/git-svn line 573

This really sucks, I don't want to stop using git-svn. That would seriously just be awful. It's going to suck if I just have to lump all my git commits into one big svn commit.

Anyone know how to update the svn version that git-svn uses? I'm running this on OSX 10.5

解决方案

git-svn is written in perl and uses the SVN::Core module, so it uses whatever version of the svn library that module is pointing at. To make git-svn use a newer version of svn, you could probably update the system's SVN::Core module... a sudo cpan SVN::Core might suffice. Alternatively, you may be able to replace the svn libraries in /usr/lib.

I can't do either of the above, since I don't have admin privileges on my work machine. Here's what I did to overcome that. If you take this route, you may need to adjust some of the paths below. I use ~/local/lib, ~/local/bin etc.

Set the following shell variables:

export PERL_MB_OPT="--install_base $HOME/local"
export PERL_MM_OPT="INSTALL_BASE=$HOME/local"

Then run cpan SVN::Core. At some point it'll ask "Would you like to pass any arguments to configure?", to which I answered --libdir=/Users/sean/local/lib --prefix=/Users/sean/local. This'll build a new copy of the svn library, and the perl bindings for it, which will end up in ~/local/lib/perl5/.

Now, in my install of git (from source), git-svn does this:

use lib (split(/:/, $ENV{GITPERLLIB} || "/Users/sean/local/lib/perl5/site_perl"));

So I moved my freshly installed SVN module from ~/local/lib/perl5/ to ~/local/lib/perl5/site_perl. There are a couple things to relocate; your lib/perl5 directory should look something like this:

(It might be easier just to set GITPERLLIB to $HOME/local/lib/perl5 and move Git.pm out of site_perl)

I'm clearly no perl guru, so there's probably a better way to accomplish all this. I can, however, confirm that it works: git-svn version 1.7.3.1 (svn 1.6.12)

这篇关于如何升级git-svn使用的SVN版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 15:46