Mercurial > hg-stable
changeset 817:cf1d9a01dd92
Make ssh URL parsing more robust
author | mpm@selenic.com |
---|---|
date | Mon, 01 Aug 2005 23:23:51 -0800 |
parents | 8674b7803714 |
children | eef752151556 |
files | mercurial/hg.py |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hg.py Mon Aug 01 23:17:22 2005 -0800 +++ b/mercurial/hg.py Mon Aug 01 23:23:51 2005 -0800 @@ -1879,9 +1879,9 @@ self.url = path self.ui = ui - m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path) + m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))', path) if not m: - raise RepoError("couldn't parse destination %s\n" % path) + raise RepoError("couldn't parse destination %s" % path) self.user = m.group(2) self.host = m.group(3) @@ -1892,6 +1892,9 @@ args = self.port and ("%s -p %s") % (args, self.port) or args path = self.path or "" + if not path: + raise RepoError("no remote repository path specified") + cmd = "ssh %s 'hg -R %s serve --stdio'" cmd = cmd % (args, path) @@ -1906,11 +1909,14 @@ self.ui.status("remote: ", l) def __del__(self): - self.pipeo.close() - self.pipei.close() - for l in self.pipee: - self.ui.status("remote: ", l) - self.pipee.close() + try: + self.pipeo.close() + self.pipei.close() + for l in self.pipee: + self.ui.status("remote: ", l) + self.pipee.close() + except: + pass def dev(self): return -1