Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordatastore <foo@bar.org>2009-06-05 20:40:43 (GMT)
committer datastore <foo@bar.org>2009-06-05 20:40:43 (GMT)
commit1ad155dd2e5ffe540d9816f5bf31510dfa6cd7a5 (patch)
tree3f0d6e9f4816c5fc61162fe53d24b7e75b0156f8
parent2238ada5da74d930e25ad1a24430c32c3d3257ce (diff)
checkout and branch off intermediate versions
-rw-r--r--benchmarks/TODO5
-rwxr-xr-xbenchmarks/checkout-intermediate73
-rwxr-xr-xbenchmarks/create-branch29
-rwxr-xr-xbenchmarks/create-repo1
-rwxr-xr-xbenchmarks/runbench8
5 files changed, 102 insertions, 14 deletions
diff --git a/benchmarks/TODO b/benchmarks/TODO
index db63223..50990a7 100644
--- a/benchmarks/TODO
+++ b/benchmarks/TODO
@@ -1,6 +1,3 @@
- add checks to verify correctness of VCS operations
-- add more "tests"
- - do several commits
- - check out non-head version from a(ny) branch, use it for branching
- - plot weighted summary
+- plot weighted summary
diff --git a/benchmarks/checkout-intermediate b/benchmarks/checkout-intermediate
new file mode 100755
index 0000000..d85fa3c
--- /dev/null
+++ b/benchmarks/checkout-intermediate
@@ -0,0 +1,73 @@
+#!/bin/bash
+set -e
+vcs="$1"
+name="$2"
+branch="$3"
+dest="$4"
+. vardefs.sh
+
+case "$vcs" in
+ cvs)
+ cd "${tmpbase}"
+ if [ "${branch}" = first ] ; then
+ # main branch is handled specially
+ rev="$(cvs -d "${repo}" rlog -b module | grep '^revision' | sed -e 's/revision *//' | head -n 10 | tail -n 1)"
+ else
+ rev="$(cvs -d "${repo}" rlog -r"${branch}" module | grep '^revision' | sed -e 's/revision *//' | head -n 10 | tail -n 1)"
+ fi
+ # export only works with symbolic tags
+ cvs -d "${repo}" checkout -r "${rev}" module
+ mv "module/${name}" "${dest}"
+ rm -rf module
+ ;;
+ arch)
+ cd "${tmpbase}"
+ rev="$(tla revisions x"${name}--${branch}--1.0" | head -n 10 | tail -n 1)"
+ tla get x"${name}--${branch}--1.0--${rev}" wd
+ mv wd/"${name}" "${dest}"
+ rm -rf wd
+ ;;
+ bazaar)
+ rev="$(bzr log -l 1 -r -12 --line "${repobase}/${name}/${branch}"|sed -e 's/:.*$//')"
+ cd "${tmpbase}"
+ bzr export -r "${rev}" wd "${repobase}/${name}/${branch}"
+ mv wd/"${name}" "${dest}"
+ rm -rf wd
+ ;;
+ darcs)
+ cd "${repobase}/${name}/${branch}"
+ hash="$(darcs changes --last=12 --xml-output|grep '^<patch'|tail -n 1|sed -e "s/^.*hash='\\([a-z0-9.-]*\\)'.*\$/\\1/")"
+ cd "${tmpbase}"
+ darcs get --to-match "hash ${hash}" --lazy "${repobase}/${name}/${branch}" wd
+ cp wd/"${name}" "${dest}"
+ rm -rf wd
+ ;;
+ git)
+ cd "${repobase}/${name}"
+ rev="$(git rev-list --max-count=12 "${branch}" -- |tail -n 1)"
+ git checkout "${rev}"
+ cp "${name}" "${dest}"
+ ;;
+ mercurial)
+ cd "${repobase}/${name}"
+ rev="$(hg log -b first -l 12 --template '{rev}\n'|tail -n 1)"
+ hg update -r "${rev}"
+ cp "${name}" "${dest}"
+ ;;
+ monotone)
+ cd "${tmpbase}"
+ rev="$(mtn --db="${repobase}/db.mtn" log --from="org.bar.foo.${name}.${branch}" --brief --last=12|grep ^o|tail -n 1|sed -e 's/^o *\([a-z0-9]*\) *.*$/\1/')"
+ mtn --db="${repobase}/db.mtn" --revision="${rev}" checkout wd
+ cp wd/"${name}" "${dest}"
+ rm -rf wd
+ ;;
+ subversion)
+ rev="$(svn log -l 12 -q file://"${repo}"/branches/"${branch}"|grep ^r|tail -n 1|cut -d ' ' -f 1)"
+ svn cat -r "${rev}" file://"${repo}"/branches/"${branch}"/"${name}" > "${dest}"
+ ;;
+ *)
+ echo "Unknown VCS ${vcs}"
+ exit 50
+ ;;
+esac
+
diff --git a/benchmarks/create-branch b/benchmarks/create-branch
index c649d8b..4e86e47 100755
--- a/benchmarks/create-branch
+++ b/benchmarks/create-branch
@@ -12,11 +12,12 @@ case "$vcs" in
cd "${tmpbase}"
# need working dir
if [ "${oldbranch}" = first ] ; then
- # HEAD is handled specially (non-sticky)
- cvs -d "${repo}" checkout module
+ # main branch is handled specially
+ rev="$(cvs -d "${repo}" rlog -b module | grep '^revision' | sed -e 's/revision *//' | head -n 10 | tail -n 1)"
else
- cvs -d "${repo}" checkout -r "${oldbranch}" module
+ rev="$(cvs -d "${repo}" rlog -r"${oldbranch}" module | grep '^revision' | sed -e 's/revision *//' | head -n 10 | tail -n 1)"
fi
+ cvs -d "${repo}" checkout -r "${rev}" module
cd module
cp "${content}" "${name}"
cvs -d "${repo}" tag -b "${newbranch}"
@@ -25,7 +26,8 @@ case "$vcs" in
rm -rf module
;;
arch)
- tla tag foo@bar.org--datastore/x"${name}--${oldbranch}--1.0" foo@bar.org--datastore/x"${name}--${newbranch}--1.0"
+ rev="$(tla revisions x"${name}--${oldbranch}--1.0" | head -n 10 | tail -n 1)"
+ tla tag foo@bar.org--datastore/x"${name}--${oldbranch}--1.0--${rev}" foo@bar.org--datastore/x"${name}--${newbranch}--1.0"
cd "${tmpbase}"
tla get foo@bar.org--datastore/x"${name}--${newbranch}--1.0" wd
cd wd
@@ -35,36 +37,42 @@ case "$vcs" in
rm -rf wd
;;
bazaar)
+ rev="$(bzr log -l 1 -r -12 --line "${repobase}/${name}/${oldbranch}"|sed -e 's/:.*$//')"
cd "${repobase}/${name}"
- bzr branch "${repobase}/${name}/${oldbranch}" "${newbranch}"
+ bzr branch -r "${rev}" "${repobase}/${name}/${oldbranch}" "${newbranch}"
cd "${repobase}/${name}/${newbranch}"
cp "${content}" "${name}"
bzr commit -m x
;;
darcs)
+ cd "${repobase}/${name}/${oldbranch}"
+ hash="$(darcs changes --last=12 --xml-output|grep '^<patch'|tail -n 1|sed -e "s/^.*hash='\\([a-z0-9.-]*\\)'.*\$/\\1/")"
cd "${repobase}/${name}"
- darcs get --lazy "${repobase}/${name}/${oldbranch}" "${newbranch}"
+ darcs get --to-match "hash ${hash}" --lazy "${repobase}/${name}/${oldbranch}" "${newbranch}"
cd "${newbranch}"
cp "${content}" "${name}"
darcs record --all --author="foo@bar.org" --skip-long-comment --compress --patch-name="x"
;;
git)
cd "${repobase}/${name}"
- git branch "${newbranch}" "${oldbranch}"
+ rev="$(git rev-list --max-count=12 "${oldbranch}" -- |tail -n 1)"
+ git branch "${newbranch}" "${rev}"
git checkout "${newbranch}"
cp "${content}" "${name}"
git commit -a -m x
;;
mercurial)
cd "${repobase}/${name}"
- hg update "${oldbranch}"
+ rev="$(hg log -b first -l 12 --template '{rev}\n'|tail -n 1)"
+ hg update -r "${rev}"
hg branch "${newbranch}"
cp "${content}" "${name}"
hg commit -m x
;;
monotone)
cd "${tmpbase}"
- mtn --db="${repobase}/db.mtn" --branch="org.bar.foo.${name}.${oldbranch}" checkout wd
+ rev="$(mtn --db="${repobase}/db.mtn" log --from="org.bar.foo.${name}.${oldbranch}" --brief --last=12|grep ^o|tail -n 1|sed -e 's/^o *\([a-z0-9]*\) *.*$/\1/')"
+ mtn --db="${repobase}/db.mtn" --revision="${rev}" checkout wd
cd wd
cp "${content}" "${name}"
mtn commit -m x --branch="org.bar.foo.${name}.${newbranch}"
@@ -72,8 +80,9 @@ case "$vcs" in
rm -rf wd
;;
subversion)
+ rev="$(svn log -l 12 -q file://"${repo}"/branches/"${oldbranch}"|grep ^r|tail -n 1|cut -d ' ' -f 1)"
cd "${tmpbase}"
- svn copy -m "" file://"${repo}/branches/${oldbranch}" file://"${repo}/branches/${newbranch}"
+ svn copy -m "" -r "${rev}" file://"${repo}/branches/${oldbranch}" file://"${repo}/branches/${newbranch}"
svn checkout file://"${repo}/branches/${newbranch}" wd
cd wd
cp "${content}" "${name}"
diff --git a/benchmarks/create-repo b/benchmarks/create-repo
index dfdd945..5e6b440 100755
--- a/benchmarks/create-repo
+++ b/benchmarks/create-repo
@@ -19,6 +19,7 @@ case "$vcs" in
if [ ! -d "${repobase}/repo" ] ; then
tla my-id 'datastore <foo@bar.org>'
tla make-archive foo@bar.org--datastore "${repobase}/repo"
+ tla my-default-archive foo@bar.org--datastore
fi
mkdir "${tmpbase}/wd"
cd "${tmpbase}/wd"
diff --git a/benchmarks/runbench b/benchmarks/runbench
index 3c3512d..7aa4cf4 100755
--- a/benchmarks/runbench
+++ b/benchmarks/runbench
@@ -68,6 +68,11 @@ def vcsCheckout(vcs, branch, fname) :
wcopy=os.path.join(tmpbase(vcs), fname)
runCmd("./checkout", vcs, nosuffix, branch, wcopy)
+def vcsCheckoutIntermediate(vcs, branch, fname) :
+ nosuffix=(fname+".").split(".")[0]
+ wcopy=os.path.join(tmpbase(vcs), fname)
+ runCmd("./checkout-intermediate", vcs, nosuffix, branch, wcopy)
+
def vcsCreateBranch(vcs, fname, oldbranch, newbranch, addText) :
nosuffix=(fname+".").split(".")[0]
wcopy=os.path.join(tmpbase(vcs), fname)
@@ -122,6 +127,9 @@ def runbench() :
sys.stderr.write("Testing checkout (first branch), 2/2\n")
mergeStats(stats, "checkoutFirst2Time", runVcs(lambda vcs: runTestfiles(lambda fname: vcsCheckout(vcs, "first", fname))))
+ sys.stderr.write("Testing checkout (first branch, intermediate version)\n")
+ mergeStats(stats, "checkoutIntermediateTime", runVcs(lambda vcs: runTestfiles(lambda fname: vcsCheckoutIntermediate(vcs, "first", fname))))
+
sys.stderr.write("Testing branch creation\n")
mergeStats(stats, "createBranchTime", runVcs(lambda vcs: runTestfiles(lambda fname: vcsCreateBranch(vcs, fname, "first", "branch1", "branch1"))))
mergeStats(stats, "repoSizeAfterCreateBranch", runVcs(lambda vcs: getDirSize(repobase(vcs))))