tests/svn/svndump-empty.sh
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 20 Sep 2012 19:02:47 +0200
changeset 17677 5c89e7fa5bc2
parent 16466 c53a49c345e1
permissions -rwxr-xr-x
clfilter: introduce `filteredrevs` attribute on changelog This changeset allows changelog object to be "filtered". You can assign a set of revision numbers to the `changelog.filteredrevs` attributes. The changelog will then pretends these revision does not exists in this repo. A few methods need to be altered to achieve this behavior: - tip - __iter_ - irevs - hasnode - headrevs For consistency and to help debugging, the following methods are altered too. Tests tend to show it's not necessary to alter them but have them raise proper exception helps to detect bad acces to filtered revisions. - rev - node - linkrev - parentrevs - flags The following methods would also need alteration for consistency purpose but this is non-trivial and not done yet. - nodemap - strip The C version of headrevs is not run if there is any revision to filter. It'll need a proper rewrite later to restore performance.

#!/bin/sh
#
# Use this script to generate empty.svndump
#

mkdir temp
cd temp

mkdir project-orig
cd project-orig
mkdir trunk
mkdir branches
mkdir tags
cd ..

svnadmin create svn-repo
svnurl=file://`pwd`/svn-repo
svn import project-orig $svnurl -m "init projA"

svn co $svnurl project
cd project
mkdir trunk/dir
echo a > trunk/dir/a
svn add trunk/dir
svn ci -m adddir

echo b > trunk/b
svn add trunk/b
svn ci -m addb

echo c > c
svn add c
svn ci -m addc
cd ..

# svnsync repo/trunk/dir only so the last two revisions are empty
svnadmin create svn-empty
cat > svn-empty/hooks/pre-revprop-change <<EOF
#!/bin/sh
exit 0
EOF
chmod +x svn-empty/hooks/pre-revprop-change
svnsync init --username svnsync file://`pwd`/svn-empty file://`pwd`/svn-repo/trunk/dir
svnsync sync file://`pwd`/svn-empty
svn log -v file://`pwd`/svn-empty

svnadmin dump svn-empty > ../empty.svndump