# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1445280066 25200
#      Mon Oct 19 11:41:06 2015 -0700
# Node ID d1546c673c65139b53efe18f963cc9dbd0684493
# Parent  93d58b79d8163687d33ee39fcb464ba2d10ad8ce
ssh: fix breakage with dulwich update

dulwich 0.11.x changed the way they pass parameters around, so we reformat that
to what hg-git expects.

diff --git a/hggit/_ssh.py b/hggit/_ssh.py
--- a/hggit/_ssh.py
+++ b/hggit/_ssh.py
@@ -14,6 +14,11 @@
 
     class _Vendor(SSHVendor):
         def run_command(self, host, command, username=None, port=None):
+            # newer dulwich changes the way they pass command and parameters
+            # around, so we detect that here and reformat it back to what
+            # hg-git expects (e.g. "command 'arg1 arg2'")
+            if len(command) > 1:
+                command = ["%s '%s'" % (command[0], ' '.join(command[1:]))]
             sshcmd = ui.config("ui", "ssh", "ssh")
             args = util.sshargs(sshcmd, host, username, port)
             cmd = '%s %s %s' % (sshcmd, args,