How to upgrade the SVN version used by git-svn

前端 未结 5 1023
闹比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)

    0 讨论(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.

    0 讨论(0)
  • 2020-12-17 17:11

    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.

    0 讨论(0)
  • 2020-12-17 17:11

    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 讨论(0)
  • 2020-12-17 17: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)
    
    0 讨论(0)
提交回复
热议问题