开发者

How to upgrade the SVN version used by git-svn

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 ma开发者_如何转开发y 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:

How to upgrade the SVN version used by git-svn

(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)


If you can use MacPorts a simple port install git-core +svn will install a recent version of both git itself and the svn client and libraries.

$ git svn --version
git-svn version 1.7.3.2 (svn 1.6.15)


Note: starting git 1.7.8 (late October 2012), git svn will work with SVN1.7.

See "[ANNOUNCE] Git v1.8.0-rc3":

"git svn" has been updated to work with SVN 1.7.


One way to change svn version used by git-svn is point PERL5LIB environment variable to the corresponding svn-perl of the svn installation of your choice on your system. That would be to done by adding following line to the bash profile:

export PERL5LIB=/usr/local/lib/svn-perl

The path will vary depending on the installation directory of svn-perl bindings. For e.g., WanDisco svn client does install svn-perl bindings by default and is usually under /opt/subversion/lib/svn-perl. With homebrew, you can run following command to install svn with perl bindings:

$ brew install subversion --perl

For older versions:

$ brew install subversion17 --perl
$ brew install subversion16 --perl

I learned about PERL5LIB variable from here.


For me, the following sequence of steps worked:

  1. Get Apache subversion source
  2. Build subversion from source using make, and then do:
    • make swig-pl
  3. Install subversion using make install, and then do:
    • make install-swig-pl
  4. Get git source
  5. Build git as usual

Reference: http://www.linuxfromscratch.org/blfs/view/cvs/general/subversion.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