equal
deleted
inserted
replaced
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
4 # |
4 # |
5 # This software may be used and distributed according to the terms of the |
5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. |
6 # GNU General Public License version 2 or any later version. |
7 |
7 |
|
8 import re |
8 from i18n import _ |
9 from i18n import _ |
9 import util, error, wireproto |
10 import util, error, wireproto |
10 |
11 |
11 class remotelock(object): |
12 class remotelock(object): |
12 def __init__(self, repo): |
13 def __init__(self, repo): |
18 if self.repo: |
19 if self.repo: |
19 self.release() |
20 self.release() |
20 |
21 |
21 def _serverquote(s): |
22 def _serverquote(s): |
22 '''quote a string for the remote shell ... which we assume is sh''' |
23 '''quote a string for the remote shell ... which we assume is sh''' |
|
24 if re.match(r'[a-zA-Z0-9._\-/]*$', s): |
|
25 return s |
23 return "'%s'" % s.replace("'", "'\\''") |
26 return "'%s'" % s.replace("'", "'\\''") |
24 |
27 |
25 class sshrepository(wireproto.wirerepository): |
28 class sshrepository(wireproto.wirerepository): |
26 def __init__(self, ui, path, create=False): |
29 def __init__(self, ui, path, create=False): |
27 self._url = path |
30 self._url = path |