[PATCH] Allow using a ssh repository without a path.

Thomas Arendsen Hein thomas at intevation.de
Fri Aug 26 15:44:51 CDT 2005


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 4337cd845a2a495e6820d30788db25a8b48d10c0
# Parent  498456c2e8e5e73fe2eed3374cecec72fbfdcbea
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

diff -r 498456c2e8e5e73fe2eed3374cecec72fbfdcbea -r 4337cd845a2a495e6820d30788db25a8b48d10c0 mercurial/hg.py
--- a/mercurial/hg.py	Fri Aug 26 14:47:09 2005
+++ b/mercurial/hg.py	Fri Aug 26 20:40:56 2005
@@ -2157,26 +2157,22 @@
         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" % path)
 
         self.user = m.group(2)
         self.host = m.group(3)
         self.port = m.group(5)
-        self.path = m.group(7)
+        self.path = m.group(7) or "."
 
         args = self.user and ("%s@%s" % (self.user, self.host)) or self.host
         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")
 
         sshcmd = self.ui.config("ui", "ssh", "ssh")
         remotecmd = self.ui.config("ui", "remotecmd", "hg")
         cmd = "%s %s '%s -R %s serve --stdio'"
-        cmd = cmd % (sshcmd, args, remotecmd, path)
+        cmd = cmd % (sshcmd, args, remotecmd, self.path)
 
         self.pipeo, self.pipei, self.pipee = os.popen3(cmd)
 

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list