浏览代码

Support variable arguments in SSHGitClient.

Jelmer Vernooij 16 年之前
父节点
当前提交
e1c25764ff
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      dulwich/client.py

+ 5 - 4
dulwich/client.py

@@ -276,18 +276,19 @@ get_ssh_vendor = SSHVendor
 
 class SSHGitClient(GitClient):
 
-    def __init__(self, host, port=None, thin_packs=True):
+    def __init__(self, host, port=None, *args, **kwargs):
         self.host = host
         self.port = port
-        self._thin_packs = thin_packs
+        self._args = args
+        self._kwargs = kwargs
 
     def send_pack(self, path):
         remote = get_ssh_vendor().connect_ssh(self.host, ["git-receive-pack %s" % path], port=self.port)
-        client = GitClient(lambda: _fileno_can_read(remote.proc.stdout.fileno()), remote.recv, remote.send, thin_packs=self._thin_packs)
+        client = GitClient(lambda: _fileno_can_read(remote.proc.stdout.fileno()), remote.recv, remote.send, *self._args, **self._kwargs)
         client.send_pack(path)
 
     def fetch_pack(self, path, determine_wants, graph_walker, pack_data, progress):
         remote = get_ssh_vendor().connect_ssh(self.host, ["git-upload-pack %s" % path], port=self.port)
-        client = GitClient(lambda: _fileno_can_read(remote.proc.stdout.fileno()), remote.recv, remote.send, thin_packs=self._thin_packs)
+        client = GitClient(lambda: _fileno_can_read(remote.proc.stdout.fileno()), remote.recv, remote.send, *self._args, **self._kwargs)
         client.fetch_pack(path, determine_wants, graph_walker, pack_data, progress)