dev/chroot-test/action/test1
author Cédric Krier <ced@b2ck.com>
Fri, 20 Jul 2018 17:17:49 +0200
changeset 376 d503d5a786f3
parent 309 091630a3938e
permissions -rwxr-xr-x
Remove usage of changectx The method has been removed in changeset 836867586b83 of Mercurial.

#!/bin/sh

set -e

cd

cat > .ssh/config <<__END__
Host chroothg
Hostname localhost
User hg
Port 2222
__END__

echo "Cloning hgadmin..."
hg clone ssh://chroothg/hgadmin
echo "Updating hgadmin..."
cd hgadmin

cat > access.conf <<__END__
read user=restricted/** file=denied/**
write user=restricted/**
__END__
mkdir -p keys/restricted
cp /home/test2/.ssh/id_rsa.pub keys/restricted/test2

hg add keys/restricted/test2 access.conf
hg commit -u test1 -m "Added user test2"
echo "Push"
hg push
cd ..
hg init realrepo
cd realrepo
mkdir denied
echo "This is a file" > content
echo "This is a file not everyone can write to" > denied/cantwrite
hg init nested
echo "This is a file in a nested repo" > nested/content
hg add -R nested nested/content
hg commit -u test1 -R nested -m "Add files to the subrepo"
echo "nested = nested" > .hgsub
hg add content denied/cantwrite .hgsub
hg commit -u test1 -m "Add files to the repo"
echo "Pushing changes"
hg clone . ssh://chroothg/real/project
hg clone nested ssh://chroothg/real/project/nested
cd ..
echo "Creating an mq repository"
hg init qrepo
(cd qrepo ; hg --config extensions.mq= qinit -c)
hg --config extensions.mq= qclone qrepo ssh://chroothg/qrepo
echo "Done for user test1"