action/test1
author Paul Crowley <paul@lshift.net>
Tue, 15 Dec 2009 13:52:23 +0000
changeset 268 24145a4eb6fc
parent 266 7cc208cbf2be
child 269 a09f1bc9a6cf
permissions -rwxr-xr-x
Test file access conditions - they don't work
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     1
#!/bin/sh
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     2
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     3
set -e
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     4
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     5
cd
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     6
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     7
cat > .ssh/config <<__END__
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     8
Host chroothg
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
     9
Hostname localhost
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    10
User hg
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    11
Port 2222
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    12
__END__
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    13
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    14
echo "Cloning hgadmin..."
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    15
hg clone ssh://chroothg/hgadmin
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    16
echo "Updating hgadmin..."
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    17
cd hgadmin
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    18
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    19
cat > access.conf <<__END__
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    20
read user=restricted/** file=special/**
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    21
write user=restricted/**
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    22
__END__
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    23
mkdir -p keys/restricted
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    24
cp /home/test2/.ssh/id_rsa.pub keys/restricted/test2
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    25
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    26
hg add keys/restricted/test2 access.conf
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    27
hg commit -u test1 -m "Added user test2"
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    28
echo "Push"
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    29
hg push
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    30
cd ..
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    31
mkdir realrepo
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    32
cd realrepo
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    33
hg init .
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    34
echo "This is a file" > content
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    35
mkdir special
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    36
echo "This is a file not everyone can write to" > special/cantwrite
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    37
hg add content special/cantwrite
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    38
hg commit -u test1 -m "Add a file to the repo"
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    39
echo "Pushing changes"
266
7cc208cbf2be Runs a real live test of mercurial-server from beginning to end
Paul Crowley <paul@lshift.net>
parents:
diff changeset
    40
hg clone . ssh://chroothg/real/project
268
24145a4eb6fc Test file access conditions - they don't work
Paul Crowley <paul@lshift.net>
parents: 266
diff changeset
    41
echo "Done for user test1"