Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka Git Push Remote

From Leeroopedia


Knowledge Sources
Domains Development_Workflow, Version_Control
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for pushing merged changes to the remote repository provided by the kafka-merge-pr script.

Description

The git push command is executed via run_cmd within the merge_pr and cherry_pick functions. It pushes from a local temporary branch to the corresponding remote branch using the configured PUSH_REMOTE_NAME (default "apache").

Usage

Invoked automatically within merge_pr and cherry_pick functions. Not called directly by users.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: committer-tools/kafka-merge-pr.py
  • Lines: L200-204 (in merge_pr), L234-238 (in cherry_pick)

Signature

def run_cmd(cmd):
    """
    Executes a shell command and returns decoded UTF-8 output.
    Accepts string or list.
    """

# Used as:
run_cmd(f"git push {PUSH_REMOTE_NAME} {local_branch}:{remote_branch}")

Import

# Internal function in kafka-merge-pr.py
import subprocess

I/O Contract

Inputs

Name Type Required Description
cmd str Yes Git push command string
PUSH_REMOTE_NAME str No Remote name (default: "apache")

Outputs

Name Type Description
return str Git push command output

Usage Examples

# Embedded in merge_pr
run_cmd(f"git push apache tmp_merge_branch:trunk")

# Embedded in cherry_pick
run_cmd(f"git push apache tmp_cherry_branch:3.7")

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment