MCPcopy Create free account
hub / github.com/libgit2/pygit2 / fetch

Method fetch

pygit2/remotes.py:202–247  ·  view source on GitHub ↗

Perform a fetch against this remote. Returns a object. Parameters: prune : enums.FetchPrune * `UNSPECIFIED`: use the configuration from the repository. * `PRUNE`: remove any remote branch in the local repository that

(
        self,
        refspecs: list[str] | None = None,
        message: str | None = None,
        callbacks: RemoteCallbacks | None = None,
        prune: FetchPrune = FetchPrune.UNSPECIFIED,
        proxy: None | Literal[True] | str = None,
        depth: int = 0,
    )

Source from the content-addressed store, hash-verified

200 payload.check_error(err)
201
202 def fetch(
203 self,
204 refspecs: list[str] | None = None,
205 message: str | None = None,
206 callbacks: RemoteCallbacks | None = None,
207 prune: FetchPrune = FetchPrune.UNSPECIFIED,
208 proxy: None | Literal[True] | str = None,
209 depth: int = 0,
210 ) -> TransferProgress:
211 """Perform a fetch against this remote. Returns a <TransferProgress>
212 object.
213
214 Parameters:
215
216 prune : enums.FetchPrune
217 * `UNSPECIFIED`: use the configuration from the repository.
218 * `PRUNE`: remove any remote branch in the local repository
219 that does not exist in the remote.
220 * `NO_PRUNE`: always keep the remote branches
221
222 proxy : None or True or str
223 Proxy configuration. Can be one of:
224
225 * `None` (the default) to disable proxy usage
226 * `True` to enable automatic proxy detection
227 * an url to a proxy (`http://proxy.example.org:3128/`)
228
229 depth : int
230 Number of commits from the tip of each remote branch history to fetch.
231
232 If non-zero, the number of commits from the tip of each remote
233 branch history to fetch. If zero, all history is fetched.
234 The default is 0 (all history is fetched).
235 """
236 with git_fetch_options(callbacks) as payload:
237 opts = payload.fetch_options
238 opts.prune = prune
239 opts.depth = depth
240 with git_proxy_options(self, payload.fetch_options.proxy_opts, proxy):
241 with StrArray(refspecs) as arr:
242 err = C.git_remote_fetch(
243 self._remote, arr.ptr, opts, to_bytes(message)
244 )
245 payload.check_error(err)
246
247 return TransferProgress(C.git_remote_stats(self._remote))
248
249 def list_heads(
250 self,

Callers 15

test_fetchFunction · 0.80
test_fetch_depth_zeroFunction · 0.80
test_fetch_depth_oneFunction · 0.80
test_transfer_progressFunction · 0.80
test_update_tipsFunction · 0.80
test_fetchFunction · 0.80
test_fetch_remote_pruneFunction · 0.80
test_fetch_no_pruneFunction · 0.80
test_remote_pruneFunction · 0.80
repoFunction · 0.80
test_callbackFunction · 0.80

Calls 6

git_fetch_optionsFunction · 0.85
git_proxy_optionsFunction · 0.85
StrArrayClass · 0.85
to_bytesFunction · 0.85
TransferProgressClass · 0.85
check_errorMethod · 0.80

Tested by 15

test_fetchFunction · 0.64
test_fetch_depth_zeroFunction · 0.64
test_fetch_depth_oneFunction · 0.64
test_transfer_progressFunction · 0.64
test_update_tipsFunction · 0.64
test_fetchFunction · 0.64
test_fetch_remote_pruneFunction · 0.64
test_fetch_no_pruneFunction · 0.64
test_remote_pruneFunction · 0.64
repoFunction · 0.64
test_callbackFunction · 0.64