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,
)
| 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, |