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

Function git_push_options

pygit2/callbacks.py:425–454  ·  view source on GitHub ↗
(payload, opts=None)

Source from the content-addressed store, hash-verified

423
424@contextmanager
425def git_push_options(payload, opts=None):
426 if payload is None:
427 payload = RemoteCallbacks()
428
429 opts = ffi.new('git_push_options *')
430 C.git_push_options_init(opts, C.GIT_PUSH_OPTIONS_VERSION)
431
432 # Plug callbacks
433 opts.callbacks.sideband_progress = C._sideband_progress_cb
434 opts.callbacks.transfer_progress = C._transfer_progress_cb
435 opts.callbacks.update_tips = C._update_tips_cb
436 opts.callbacks.credentials = C._credentials_cb
437 opts.callbacks.certificate_check = C._certificate_check_cb
438 opts.callbacks.push_update_reference = C._push_update_reference_cb
439 opts.callbacks.push_negotiation = C._push_negotiation_cb
440 # Per libgit2 sources, push_transfer_progress may incur a performance hit.
441 # So, set it only if the user has overridden the no-op stub.
442 if (
443 type(payload).push_transfer_progress
444 is not RemoteCallbacks.push_transfer_progress
445 ):
446 opts.callbacks.push_transfer_progress = C._push_transfer_progress_cb
447 # Payload
448 handle = ffi.new_handle(payload)
449 opts.callbacks.payload = handle
450
451 # Give back control
452 payload.push_options = opts
453 payload._stored_exception = None
454 yield payload
455
456
457@contextmanager

Callers 1

pushMethod · 0.85

Calls 1

RemoteCallbacksClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…