Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hg.py @ 1069:4337cd845a2a
Allow using a ssh repository without a path.
This uses the home directory on the remote side or the directory
specified in the command in .ssh/authorized_keys
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 26 Aug 2005 22:40:56 +0200 |
parents | 6d5a62a549fa |
children | 05dc7aba22eb |
comparison
equal
deleted
inserted
replaced
1068:498456c2e8e5 | 1069:4337cd845a2a |
---|---|
2155 class sshrepository(remoterepository): | 2155 class sshrepository(remoterepository): |
2156 def __init__(self, ui, path): | 2156 def __init__(self, ui, path): |
2157 self.url = path | 2157 self.url = path |
2158 self.ui = ui | 2158 self.ui = ui |
2159 | 2159 |
2160 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))', path) | 2160 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path) |
2161 if not m: | 2161 if not m: |
2162 raise RepoError("couldn't parse destination %s" % path) | 2162 raise RepoError("couldn't parse destination %s" % path) |
2163 | 2163 |
2164 self.user = m.group(2) | 2164 self.user = m.group(2) |
2165 self.host = m.group(3) | 2165 self.host = m.group(3) |
2166 self.port = m.group(5) | 2166 self.port = m.group(5) |
2167 self.path = m.group(7) | 2167 self.path = m.group(7) or "." |
2168 | 2168 |
2169 args = self.user and ("%s@%s" % (self.user, self.host)) or self.host | 2169 args = self.user and ("%s@%s" % (self.user, self.host)) or self.host |
2170 args = self.port and ("%s -p %s") % (args, self.port) or args | 2170 args = self.port and ("%s -p %s") % (args, self.port) or args |
2171 path = self.path or "" | |
2172 | |
2173 if not path: | |
2174 raise RepoError("no remote repository path specified") | |
2175 | 2171 |
2176 sshcmd = self.ui.config("ui", "ssh", "ssh") | 2172 sshcmd = self.ui.config("ui", "ssh", "ssh") |
2177 remotecmd = self.ui.config("ui", "remotecmd", "hg") | 2173 remotecmd = self.ui.config("ui", "remotecmd", "hg") |
2178 cmd = "%s %s '%s -R %s serve --stdio'" | 2174 cmd = "%s %s '%s -R %s serve --stdio'" |
2179 cmd = cmd % (sshcmd, args, remotecmd, path) | 2175 cmd = cmd % (sshcmd, args, remotecmd, self.path) |
2180 | 2176 |
2181 self.pipeo, self.pipei, self.pipee = os.popen3(cmd) | 2177 self.pipeo, self.pipei, self.pipee = os.popen3(cmd) |
2182 | 2178 |
2183 def readerr(self): | 2179 def readerr(self): |
2184 while 1: | 2180 while 1: |