Commit Graph

17 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
0e48f36a63 misc: use modern exception syntax
This is fixing for 'legacy exception syntax; use "as" instead of ","'
check-code rule.

check-code has overlooked these, because files aren't recognized as
one to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:29 +09:00
FUJIWARA Katsunori
05a600c8af hg-ssh: parenthesize non-translated message
This is fixing for 'missing _() in ui message (use () to hide
false-positives)' check-code rule.

check-code has overlooked this, because a file isn't recognized as one
to be checked (this problem is fixed by subsequent patch).
2016-02-10 22:44:28 +09:00
Pierre-Yves David
175fe35444 hg-ssh: reject push earlier (on pretxnopen)
We now have a lock triggered for any transaction. We use it to ensure no-read
are made in read-only mode. We need more that just "no changegroup is added",
since bundle2 allows for more than just changegroup to be exchanged.  We still
protect pushkey as it may write data without opening a transaction.
2015-05-10 04:39:11 -07:00
David Schleimer
499f4df5a8 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.
2012-05-22 15:17:37 -07:00
David Schleimer
fc014ab773 hg-ssh: refactor to have main() method
Refactor hg-ssh to have a main() function instead of a bunch of
top-level statements.
2012-05-21 16:19:30 -07:00
Mads Kiilerich
99a4f5f5b9 hg-ssh: exit with 255 instead of -1 on error
Unix sh would cast -1 to 255 anyway, but on windows -1 become 0. Better be
explicit with the 255 everywhere.
2012-05-07 00:52:08 +02:00
Mads Kiilerich
91529dce53 hg-ssh: use %s for printing paths in error messages
This avoids \\ if this ever is run on windows - for example in the test suite.
2012-05-07 00:49:01 +02:00
Mads Kiilerich
80b4f15548 hg-ssh: use shlex for shell-like parsing of SSH_ORIGINAL_COMMAND
The Mercurial ssh protocol is defined as if it was ssh-ing to a shell account on
an ordinary ssh server, and where hg was available in $PATH and it executed
the command "hg -R REPOPATH serve --stdio".

The Mercurial ssh client can in most cases just pass REPOPATH to the shell, but
if it contains unsafe characters the client will have to quote it so the shell
will pass the right -R value to hg. Correct quoting of repopaths was introduced
in 7bec00a7d7a6 and tweaked in c3194121de6c.

hg-ssh doesn't create the command via a shell and used a simple parser instead.
It worked fine for simple paths without any quoting, but if any kind of quoting
was used it failed to parse the command like the shell would do it.

This makes hg-ssh behave more like a normal shell with hg in the path would do.
2011-12-08 16:28:18 +01:00
Idan Kamara
04f3767289 hg-ssh: fix dispatch call to use dispatch.request()
e1a0c549e195 changed dispatch.dispatch() to accept a
request object instead of a list of arguments
2011-05-29 13:43:50 +03:00
Andreas Freimuth
0a5e675fad hg-ssh: fix duplicate word in docstring 2011-04-22 16:43:06 +02:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Martin Geisler
7d509c2459 add blank line after copyright notices and after header 2009-04-26 01:25:53 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Thomas Arendsen Hein
90d76a6ec9 Enable demandimport only in scripts, not in importable modules (issue605)
This way other applications can choose if and when they want this feature,
because it might be problematic if those applications rely on ImportError.
2007-08-18 11:37:08 +02:00
Thomas Arendsen Hein
3574aa1bb0 Adjust contrib/hg-ssh for moved dispatch() function. 2007-08-17 19:11:16 +02:00
Thomas Arendsen Hein
6ca7b37617 Added hint to hg-ssh that you can use shell pattern matching. 2006-01-26 16:37:31 +01:00
Thomas Arendsen Hein
cbb024cd1e Added hg-ssh - a wrapper for ssh access to a limited set of mercurial repos
To be used in ~/.ssh/authorized_keys with the "command" option, see sshd(8):
command="hg-ssh path/to/repo1 /path/to/repo2 ~/repo3 ~user/repo4" ssh-dss ...
(probably together with these other useful options:
 no-port-forwarding,no-X11-forwarding,no-agent-forwarding)

This allows pull/push over ssh to to the repositories given as arguments.

If all your repositories are subdirectories of a common directory, you can
allow shorter paths with:
command="cd path/to/my/repositories && hg-ssh repo1 subdir/repo2"
2005-11-13 02:06:02 +01:00