rulururu

post Setting up single-user synced SVN repositories

January 17th, 2008

Filed under: Coding, SVN — zedr0n @ 9:30 pm

First you’ll need to follow the SVN wiki entry to set up svn repository and passwordless ssh access at A2Hosting.

As this is only for one user, then the easiest way is to use svn dump functionality which allows for incremental dumps. Using post-commit hooks we’ll just save the new commits since last sync to a dump file. Furthermore, apart from manual update of repositories from dump we’ll also write a script which will sync the repositories nightly(e.g using cron). But the main thing is to be able to switch from using remote(main) repository to its local copy to continue developing if for some reason we don’t have network access.

Setting up repositories

I assume that you’ve got one repository completely set up and ready. Now we only need to dump the repository,

svnadmin dump repository_path >dumpfile

copy the dumpfile and run

svnadmin create repository_path
svn load repository_path <dumpfile

Setting up automatic dumping

The next thing is installing post-commit hook, which is just an executable program put into repository_path/hooks. Consult post-commit.tmpl for more info.
post-commit

#!/bin/sh
REPOS="$1"
REV="$2"
DUMP=path_to_dump_to

svnadmin dump $REPOS --incremental --revision $REV >$DUMP/newsvn.dump
cat $DUMP/svn.dump $DUMP/newsvn.dump >$DUMP/svn_.dump
mv -f $DUMP/svn_.dump $DUMP/svn.dump

And don’t forget to make it executable with chmod.

Synchonizing the repositories

This is the script to sync from remote to local
sync2local

#!/bin/bash
FTP_USER=
FTP_PASS=
FTP_SERVER=
SSH_SERVER=
SSH_USER=
DUMPFILE=svn.dump
REPO=/svn
PORT=-p 7822

#delete old dump file
if [ -e $DUMPFILE ]; then
    rm $DUMPFILE
fi
#get current dump file
wget --password=$FTP_PASS --user=$FTP_USER ftp://$FTP_SERVER/$DUMPFILE
if [ $? != 0 ]; then
    echo No dumpfile available
    exit
fi

#update local repository
svnadmin load $REPO <$DUMPFILE

#delete dump file if sucessful
if [ -e $DUMPFILE ]; then
 ssh $SSH_USER@$SSH_SERVER $PORT rm $DUMPFILE
 rm $DUMPFILE
fi

And the script to sync from local to remote
sync2remote

#!/bin/bash
FTP_USER=
FTP_PASS=
FTP_SERVER=
SSH_SERVER=
SSH_USER=
PORT="-p 7822"
REPO=
#dumpfile with full path
DUMPFILE=
#test if dump file exists
if [ ! -e $DUMPFILE ]; then
    echo "No dump file available"
    exit
fi

#upload dump file
echo "put $DUMPFILE $(basename $DUMPFILE)" | ftp ftp://$FTP_USER:$FTP_PASS@$FTP_SERVER
if [ $? != 0 ]; then
    echo "Can't upload dumpfile"
    exit
fi
#update remote repository
ssh $SSH_USER@$SSH_SERVER $PORT "svnadmin load $REPO <$(basename $DUMPFILE)"
#delete dump file if sucessful
rm $DUMPFILE
ssh $SSH_USER@$SSH_SERVER $PORT rm $(basename $DUMPFILE)

Switching between repositories

These 2 scripts svn2remote and svn2local can be used to switch a working copy between repositories. Before switching it will sync to the most recent copy, which is precisely what we need.
svn2remote

#!/bin/bash
REPO=/svn
sync2remote
svn switch --relocate file://$REPO svn+a2hosting://zedr0n@quant0r.com/home/zedr0n/svn .

svn2local

#!/bin/bash
REPO=/svn
sync2local
svn switch --relocate svn+a2hosting://zedr0n@quant0r.com/home/zedr0n/svn file://$REPO .

So, basically, whenever you want to work on some projects, you just check it out by doing svn2local and merge the changes with svn2remote when you are done. If you are confident in remote repository then you can just work with it all the time. It’s quite flexible really…

