Mercurial > hg-stable
diff tests/test-ssh.t @ 16836:1ba3e17186c8
hg-ssh: read-only flag
Allows you to restrict a ssh key to have read-only access to a set of
repos by passing the --read-only flag to hg-ssh.
This is useful in an environment where the number of unix users you
can or are willing to create is limited. In such an environment,
multiple users or applications will share a single unix account. Some
of those applications will likely need read-only access to the
repository. This change makes it possible to grant them such access
without requiring that they use a separate unix account.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Tue, 22 May 2012 15:17:37 -0700 |
parents | 289fdcd4cb47 |
children | 2774576dee4d |
line wrap: on
line diff
--- a/tests/test-ssh.t Sun May 13 10:21:27 2012 +0200 +++ b/tests/test-ssh.t Tue May 22 15:17:37 2012 -0700 @@ -308,6 +308,41 @@ Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation [255] +Test hg-ssh in read-only mode: + + $ cat > ssh.sh << EOF + > userhost="\$1" + > SSH_ORIGINAL_COMMAND="\$2" + > export SSH_ORIGINAL_COMMAND + > PYTHONPATH="$PYTHONPATH" + > export PYTHONPATH + > python "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote" + > EOF + + $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local + requesting all changes + adding changesets + adding manifests + adding file changes + added 4 changesets with 5 changes to 4 files (+1 heads) + updating to branch default + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cd read-only-local + $ echo "baz" > bar + $ hg ci -A -m "unpushable commit" bar + $ hg push --ssh "sh ../ssh.sh" + pushing to ssh://user@dummy/$TESTTMP/remote + searching for changes + remote: Permission denied + remote: abort: prechangegroup.hg-ssh hook failed + remote: Permission denied + remote: abort: prepushkey.hg-ssh hook failed + abort: unexpected response: empty string + [255] + + $ cd .. + $ cat dummylog Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio