Support syncing over ssh with ssh://host//path.
authorMichał Górny <mgorny@gentoo.org>
Fri, 19 Nov 2010 18:58:26 +0000 (19:58 +0100)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 02:04:56 +0000 (18:04 -0800)
pym/_emerge/actions.py

index fc2048ab36a8c1adcaca48fb7f6ba00e004a156e..23d0f89dd97de2a266865545095363d003e69b7a 100644 (file)
@@ -1989,7 +1989,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                exitcode = git_sync_timestamps(settings, myportdir)
                if exitcode == os.EX_OK:
                        updatecache_flg = True
-       elif syncuri[:8]=="rsync://":
+       elif syncuri[:8]=="rsync://" or syncuri[:6]=="ssh://":
                for vcs_dir in vcs_dirs:
                        writemsg_level(("!!! %s appears to be under revision " + \
                                "control (contains %s).\n!!! Aborting rsync sync.\n") % \
@@ -2097,8 +2097,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                        maxretries = -1 #default number of retries
 
                retries=0
-               user_name, hostname, port = re.split(
-                       "rsync://([^:/]+@)?([^:/]*)(:[0-9]+)?", syncuri, maxsplit=3)[1:4]
+               proto, user_name, hostname, port = re.split(
+                       "(rsync|ssh)://([^:/]+@)?([^:/]*)(:[0-9]+)?", syncuri, maxsplit=4)[1:5]
                if port is None:
                        port=""
                if user_name is None:
@@ -2203,6 +2203,9 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                        "\n\n>>> Starting retry %d of %d with %s\n" % \
                                        (retries, effective_maxretries, dosyncuri), noiselevel=-1)
 
+                       if dosyncuri.startswith('ssh://'):
+                               dosyncuri = dosyncuri[6:].replace('/', ':', 1)
+
                        if mytimestamp != 0 and "--quiet" not in myopts:
                                print(">>> Checking server timestamp ...")