7 Comments »

  1. I’ve actually switched to git since :)

    Comment by zedr0n — April 16, 2008 @ 11:18 pm

  2. Better than VIAGRA!
    Like Viagra, Cialis, and Levitra, ERECTifix Rx is an oral aphrodisiac that stimulates erectile function. ERECTifix Rx helps most men with ED improve their erections. This means they are able to achieve harder erections. But unlike Viagra and the others, ERECTifix Rx is an edible film strip that dissolves on contact and usually works almost immediately. You will be ready and raring to go within seconds as opposed to the 30 minutes that Viagra needs to take effect. Additionally, ERECTifix Rx Strips are so small you can carry a whole supply tucked into your wallet, like a book of stamps, always ready to use.
    Getting an erection is only half the story. Maintaining one is just as important. ERECTifix Rx can help with both. This can lead to a more satisfying sexual experience with your partner. As an added bonus, ERECTifix Rx will also freshen up your breath at the same time with the great taste of cinnamon.
    Who can take ERECTifix Rx?
    * Men of all ages
    * Men who have difficulty all the time or just some of the time
    * Men with other health issues such as high blood pressure, diabetes, and depression
    See for yourself why ERECTifix Rx Strips more than exceed the sexual demands of every man and more than surprises the wildest hopes, dreams and expectations of every woman. ERECTifix Rx is an absolute must for sexually active men, or men shamed into sexual retirement due to erectile dysfunction.
    http://www.kopetl.com/v/ - FREE SHIPPING ON ALL ORDERS!
    Talk to you soon!

    Comment by Peataundept — June 3, 2008 @ 9:01 pm

  3. REAL TESTIMONIALS from ACTUAL CUSTOMERS!
    “Wow, I wasn’t ready for how good this product is…had no idea it could be that strong, without the side effects I experienced using Viagra. My girlfriends thanks you too, it’s like she’s insatiable now that she’s gotten a taste of what its like when her man uses ERECTifix Rx Strips!”
    Mark J, Wyoming.
    “I struggled with ED for so many years. It probably cost me more relationships than I care to remember. I wish I had dealt with it sooner. Well my new girlfriend won’t be going anywhere. I got a solid supply of your ERECTifix Rx Strips at hand! I was told of your product through a friend who swore up and down that they worked unbelievably. I had never ordered anything online so obviously I was skeptical, and I started with a small package. I was so impressed I immediately ordered a full 6 month supply! Now I make sure I always have some nearby, just in case ;) Thanks again guys, your product has done wonders for my personal life!”
    Geoff D, California.
    “ERECTifix Rx Strips are the best product available for supercharging your sex life online today! That’s a guarantee.”
    Dr. Ray Francis, San Francisco.
    Don’t be left behind!

    Comment by DyemblobreRob — June 23, 2008 @ 8:11 pm

  4. Why erectile dysfunction (ED) happens?
    ED can be caused by things like stress or fatigue. But a lot of times, ED is not something that you can control. That’s because it’s often due to a physical problem that affects your blood flow.
    When a man has ED, the nerves or blood vessels in the penis don’t work properly. This prevents blood from flowing to the penis. And that can prevent an erection.
    Causes of ED.
    ED is often related to other health issues that can affect the flow of blood to the penis. Issues such as
    * High blood pressure
    * High cholesterol
    * Heart disease
    * Diabetes
    * Prostate problems
    * Stress
    * Depression
    No matter what the cause, treatment with a product such as ERECTifix Rx is usually effective.
    FREE SHIPPING ON ALL ORDERS!

    Comment by SooneMive — June 24, 2008 @ 1:17 pm

  5. Why erectile dysfunction (ED) happens?
    ED can be caused by things like stress or fatigue. But a lot of times, ED is not something that you can control. That’s because it’s often due to a physical problem that affects your blood flow.
    When a man has ED, the nerves or blood vessels in the penis don’t work properly. This prevents blood from flowing to the penis. And that can prevent an erection.
    Causes of ED.
    ED is often related to other health issues that can affect the flow of blood to the penis. Issues such as
    * High blood pressure
    * High cholesterol
    * Heart disease
    * Diabetes
    * Prostate problems
    * Stress
    * Depression
    No matter what the cause, treatment with a product such as ERECTifix Rx is usually effective.
    FREE SHIPPING ON ALL ORDERS!

    Comment by ImitoGynccymn — July 29, 2008 @ 2:46 am

  6. tramadol prescription…

    tramadol vs vicodin…

    Trackback by tramadol — August 5, 2008 @ 7:57 pm

  7. oem Macromedia Contribute 3.0 software

    Comment by FancyYork — August 6, 2008 @ 5:25 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

ruldrurd
© quant0r.com , Designed by Stealth Settings
Entries (RSS) and Comments (RSS)