view tests/fixtures/rename-closed-branch-dir.sh @ 1457:019c3e194fba

tests: optimise creating repositories and loading dumps Previously, we'd use svnadmin for creating repositories and loading dumps. That tends to be a bit slow, as it forks a new process and loads the Subversion libraries into it. Instead, we extend our existing Subversion wrappers and load the dumps using the API. This is a noticable speedup. The only downside is that we rely on Subversion and Subvertpy to correctly close all file descriptors; an assumption which hasn't always held in the past. I ran some benchmarks on my relatively slow Mac with $TMPDIR on a ramdisk, and they showed a significant change: I compared ten runs of each with Subvertpy: min: -18.8% (299.1s -> 243.0s) median: -20.0% (307.1s -> 245.6s) ...and three runs of each with SWIG: min: -22.8% (368.7s -> 284.7s) median: -25.7% (384.4s -> 285.5s) (Since the timing measures wall clock time, the minimum time is likely to be the most accurate and useful measurement.)
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 07 Jun 2016 09:15:53 +0200
parents b072dc02d1e3
children
line wrap: on
line source

#!/bin/sh
#
# Generate rename-closed-branch-dir.svndump
#

mkdir temp
cd temp

mkdir project
cd project
mkdir trunk
mkdir branches
mkdir tags
cd ..

svnadmin create testrepo
CURRENT_DIR=`pwd`
svnurl=file://"$CURRENT_DIR"/testrepo
#svn import project-orig $svnurl -m "init project"

svn co $svnurl project
cd project
svn add *
svn ci -m "init project"

cd trunk
echo a > a.txt
svn add a.txt
svn ci -m "add a.txt in trunk"

# Create a branch
svn up
cd ../branches
svn copy ../trunk async-db
svn ci -m "add branch async-db"
svn up

# Implement feature
cd async-db
echo b > b.txt
svn add b.txt
svn ci -m "Async functionality"

# Merge feature branch
cd ../../trunk
svn merge $svnurl/branches/async-db
svn ci -m "Merged branch async-db"
cd ..
svn up

# Create branch folder for unnecessary branches
svn mkdir $svnurl/branches/dead -m "Create branch folder for unnecessary branches"
svn up

#  We don't need the 'async-db' branch, anymore.
svn copy $svnurl/branches/async-db $svnurl/branches/dead -m "We don't need the 'async-db' branch, anymore."
svn up

# Rename 'dead' folder to 'closed'
svn move $svnurl/branches/dead $svnurl/branches/closed -m "Renamed 'dead' folder to 'closed'"
svn up

# Move 'branches/closed' to 'tags/closed'
svn move $svnurl/branches/closed $svnurl/tags/closed -m "Moved 'branches/closed' to 'tags/closed'."
svn up

# Dump repository
cd ..
svnadmin dump testrepo > ../rename-closed-branch-dir.svndump