13

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

holmes
  • 578
  • 1
  • 7
  • 16
  • How did you install svn and git? Did you build these yourself? – Alex Jasmin Dec 03 '10 at 00:03
  • svn i kept it easy and installed from http://subversion.apache.org/packages.html#osx git i installed from the binary from git-scm.org, and then the 1.7.3.2 release via homebrew. i removed the /usr/bin/svn and linked it to the svn in /opt/subversion/bin/svn – holmes Dec 03 '10 at 01:15

5 Answers5

10

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:

alt text

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

sb.
  • 1,140
  • 1
  • 9
  • 13
  • i'm able to run as root, so `sudo cpan SVN::Core` runs. It's definitely grabbing Alien-SVN-1.6.12.0 and looks like it's successfully installing it. But when I run `git svn --version`, it's still linking against 1.4.4. Any thoughts as to where I should look to ensure that the new SVN::Core is being installed in the right location. I'm totally lost when it comes to perl – holmes Dec 03 '10 at 18:12
  • I don't know where cpan installs things by default -- It may be putting it somewhere in `/Library/Perl/`, but finding the version in `/System/Library/Perl/` first? Or vice versa perhaps? If you can find it, you may just need to set your PERL5LIB shell variable to reference that location first. Alternatively, you could copy the newly installed SVN module into the directory containing Git.pm. If you aren't sure where that is, you could check the top of the git-svn perl script. It should be in libexec/git-core (the libexec dir next to the bin directory containing git). – sb. Dec 03 '10 at 19:04
2

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)
Alex Jasmin
  • 39,094
  • 7
  • 77
  • 67
0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

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.

user954311
  • 41
  • 3
0

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