Skip to main content

How to migrate into Subversion 1.7


So, most of Linux distribution has not included Subversion 1.7 yet. What I like most from Subversion 1.7 is that it only contains one .svn directory just like Git (I'm a Git fan actually). I'm going to document my experience installing Subversion 1.7 on Ubuntu 11.04 and migrating from 1.5 into this version



Adding to repo

  1. Check if version 1.7 is available to download
    apt-cache show subversion | grep Version:
  2. If it is not, add to repository
    echo "deb http://opensource.wandisco.com/ubuntu lucid svn17" | sudo tee /etc/apt/sources.list.d/svn.list
    sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
    sudo apt-get update
    sudo apt-get dist-upgrade
    

Installation

  1. Install the package
    sudo apt-get install subversion
  2. Create repository directory
    sudo mkdir /var/lib/svn

Access via HTTP

  1. Install required packages
    sudo apt-get install libapache2-svn
  2. Create file /etc/apache2/mods-available/dav_svn.conf containing
    # Allowing to list all repositories available
    DAV svn
    SVNParentPath /var/lib/svn
    
    # Authentication
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd
    
    # Any access (GET, POST, etc) requires authenticated users
    Require valid-user
    
    # Disable request size limit
    # LimitXMLRequestBody 0
    
  3. Create empty file for authentication
    sudo touch /etc/apache2/dav_svn.passwd
  4. Restart Apache
    sudo service apache2 restart
  5. Create a repo and user for testing (see the following guidence)

Create a repository

Do the following commands using root by invoking "sudo su -"
cd /var/lib/svn
svnadmin create myproject
chown -R www-data.www-data myproject

Create user

Only if you use AuthUserFile directive like defined above.
  1. Create user
    sudo htpasswd -c /etc/apache2/dav_svn.passwd user_name
  2. Restart Apache
    sudo service apache2 restart
  3. Test checkout
    svn co http://hostname/svn/myproject myproject --username user_name

Using LDAP auth

  1. Activate LDAP authentication module on Apache 2
    sudo a2enmod authnz_ldap
  2. Change configuration to use LDAP On /etc/apache2/mods-available/dav_svn.conf, comment AuthUserFile and put the following lines
    AuthBasicProvider ldap
    AuthLDAPURL ldap://myldapserver/dc=mybcmp,dc=com?uid?sub
    AuthLDAPBindDN cn=admin,dc=mybcmp,dc=com
    AuthLDAPBindPassword "myLdapAdminpassword"
    
  3. Reload configuration
    sudo apache2ctl restart

Migrating from older SVN

  1. Copy repositories' directory of older SVN into the new SVN directory.
  2. Change permission recursively into www-data.
  3. I suggest you use svndump instead of this way.

Linux way to use svndump faster

  1. Mount remote directory.
    sshfs ichsan@oldsvn.com:/svn/parent /tmp/remoteparent
  2. Dump and restore Run the following script as root (put it in an executable file e.g. dumpres.sh)
    #!/bin/sh
    
    cd /tmp/remoteparent/
    
    SAVEIFS=$IFS
    IFS=$(echo -en "\n\b")
    
    for repo in *; do
      t="/var/lib/svn/$repo"
      svnadmin create "$t"
      svnadmin dump "$repo" | svnadmin load "$t"
    done
    
    IFS=$SAVEIFS
    

After some research, I came into some conclusions:
  • User is stored in each SVN repository metadata.
  • SVN Server 1.7 can serve old repo directory (the repo structure was created by older version of SVN). Client 1.7 will see only one .svn directory.
  • Migration using copy way compared to svndump way, both take the same time in doing "svn log". But the size on the server is quite different. Copying is larger than svndump (46M vs 39M on one example of mine)

Reference:
http://ubuntuforums.org/showthread.php?t=1876156
https://help.ubuntu.com/community/Subversion

Comments

Popular posts from this blog

Distributed OSGi services in JBoss Fuse

JBoss Fuse (Fuse ESB) is a great container featuring Apache Karaf as OSGi container. It has a great feature called Fabric, on which you can start another container efficiently and do provisioning from any container connected in one Fabric. It means that, you can uninstall bundles from in other container from your current container.

Fabric also allows a bundle to publish services and let them be consumed by other bundles. Not just by bundles in the same container, but in other bundles as long as publishers and consumers are connected in one Fabric.
I'm here not to to tell you how to use JBoss Fuse or what it is. But to tell you that it's been hard to find references about how to publish services and consume them in distributed environment. So, I want to share my experience to handle that with blueprint or with Spring DM 1.x.x based on scattered sources of information I have read for weeks.

Bagaimana Ujian SIM C secara sukses di SatPas Daan Mogot

Atas berkat rahmat Allah Yang Maha Pengasih lagi Maha Penyayang, saya berhasil mendapatkan SIM C secara legal dalam 1 kali kedatangan yakni sore tadi (23 Januari 2010). Makasih ya Allah.

Sorry, kali ini saya berbicara non IT. Mungkin ini adalah momen bersejarah bagi saya yang perlu direkam dalam blog saya dan ini juga merupakan sesuatu yang sangat penting untuk dibagikan kepada orang lain, seperti halnya judul blog saya "Let's share"

SELECT ... FOR UPDATE with Spring JDBC

SELECT ... FOR UPDATE is required to lock specific row in database in order to prevent other query thread to read or make changes to the same row. The lock is released once you update the data or commit it.

As a Spring lover, it's hard to find references about implementing the technique in Spring JDBC template. But finally I managed to use it.