Mercurial > hg-git
comparison hggit/_ssh.py @ 1130:80664524802b
compat: add compatibility for 4.6 mercurial.utils
author | Sean Farley <sean@farley.io> |
---|---|
date | Thu, 24 May 2018 11:26:15 +0200 |
parents | 8ed6c0cae9b8 |
children |
comparison
equal
deleted
inserted
replaced
1129:5edabf9db748 | 1130:80664524802b |
---|---|
1 from dulwich.client import SubprocessWrapper | 1 from dulwich.client import SubprocessWrapper |
2 import subprocess | 2 import subprocess |
3 | 3 import compat |
4 from mercurial import ( | |
5 util, | |
6 ) | |
7 | 4 |
8 | 5 |
9 class SSHVendor(object): | 6 class SSHVendor(object): |
10 """Parent class for ui-linked Vendor classes.""" | 7 """Parent class for ui-linked Vendor classes.""" |
11 | 8 |
25 # 0.11.x dulwich sends an array of [command arg1 arg2 ...], so | 22 # 0.11.x dulwich sends an array of [command arg1 arg2 ...], so |
26 # we detect that here and reformat it back to what hg-git | 23 # we detect that here and reformat it back to what hg-git |
27 # expects (e.g. "command 'arg1 arg2'") | 24 # expects (e.g. "command 'arg1 arg2'") |
28 command = ["%s '%s'" % (command[0], ' '.join(command[1:]))] | 25 command = ["%s '%s'" % (command[0], ' '.join(command[1:]))] |
29 sshcmd = ui.config("ui", "ssh", "ssh") | 26 sshcmd = ui.config("ui", "ssh", "ssh") |
30 args = util.sshargs(sshcmd, host, username, port) | 27 args = compat.sshargs(sshcmd, host, username, port) |
31 cmd = '%s %s %s' % (sshcmd, args, | 28 cmd = '%s %s %s' % (sshcmd, args, |
32 util.shellquote(' '.join(command))) | 29 compat.shellquote(' '.join(command))) |
33 ui.debug('calling ssh: %s\n' % cmd) | 30 ui.debug('calling ssh: %s\n' % cmd) |
34 proc = subprocess.Popen(util.quotecommand(cmd), shell=True, | 31 proc = subprocess.Popen(compat.quotecommand(cmd), shell=True, |
35 stdin=subprocess.PIPE, | 32 stdin=subprocess.PIPE, |
36 stdout=subprocess.PIPE) | 33 stdout=subprocess.PIPE) |
37 return SubprocessWrapper(proc) | 34 return SubprocessWrapper(proc) |
38 | 35 |
39 return _Vendor | 36 return _Vendor |