Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 567
holmes Avatar asked Dec 02 '10 23:12

holmes


People also ask

Is SVN update same as git pull?

You can think of git pull as Git's version of svn update . It's an easy way to synchronize your local repository with upstream changes.

What is the equivalent of SVN update in git?

Getting the latest changes from SVN The equivalent to git pull is the command git svn rebase . This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch.

What is SVN update?

The svn update command lets you refresh your locally checked out repository with any changes in the repository HEAD on the server. It also tells you what has been changed, added, deleted. If a change has been made to a file you have also changed locally, svn will try to merge those changes.

Is SVN and git the same?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.


2 Answers

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)

like image 104
sb. Avatar answered Oct 15 '22 05:10

sb.


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)
like image 25
Alex Jasmin Avatar answered Oct 15 '22 06:10

Alex Jasmin