Push the given refspec to the remote. Raises ``GitError`` on protocol error or unpack failure. When the remote has a githook installed, that denies the reference this function will return successfully. Thus it is strongly recommended to install a callback, t
(
self,
specs: list[str],
callbacks: RemoteCallbacks | None = None,
proxy: None | bool | str = None,
push_options: None | list[str] = None,
threads: int = 1,
)
| 341 | return strarray_to_strings(specs) |
| 342 | |
| 343 | def push( |
| 344 | self, |
| 345 | specs: list[str], |
| 346 | callbacks: RemoteCallbacks | None = None, |
| 347 | proxy: None | bool | str = None, |
| 348 | push_options: None | list[str] = None, |
| 349 | threads: int = 1, |
| 350 | ) -> None: |
| 351 | """ |
| 352 | Push the given refspec to the remote. Raises ``GitError`` on protocol |
| 353 | error or unpack failure. |
| 354 | |
| 355 | When the remote has a githook installed, that denies the reference this |
| 356 | function will return successfully. Thus it is strongly recommended to |
| 357 | install a callback, that implements |
| 358 | :py:meth:`RemoteCallbacks.push_update_reference` and check the passed |
| 359 | parameters for successful operations. |
| 360 | |
| 361 | Parameters: |
| 362 | |
| 363 | specs : [str] |
| 364 | Push refspecs to use. |
| 365 | |
| 366 | callbacks : |
| 367 | |
| 368 | proxy : None or True or str |
| 369 | Proxy configuration. Can be one of: |
| 370 | |
| 371 | * `None` (the default) to disable proxy usage |
| 372 | * `True` to enable automatic proxy detection |
| 373 | * an url to a proxy (`http://proxy.example.org:3128/`) |
| 374 | |
| 375 | push_options : [str] |
| 376 | Push options to send to the server, which passes them to the |
| 377 | pre-receive as well as the post-receive hook. |
| 378 | |
| 379 | threads : int |
| 380 | If the transport being used to push to the remote requires the |
| 381 | creation of a pack file, this controls the number of worker threads |
| 382 | used by the packbuilder when creating that pack file to be sent to |
| 383 | the remote. |
| 384 | |
| 385 | If set to 0, the packbuilder will auto-detect the number of threads |
| 386 | to create. The default value is 1. |
| 387 | """ |
| 388 | with git_push_options(callbacks) as payload: |
| 389 | opts = payload.push_options |
| 390 | opts.pb_parallelism = threads |
| 391 | with git_proxy_options(self, payload.push_options.proxy_opts, proxy): |
| 392 | with StrArray(specs) as refspecs, StrArray(push_options) as pushopts: |
| 393 | pushopts.assign_to(opts.remote_push_options) |
| 394 | err = C.git_remote_push(self._remote, refspecs.ptr, opts) |
| 395 | payload.check_error(err) |
| 396 | |
| 397 | |
| 398 | class RemoteCollection: |