@@ -106,7 +106,7 @@ def save(self):
106
106
err = C .git_remote_save (self ._remote )
107
107
check_error (err )
108
108
109
- def fetch (self , refspecs = None , message = None , callbacks = None , prune = C .GIT_FETCH_PRUNE_UNSPECIFIED ):
109
+ def fetch (self , refspecs = None , message = None , callbacks = None , prune = C .GIT_FETCH_PRUNE_UNSPECIFIED , proxy = None ):
110
110
"""Perform a fetch against this remote. Returns a <TransferProgress>
111
111
object.
112
112
@@ -118,11 +118,23 @@ def fetch(self, refspecs=None, message=None, callbacks=None, prune=C.GIT_FETCH_P
118
118
repo, the second will remove any remote branch in the local
119
119
repository that does not exist in the remote and the last will
120
120
always keep the remote branches
121
+
122
+ proxy : None or True or str
123
+ Proxy configuration. Can be one of:
124
+
125
+ * `None` (the default) to disable proxy usage
126
+ * `True` to enable automatic proxy detection
127
+ * an url to a proxy (`http://proxy.example.org:3128/`)
121
128
"""
122
129
message = to_bytes (message )
123
130
with git_fetch_options (callbacks ) as payload :
124
131
opts = payload .fetch_options
125
132
opts .prune = prune
133
+ if proxy is True :
134
+ opts .proxy_opts .type = C .GIT_PROXY_AUTO
135
+ elif proxy is not None :
136
+ opts .proxy_opts .type = C .GIT_PROXY_SPECIFIED
137
+ opts .proxy_opts .url = proxy
126
138
with StrArray (refspecs ) as arr :
127
139
err = C .git_remote_fetch (self ._remote , arr , opts , to_bytes (message ))
128
140
payload .check_error (err )
0 commit comments