[PATCH 2 of 4] sshrepo: don't quote obviously safe strings (issue2983)

Matt Mackall mpm at selenic.com
Thu Dec 8 15:28:27 CST 2011


On Thu, 2011-12-08 at 16:39 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1323358740 -3600
> # Node ID 77453ef261ddcf5e672a6ec0ff6a5f578bcb8ccc
> # Parent  4aa9809bdb092d02a7d60efb902e02b3c38788d7
> sshrepo: don't quote obviously safe strings (issue2983)

Queued for default, thanks.

>  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("'", "'\\''")

Another great opportunity for doctests.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list