How to upgrade the SVN version used by git-svn

前端 未结 5 1042
闹比i
闹比i 2020-12-17 16:45

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:

trieds         


        
5条回答
  •  别那么骄傲
    2020-12-17 16:57

    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)

提交回复
热议问题