|
|
#!/bin/sh
|
|
|
|
|
|
"$TESTDIR/hghave" mtn || exit 80
|
|
|
|
|
|
# Monotone directory is called .monotone on *nix and monotone
|
|
|
# on Windows. Having a variable here ease test patching.
|
|
|
mtndir=.monotone
|
|
|
echo "[extensions]" >> $HGRCPATH
|
|
|
echo "convert=" >> $HGRCPATH
|
|
|
echo 'hgext.graphlog =' >> $HGRCPATH
|
|
|
|
|
|
HOME=`pwd`/do_not_use_HOME_mtn; export HOME
|
|
|
# Windows version of monotone home
|
|
|
APPDATA=$HOME; export APPDATA
|
|
|
|
|
|
echo % tedious monotone keys configuration
|
|
|
# The /dev/null redirection is necessary under Windows, or
|
|
|
# it complains about home directory permissions
|
|
|
mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF
|
|
|
passphrase
|
|
|
passphrase
|
|
|
EOF
|
|
|
cat >> $HOME/$mtndir/monotonerc <<EOF
|
|
|
function get_passphrase(keypair_id)
|
|
|
return "passphrase"
|
|
|
end
|
|
|
EOF
|
|
|
|
|
|
echo % create monotone repository
|
|
|
mtn db init --db=repo.mtn
|
|
|
mtn --db=repo.mtn --branch=com.selenic.test setup workingdir
|
|
|
cd workingdir
|
|
|
echo a > a
|
|
|
mkdir dir
|
|
|
echo b > dir/b
|
|
|
echo d > dir/d
|
|
|
python -c 'file("bin", "wb").write("a\\x00b")'
|
|
|
echo c > c
|
|
|
mtn add a dir/b dir/d c bin
|
|
|
mtn ci -m initialize
|
|
|
echo % update monotone working directory
|
|
|
mtn mv a dir/a
|
|
|
echo a >> dir/a
|
|
|
echo b >> dir/b
|
|
|
mtn drop c
|
|
|
python -c 'file("bin", "wb").write("b\\x00c")'
|
|
|
mtn ci -m update1
|
|
|
cd ..
|
|
|
|
|
|
echo % convert once
|
|
|
hg convert -s mtn repo.mtn
|
|
|
|
|
|
cd workingdir
|
|
|
echo e > e
|
|
|
mtn add e
|
|
|
mtn drop dir/b
|
|
|
mtn mv bin bin2
|
|
|
mtn ci -m 'update2 "with" quotes'
|
|
|
echo '% test directory move'
|
|
|
mkdir -p dir1/subdir1
|
|
|
mkdir -p dir1/subdir2_other
|
|
|
echo file1 > dir1/subdir1/file1
|
|
|
echo file2 > dir1/subdir2_other/file1
|
|
|
mtn add dir1/subdir1/file1 dir1/subdir2_other/file1
|
|
|
mtn ci -m createdir1
|
|
|
mtn rename dir1/subdir1 dir1/subdir2
|
|
|
mtn ci -m movedir1
|
|
|
echo '% test subdirectory move'
|
|
|
mtn mv dir dir2
|
|
|
echo newfile > dir2/newfile
|
|
|
mtn drop dir2/d
|
|
|
mtn add dir2/newfile
|
|
|
mtn ci -m movedir
|
|
|
# Test directory removal with empty directory
|
|
|
mkdir dir2/dir
|
|
|
mkdir dir2/dir/subdir
|
|
|
echo f > dir2/dir/subdir/f
|
|
|
mkdir dir2/dir/emptydir
|
|
|
mtn add --quiet -R dir2/dir
|
|
|
mtn ci -m emptydir
|
|
|
mtn drop -R dir2/dir
|
|
|
mtn ci -m dropdirectory
|
|
|
echo '% test directory and file move'
|
|
|
mkdir -p dir3/d1
|
|
|
echo a > dir3/a
|
|
|
mtn add dir3/a dir3/d1
|
|
|
mtn ci -m dirfilemove
|
|
|
mtn mv dir3/a dir3/d1/a
|
|
|
mtn mv dir3/d1 dir3/d2
|
|
|
mtn ci -m dirfilemove2
|
|
|
cd ..
|
|
|
|
|
|
echo % convert incrementally
|
|
|
hg convert -s mtn repo.mtn
|
|
|
|
|
|
glog()
|
|
|
{
|
|
|
hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
|
|
|
}
|
|
|
|
|
|
cd repo.mtn-hg
|
|
|
hg up -C
|
|
|
glog
|
|
|
echo % manifest
|
|
|
hg manifest
|
|
|
echo % contents
|
|
|
cat dir2/a
|
|
|
test -d dir2/dir && echo 'removed dir2/dir is still there!'
|
|
|
|
|
|
echo % file move
|
|
|
hg log -v -C -r 1 | grep copies
|
|
|
echo % check directory move
|
|
|
hg manifest -r 4
|
|
|
test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!'
|
|
|
test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!'
|
|
|
hg log -v -C -r 4 | grep copies
|
|
|
echo % check file remove with directory move
|
|
|
hg manifest -r 5
|
|
|
echo % check file move with directory move
|
|
|
hg manifest -r 9
|
|
|
exit 0
|
|
|
|
|
|
|