Mercurial > public > mercurial-scm > hg
diff mercurial/sshrepo.py @ 15622:86fc364ca5f8
sshrepo: don't quote obviously safe strings (issue2983)
This restores compatibility with hg-over-ssh servers that don't parse
commandlines as sh does but works ok in the most common cases.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 08 Dec 2011 16:39:00 +0100 |
parents | d8fa35c28335 |
children | be43234a6d60 |
line wrap: on
line diff
--- a/mercurial/sshrepo.py Wed Nov 16 15:29:57 2011 -0600 +++ b/mercurial/sshrepo.py Thu Dec 08 16:39:00 2011 +0100 @@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +import re from i18n import _ import util, error, wireproto @@ -20,6 +21,8 @@ def _serverquote(s): '''quote a string for the remote shell ... which we assume is sh''' + if re.match(r'[a-zA-Z0-9._\-/]*$', s): + return s return "'%s'" % s.replace("'", "'\\''") class sshrepository(wireproto.wirerepository):