diff --git a/.devcontainer/.devcontainer.postcreate.sh b/.devcontainer/.devcontainer.postcreate.sh new file mode 100755 index 000000000..e0a7094d4 --- /dev/null +++ b/.devcontainer/.devcontainer.postcreate.sh @@ -0,0 +1,426 @@ +#!/usr/bin/env bash + +set -euo pipefail + +WORK_DIR=$(pwd) +CONTAINER_USER=$1 +BASH_RC="/home/${CONTAINER_USER}/.bashrc" +ZSH_RC="/home/${CONTAINER_USER}/.zshrc" +WARNINGS=() + +# Source shared functions +source "${WORK_DIR}/.devcontainer/devcontainer-functions.sh" + +# Ensure .tool-versions file exists with python entry +if [ ! -f "${WORK_DIR}/.tool-versions" ]; then + log_info "Creating .tool-versions file with Python ${DEFAULT_PYTHON_VERSION}" + echo "python ${DEFAULT_PYTHON_VERSION}" > "${WORK_DIR}/.tool-versions" +elif ! grep -q "^python " "${WORK_DIR}/.tool-versions"; then + log_info "Adding Python ${DEFAULT_PYTHON_VERSION} to .tool-versions" + echo "python ${DEFAULT_PYTHON_VERSION}" >> "${WORK_DIR}/.tool-versions" +fi + +# Configure and log CICD environment +CICD_VALUE="${CICD:-false}" +if [ "$CICD_VALUE" = "true" ]; then + log_info "CICD environment variable: $CICD_VALUE" + log_info "Devcontainer configured to run in CICD mode (not a local dev environment)" +else + log_info "CICD environment variable: ${CICD:-not set}" + log_info "Devcontainer configured to run as a local developer environment" +fi + +log_info "Starting post-create setup..." + +######################### +# Require Critical Envs # +######################### +if [ -z "${DEFAULT_GIT_BRANCH:-}" ]; then + exit_with_error "❌ DEFAULT_GIT_BRANCH is not set in the environment" +fi + +if [ -z "${DEFAULT_PYTHON_VERSION:-}" ]; then + exit_with_error "❌ DEFAULT_PYTHON_VERSION is not set in the environment" +fi + +if [ "$CICD_VALUE" != "true" ]; then + AWS_CONFIG_ENABLED="${AWS_CONFIG_ENABLED:-true}" + AWS_PROFILE_MAP_FILE="${WORK_DIR}/.devcontainer/aws-profile-map.json" + + if [ "${AWS_CONFIG_ENABLED,,}" = "true" ]; then + if [ ! -f "$AWS_PROFILE_MAP_FILE" ]; then + exit_with_error "❌ Missing AWS profile config: $AWS_PROFILE_MAP_FILE (required when AWS_CONFIG_ENABLED=true)" + fi + + AWS_PROFILE_MAP_JSON=$(<"$AWS_PROFILE_MAP_FILE") + + if ! jq empty <<< "$AWS_PROFILE_MAP_JSON" >/dev/null 2>&1; then + log_error "$AWS_PROFILE_MAP_JSON" + exit_with_error "❌ AWS_PROFILE_MAP_JSON is not valid JSON" + fi + else + log_info "AWS configuration disabled (AWS_CONFIG_ENABLED=${AWS_CONFIG_ENABLED})" + fi +else + log_info "CICD mode enabled - skipping AWS configuration validation" +fi + +################# +# Configure ENV # +################# +log_info "Configuring ENV vars..." + +# Configure shell.env sourcing for all shells (interactive and non-interactive) +log_info "Configuring shell.env sourcing for all shells" + +# Verify shell.env exists before configuring shells +if [ ! -f "${WORK_DIR}/shell.env" ]; then + exit_with_error "❌ shell.env not found at ${WORK_DIR}/shell.env" +fi + +# For bash: source in .bashrc (interactive) and via BASH_ENV (non-interactive) +echo "# Source project shell.env" >> "${BASH_RC}" +echo "source \"${WORK_DIR}/shell.env\"" >> "${BASH_RC}" +echo "export BASH_ENV=\"${WORK_DIR}/shell.env\"" >> "${BASH_RC}" + +# For zsh: source only in .zshenv (covers all zsh shells - interactive and non-interactive) +echo "source \"${WORK_DIR}/shell.env\"" > /home/${CONTAINER_USER}/.zshenv + +############################## +# Install asdf & Tool Versions +############################## +log_info "Installing asdf..." +mkdir -p /home/${CONTAINER_USER}/.asdf +git clone https://github.com/asdf-vm/asdf.git /home/${CONTAINER_USER}/.asdf --branch v0.15.0 + +# Source asdf for the current script +export ASDF_DIR="/home/${CONTAINER_USER}/.asdf" +export ASDF_DATA_DIR="/home/${CONTAINER_USER}/.asdf" +. "/home/${CONTAINER_USER}/.asdf/asdf.sh" + +# Make asdf available system-wide for Amazon Q agents +log_info "Configuring system-wide asdf access for Amazon Q agents..." + + + + + +# Create plugins directory if it doesn't exist +mkdir -p /home/${CONTAINER_USER}/.asdf/plugins + +# Create wrapper scripts for asdf tools in /usr/local/bin for direct access +log_info "Creating asdf wrapper scripts for direct access..." + +# Create asdf wrapper script +if uname -r | grep -i microsoft > /dev/null; then + # WSL compatibility: Use sudo for /usr/local/bin access + sudo tee /usr/local/bin/asdf > /dev/null << ASDF_WRAPPER +#!/bin/bash +# Wrapper script for asdf that ensures proper environment +export ASDF_DIR="/home/${CONTAINER_USER}/.asdf" +export ASDF_DATA_DIR="/home/${CONTAINER_USER}/.asdf" +if [ -f "/home/${CONTAINER_USER}/.asdf/asdf.sh" ]; then + . "/home/${CONTAINER_USER}/.asdf/asdf.sh" +fi +exec /home/${CONTAINER_USER}/.asdf/bin/asdf "\$@" +ASDF_WRAPPER + sudo chmod +x /usr/local/bin/asdf +else + # Non-WSL: Direct write to /usr/local/bin + cat > /usr/local/bin/asdf << ASDF_WRAPPER +#!/bin/bash +# Wrapper script for asdf that ensures proper environment +export ASDF_DIR="/home/${CONTAINER_USER}/.asdf" +export ASDF_DATA_DIR="/home/${CONTAINER_USER}/.asdf" +if [ -f "/home/${CONTAINER_USER}/.asdf/asdf.sh" ]; then + . "/home/${CONTAINER_USER}/.asdf/asdf.sh" +fi +exec /home/${CONTAINER_USER}/.asdf/bin/asdf "\$@" +ASDF_WRAPPER + chmod +x /usr/local/bin/asdf +fi + +# Create pip wrapper script that sources asdf environment +if uname -r | grep -i microsoft > /dev/null; then + # WSL compatibility: Use sudo for /usr/local/bin access + sudo tee /usr/local/bin/pip-asdf > /dev/null << PIP_WRAPPER +#!/bin/bash +# Wrapper script for pip that ensures asdf environment is loaded +export ASDF_DIR="/home/${CONTAINER_USER}/.asdf" +export ASDF_DATA_DIR="/home/${CONTAINER_USER}/.asdf" +if [ -f "/home/${CONTAINER_USER}/.asdf/asdf.sh" ]; then + . "/home/${CONTAINER_USER}/.asdf/asdf.sh" +fi +exec /home/${CONTAINER_USER}/.asdf/shims/pip "\$@" +PIP_WRAPPER + sudo chmod +x /usr/local/bin/pip-asdf +else + # Non-WSL: Direct write to /usr/local/bin + cat > /usr/local/bin/pip-asdf << PIP_WRAPPER +#!/bin/bash +# Wrapper script for pip that ensures asdf environment is loaded +export ASDF_DIR="/home/${CONTAINER_USER}/.asdf" +export ASDF_DATA_DIR="/home/${CONTAINER_USER}/.asdf" +if [ -f "/home/${CONTAINER_USER}/.asdf/asdf.sh" ]; then + . "/home/${CONTAINER_USER}/.asdf/asdf.sh" +fi +exec /home/${CONTAINER_USER}/.asdf/shims/pip "\$@" +PIP_WRAPPER + chmod +x /usr/local/bin/pip-asdf +fi + +################# +# Oh My Zsh # +################# +if [ ! -d "/home/${CONTAINER_USER}/.oh-my-zsh" ]; then + log_info "Installing Oh My Zsh..." + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +else + log_info "Oh My Zsh already installed — skipping" +fi + +cat <<'EOF' >> ${ZSH_RC} +export ZSH="$HOME/.oh-my-zsh" +ZSH_THEME="obraun" +ENABLE_CORRECTION="false" +HIST_STAMPS="%m/%d/%Y - %H:%M:%S" +source $ZSH/oh-my-zsh.sh +EOF + +################# +# Configure AWS # +################# +if [ "$CICD_VALUE" != "true" ]; then + if [ "${AWS_CONFIG_ENABLED,,}" = "true" ]; then + log_info "Configuring AWS profiles..." + mkdir -p /home/${CONTAINER_USER}/.aws + mkdir -p /home/${CONTAINER_USER}/.aws/amazonq/cache + chown -R ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER}/.aws/amazonq + + AWS_OUTPUT_FORMAT="${AWS_DEFAULT_OUTPUT:-json}" + jq -r 'to_entries[] | + "[profile \(.key)]\n" + + "sso_start_url = \(.value.sso_start_url)\n" + + "sso_region = \(.value.sso_region)\n" + + "sso_account_name = \(.value.account_name)\n" + + "sso_account_id = \(.value.account_id)\n" + + "sso_role_name = \(.value.role_name)\n" + + "region = \(.value.region)\n" + + "output = '"$AWS_OUTPUT_FORMAT"'\n" + + "sso_auto_populated = true\n"' <<< "$AWS_PROFILE_MAP_JSON" \ + > /home/${CONTAINER_USER}/.aws/config + else + log_info "Skipping AWS profile configuration (AWS_CONFIG_ENABLED=${AWS_CONFIG_ENABLED})" + fi +else + log_info "CICD mode enabled - skipping AWS profile configuration" +fi + +##################### +# Install Base Tools +##################### +log_info "Installing core packages..." +sudo apt-get update +sudo apt-get install -y curl vim git gh jq yq nmap sipcalc wget unzip zip + +# Install Python build dependencies for asdf Python compilation +log_info "Installing Python build dependencies..." +sudo apt-get install -y \ + build-essential \ + libbz2-dev \ + libffi-dev \ + libncurses5-dev \ + libncursesw5-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + liblzma-dev \ + tk-dev \ + uuid-dev \ + zlib1g-dev + +############################## +# Install Optional Extra Tools +############################## +if [ -n "${EXTRA_APT_PACKAGES:-}" ]; then + log_info "Installing extra packages: ${EXTRA_APT_PACKAGES}" + sudo apt-get install -y ${EXTRA_APT_PACKAGES} +fi + +if [ -f "${WORK_DIR}/.tool-versions" ]; then + log_info "Installing asdf plugins from .tool-versions..." + cut -d' ' -f1 "${WORK_DIR}/.tool-versions" | while read -r plugin; do + install_asdf_plugin "$plugin" + done + + # Install Python first (always required for other tools) + if grep -q "^python " "${WORK_DIR}/.tool-versions"; then + PYTHON_VERSION=$(grep "^python " "${WORK_DIR}/.tool-versions" | cut -d' ' -f2) + log_info "Installing Python ${PYTHON_VERSION} first (from .tool-versions, required for other tools)..." + else + PYTHON_VERSION="${DEFAULT_PYTHON_VERSION}" + log_info "Installing Python ${PYTHON_VERSION} first (fallback version, required for other tools)..." + fi + + if ! asdf install python "$PYTHON_VERSION"; then + exit_with_error "❌ Failed to install python $PYTHON_VERSION" + fi + if ! asdf reshim python; then + exit_with_error "❌ Failed to reshim python after installation" + fi + + log_info "Installing remaining tools from .tool-versions..." + if ! asdf install; then + log_warn "❌ asdf install failed — tool versions may not be fully installed" + fi +else + log_info "No .tool-versions file found — skipping general asdf install" +fi + +# Ensure reshim is run for the current user +log_info "Running asdf reshim..." +if ! asdf reshim; then + exit_with_error "❌ asdf reshim failed" +fi + +# Create symlinks in /usr/local/bin for direct access by Amazon Q agents +log_info "Creating symlinks for Amazon Q agent direct access..." +if [ -d "/home/${CONTAINER_USER}/.asdf/shims" ]; then + for shim in /home/${CONTAINER_USER}/.asdf/shims/*; do + if [ -f "$shim" ] && [ -x "$shim" ]; then + shim_name=$(basename "$shim") + if [ ! -e "/usr/local/bin/$shim_name" ]; then + if uname -r | grep -i microsoft > /dev/null; then + # WSL compatibility: Use sudo for /usr/local/bin access + sudo ln -s "$shim" "/usr/local/bin/$shim_name" + else + # Non-WSL: Direct symlink creation + ln -s "$shim" "/usr/local/bin/$shim_name" + fi + log_info "Created symlink: /usr/local/bin/$shim_name -> $shim" + fi + fi + done +fi + +# Install pipx right after Python is available +log_info "Installing pipx..." +python -m pip install --upgrade pip --root-user-action=ignore +python -m pip install pipx --root-user-action=ignore +if ! asdf reshim python; then + exit_with_error "❌ asdf reshim python failed after pipx install" +fi + +# Install Caylent Devcontainer CLI +log_info "Installing Caylent Devcontainer CLI..." +if [ -n "${CLI_VERSION:-}" ]; then + if [[ "${CLI_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + log_info "Installing specific CLI version: ${CLI_VERSION}" + CLI_INSTALL_CMD="caylent-devcontainer-cli==${CLI_VERSION}" + else + exit_with_error "Invalid CLI_VERSION format: ${CLI_VERSION}. Expected format: X.Y.Z (e.g., 1.2.3)" + fi +else + log_info "Installing latest CLI version" + CLI_INSTALL_CMD="caylent-devcontainer-cli" +fi + +install_with_pipx "${CLI_INSTALL_CMD}" + +# Verify asdf is working properly +log_info "Verifying asdf installation..." +if ! asdf current; then + exit_with_error "❌ asdf current failed - installation may be incomplete" +fi + +################# +# Python Tools # +################# +log_info "Verifying Python installation via asdf..." +ASDF_PYTHON_PATH=$(asdf which python || true) +if [[ -z "$ASDF_PYTHON_PATH" || "$ASDF_PYTHON_PATH" != *".asdf"* ]]; then + exit_with_error "❌ 'python' is not provided by asdf. Found: $ASDF_PYTHON_PATH" +fi + +log_info "Installing Python packages..." +python -m pip install ruamel_yaml --root-user-action=ignore + +############# +# AWS Tools # +############# +log_info "Installing AWS SSO utilities..." +install_with_pipx "aws-sso-util" + +################# +# Configure Git # +################# +if [ "$CICD_VALUE" != "true" ]; then + log_info "Setting up Git credentials..." + cat < /home/${CONTAINER_USER}/.netrc +machine ${GIT_PROVIDER_URL} +login ${GIT_USER} +password ${GIT_TOKEN} +EOF + chmod 600 /home/${CONTAINER_USER}/.netrc + + cat <> /home/${CONTAINER_USER}/.gitconfig +[user] + name = ${GIT_USER} + email = ${GIT_USER_EMAIL} +[core] + editor = vim +[push] + autoSetupRemote = true +[safe] + directory = * +[pager] + branch = false + config = false + diff = false + log = false + show = false + status = false + tag = false +[credential] + helper = store +EOF +else + log_info "CICD mode enabled - skipping Git configuration" +fi + +########### +# Cleanup # +########### +log_info "Fixing ownership for ${CONTAINER_USER}" +chown -R ${CONTAINER_USER}:${CONTAINER_USER} /home/${CONTAINER_USER} + +#################### +# Warning Summary # +#################### +if [ ${#WARNINGS[@]} -ne 0 ]; then + echo -e "\n⚠️ Completed with warnings:" + for warning in "${WARNINGS[@]}"; do + echo " - $warning" + done +else + log_success "Dev container setup completed with no warnings" +fi + +######################### +# Project-Specific Setup # +######################### +log_info "Running project-specific setup script..." +if [ -f "${WORK_DIR}/.devcontainer/project-setup.sh" ]; then + if uname -r | grep -i microsoft > /dev/null; then + # WSL compatibility: Run directly without sudo -u + bash -c "source /home/${CONTAINER_USER}/.asdf/asdf.sh && cd '${WORK_DIR}' && bash '${WORK_DIR}/.devcontainer/project-setup.sh'" + else + # Non-WSL: Use sudo -u to run as container user + sudo -u "${CONTAINER_USER}" bash -c "source /home/${CONTAINER_USER}/.asdf/asdf.sh && cd '${WORK_DIR}' && bash '${WORK_DIR}/.devcontainer/project-setup.sh'" + fi +else + log_warn "No project-specific setup script found at ${WORK_DIR}/.devcontainer/project-setup.sh" + WARNINGS+=("No project-specific setup script found at ${WORK_DIR}/.devcontainer/project-setup.sh") +fi + +exit 0 diff --git a/.devcontainer/VERSION b/.devcontainer/VERSION new file mode 100644 index 000000000..63e799cf4 --- /dev/null +++ b/.devcontainer/VERSION @@ -0,0 +1 @@ +1.14.1 diff --git a/.devcontainer/devcontainer-functions.sh b/.devcontainer/devcontainer-functions.sh new file mode 100755 index 000000000..be7a13759 --- /dev/null +++ b/.devcontainer/devcontainer-functions.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +# Color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +CYAN='\033[0;36m' +NC='\033[0m' + +log_info() { + echo -e "${CYAN}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[DONE]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" + WARNINGS+=("$1") +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +exit_with_error() { + log_error "$1" + exit 1 +} + +asdf_plugin_installed() { + asdf plugin list | grep -q "^$1$" +} + +install_asdf_plugin() { + local plugin=$1 + if asdf_plugin_installed "$plugin"; then + log_info "Plugin '${plugin}' already installed" + else + log_info "Installing asdf plugin: ${plugin}" + if ! asdf plugin add "${plugin}"; then + log_warn "❌ Failed to add asdf plugin: ${plugin}" + return 1 + fi + fi +} + +install_with_pipx() { + local package="$1" + local container_user="${CONTAINER_USER:?CONTAINER_USER must be set}" + if is_wsl; then + # WSL compatibility: Do not use sudo -u in WSL as it fails + if ! python -m pipx install "${package}"; then + exit_with_error "Failed to install ${package} with pipx in WSL environment" + fi + else + # Non-WSL: Use sudo -u to ensure correct user environment + if ! sudo -u "${container_user}" bash -c "export PATH=\"\$PATH:/home/${container_user}/.local/bin\" && source /home/${container_user}/.asdf/asdf.sh && python -m pipx install '${package}'"; then + exit_with_error "Failed to install ${package} with pipx in non-WSL environment" + fi + fi +} + +is_wsl() { + uname -r | grep -i microsoft > /dev/null +} + +write_file_with_wsl_compat() { + local file_path="$1" + local content="$2" + local permissions="${3:-}" + + if is_wsl; then + echo "$content" | sudo tee "$file_path" > /dev/null + if [ -n "$permissions" ]; then + sudo chmod "$permissions" "$file_path" + fi + else + echo "$content" > "$file_path" + if [ -n "$permissions" ]; then + chmod "$permissions" "$file_path" + fi + fi +} + +append_to_file_with_wsl_compat() { + local file_path="$1" + local content="$2" + + if is_wsl; then + echo "$content" | sudo tee -a "$file_path" > /dev/null + else + echo "$content" >> "$file_path" + fi +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..83e92e451 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,99 @@ +{ + "name": "caylent-devcontainer", + "remoteUser": "vscode", + "image": "mcr.microsoft.com/devcontainers/base:noble", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "features": { + "ghcr.io/devcontainers/features/aws-cli:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/common-utils:2": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "amazonwebservices.amazon-q-vscode", + "aws-scripting-guy.cform", + "amazonwebservices.aws-toolkit-vscode", + "cschlosser.doxdocgen", + "eamodio.gitlens", + "GitHub.copilot", + "GitHub.copilot-chat", + "GitHub.vscode-pull-request-github", + "GitHub.vscode-github-actions", + "ms-azuretools.vscode-docker", + "ms-python.debugpy", + "charliermarsh.ruff", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-vscode.makefile-tools", + "redhat.vscode-yaml", + "streetsidesoftware.code-spell-checker", + "wayou.vscode-todo-highlight", + "wholroyd.jinja" + ], + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + "gitlens.currentLine.enabled": false, + "gitlens.codeLens.enabled": false, + "gitlens.hovers.enabled": false, + "gitlens.statusBar.enabled": false, + "gitlens.blame.line.enabled": false, + "gitlens.blame.file.enabled": false, + "python.defaultInterpreterPath": "/home/vscode/.asdf/installs/python/${env:DEFAULT_PYTHON_VERSION}/bin/python", + "python.linting.enabled": true, + "python.defaultFormatter": "charliermarsh.ruff", + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.codeActionsOnSave": { + "source.fixAll.ruff": "explicit", + "source.organizeImports.ruff": "explicit" + } + }, + "editor.formatOnSave": true, + "files.associations": { + "*.yml": "yaml", + "*.yaml": "yaml", + "Dockerfile*": "dockerfile", + "*.sql": "sql" + }, + "makefile.extensionOutputFolder": ".vscode", + "docker.attachShellCommand.linuxContainer": "/bin/bash" + } + } + }, + "forwardPorts": [ + 5678 + ], + "portsAttributes": { + "5678": { + "label": "Python Debug (debugpy)" + } + }, + "userEnvProbe": "loginInteractiveShell", + "containerEnv": { + "AWS_CONFIG_ENABLED": "${localEnv:AWS_CONFIG_ENABLED}", + "CICD": "${localEnv:CICD}", + "DEFAULT_GIT_BRANCH": "${localEnv:DEFAULT_GIT_BRANCH}", + "DEFAULT_PYTHON_VERSION": "${localEnv:DEFAULT_PYTHON_VERSION}", + "DEVELOPER_NAME": "${localEnv:DEVELOPER_NAME}", + "DEVCONTAINER": "true", + "EXTRA_APT_PACKAGES": "${localEnv:EXTRA_APT_PACKAGES}", + "GIT_PROVIDER_URL": "${localEnv:GIT_PROVIDER_URL}", + "GIT_TOKEN": "${localEnv:GIT_TOKEN}", + "GIT_USER": "${localEnv:GIT_USER}", + "GIT_USER_EMAIL": "${localEnv:GIT_USER_EMAIL}", + "PAGER": "${localEnv:PAGER}", + "AWS_DEFAULT_OUTPUT": "${localEnv:AWS_DEFAULT_OUTPUT}", + "BASH_ENV": "${containerWorkspaceFolder}/shell.env" + }, + "postCreateCommand": "bash -c 'exec > >(tee /tmp/devcontainer-setup.log) 2>&1; if uname -r | grep -i microsoft > /dev/null; then sudo apt-get update && sudo apt-get install -y gettext-base jq python3 && find .devcontainer -type f -exec sed -i \"s/\\r$//\" {} + && python3 .devcontainer/fix-line-endings.py && sudo apt-get remove -y python3 && sudo apt-get autoremove -y && source shell.env && exec bash .devcontainer/.devcontainer.postcreate.sh vscode; else sudo apt-get update && sudo apt-get install -y gettext-base jq && sudo bash .devcontainer/.devcontainer.postcreate.sh vscode; fi && echo \"Setup complete. View logs: cat /tmp/devcontainer-setup.log\" && exit 0'" +} diff --git a/.devcontainer/fix-line-endings.py b/.devcontainer/fix-line-endings.py new file mode 100755 index 000000000..620a2a322 --- /dev/null +++ b/.devcontainer/fix-line-endings.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python3 +""" +Convert Windows line endings (CRLF) to Unix line endings (LF) for all text files. +Excludes binary files and processes files in parallel for performance. +""" + +import os +import sys +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor, as_completed +from threading import Lock + +# Thread-safe counters +stats_lock = Lock() +converted_count = 0 +skipped_count = 0 +error_count = 0 + +def convert_file(file_path): + """Convert a single file from CRLF to LF if it's a text file.""" + global converted_count, skipped_count, error_count + + try: + with open(file_path, 'rb') as f: + content = f.read() + + if not content: + with stats_lock: + skipped_count += 1 + return False + + # Skip binary files (contain null bytes) + if b'\x00' in content: + with stats_lock: + skipped_count += 1 + return False + + # Skip if no CRLF to convert + if b'\r\n' not in content: + with stats_lock: + skipped_count += 1 + return False + + # Convert CRLF to LF + converted_content = content.replace(b'\r\n', b'\n') + + with open(file_path, 'wb') as f: + f.write(converted_content) + + with stats_lock: + converted_count += 1 + return True + + except (OSError, IOError) as e: + with stats_lock: + error_count += 1 + print(f"Error processing {file_path}: {e}", file=sys.stderr) + return False + +def main(): + """Main function to process all files in the workspace.""" + global converted_count, skipped_count, error_count + workspace_path = Path(os.getcwd()) + + if not workspace_path.exists(): + print(f"Error: Workspace path {workspace_path} does not exist", file=sys.stderr) + sys.exit(1) + + print(f"Converting line endings in: {workspace_path}") + + # Find all files + files_to_process = [] + for root, dirs, files in os.walk(workspace_path): + # Skip .git directory for performance + if '.git' in dirs: + dirs.remove('.git') + + for file in files: + file_path = Path(root) / file + files_to_process.append(file_path) + + if not files_to_process: + print("No files found to process") + return + + print(f"Processing {len(files_to_process)} files...") + + # Process files in parallel + max_workers = os.cpu_count() or 1 + with ThreadPoolExecutor(max_workers=max_workers) as executor: + futures = {executor.submit(convert_file, file_path): file_path + for file_path in files_to_process} + + for future in as_completed(futures): + try: + future.result() + except Exception as e: + file_path = futures[future] + print(f"Unexpected error processing {file_path}: {e}", file=sys.stderr) + with stats_lock: + error_count += 1 + + # Print summary + print(f"Line ending conversion complete:") + print(f" Converted: {converted_count} files") + print(f" Skipped: {skipped_count} files") + if error_count > 0: + print(f" Errors: {error_count} files") + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/.devcontainer/project-setup.sh b/.devcontainer/project-setup.sh new file mode 100755 index 000000000..9bf83c9f2 --- /dev/null +++ b/.devcontainer/project-setup.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Source shared functions +source "$(dirname "$0")/devcontainer-functions.sh" + +make install + +log_info "Project-specific setup complete" diff --git a/.flake8 b/.flake8 index 83d055938..d33814339 100644 --- a/.flake8 +++ b/.flake8 @@ -15,3 +15,4 @@ exclude = .venv, venv, .tox, + .devcontainer/fix-line-endings.py, diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 000000000..b8475130a --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +echo "Running pre-push checks..." + +make pre-commit + +echo "✓ All pre-push checks passed!" diff --git a/.gitignore b/.gitignore index 4e91be94c..74bfa87b4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.log *.pyc __pycache__ +build /dist .repopickle_* /repoc @@ -11,3 +12,9 @@ __pycache__ # PyCharm related /.idea/ + +# Environment files +shell.env +devcontainer-environment-variables.json +.devcontainer/aws-profile-map.json +.coverage diff --git a/.isort.cfg b/.isort.cfg index bc47b6144..9c875c758 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -31,7 +31,7 @@ force_sort_within_sections = true order_by_type = false # Ignore generated files. -extend_skip_glob = *_pb2.py +extend_skip_glob = *_pb2.py,.devcontainer/fix-line-endings.py # Allow importing multiple classes on a single line from these modules. # https://google.github.io/styleguide/pyguide#s2.2-imports diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..b0ea75145 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +pre-commit 4.3.0 +python 3.12.9 diff --git a/CAYLENT-README.md b/CAYLENT-README.md new file mode 100644 index 000000000..6547c5a36 --- /dev/null +++ b/CAYLENT-README.md @@ -0,0 +1,198 @@ +# Caylent Repo Tool + +This is Caylent's fork of the Android repo tool with custom enhancements. + +## Table of Contents + +- [Installation](#installation) + - [Quick Start](#quick-start-recommended) + - [Production (Pinned Version)](#production-pinned-version) + - [Override Repository URL or Version](#override-repository-url-or-version) +- [Usage](#usage) + - [Important: GPG Verification](#important-gpg-verification) +- [New Features](#new-features) + - [Environment Variable Substitution (envsubst)](#environment-variable-substitution-envsubst) +- [Development](#development) + - [Setup](#setup) + - [Running Tests](#running-tests) + - [Creating a Release](#creating-a-release) +- [Upstream Sync](#upstream-sync) + +## Installation + +### Quick Start (Recommended) + +```bash +# Install repo from latest tag (automatically fetches latest version) +pip install git+https://github.com/caylent-solutions/git-repo@$(curl -s https://api.github.com/repos/caylent-solutions/git-repo/tags | grep -o '"name": "caylent-[^"]*' | head -1 | cut -d'"' -f4) + +# Initialize repo - automatically uses latest caylent-* tag +repo init -u --no-repo-verify +``` + +During `repo init`, it will automatically fetch and use the latest `caylent-*` tag from GitHub. + +**To uninstall:** +```bash +pip uninstall -y repo +``` + +### Production (Pinned Version) + +For production environments, pin to a specific tag to ensure consistency: + +```bash +# Install specific tag +pip install git+https://github.com/caylent-solutions/git-repo@caylent-0.1.2 + +# Initialize with the same pinned tag +repo init -u --repo-rev=caylent-0.1.2 --no-repo-verify +``` + +Replace `caylent-0.1.2` with your desired version. + +### Override Repository URL or Version + +To use a specific version or branch instead of the latest tag: + +```bash +# Install specific version +pip install git+https://github.com/caylent-solutions/git-repo@ + +# Initialize with specific version +repo init -u --repo-rev= --no-repo-verify +``` + +To use a different fork entirely: + +```bash +# Initialize with custom repo URL and version +repo init -u \ + --repo-url= \ + --repo-rev= \ + --no-repo-verify +``` + +Replace `` with a tag (e.g., `caylent-0.1.2`), branch (e.g., `main`), or commit hash. + +## Usage + +### Important: GPG Verification + +Currently, Caylent tags are not GPG-signed. You **must** use the `--no-repo-verify` flag when running `repo init`: + +```sh +repo init -u --no-repo-verify +``` + +**Note:** GPG signing support will be added in a future release. Track progress in the `.amazonq/prompts/add-gpg-signing.md` file. + +### Example + +```sh +# Initialize a repo workspace +repo init -u https://github.com/your-org/manifest.git --no-repo-verify + +# Sync all projects +repo sync +``` + +## New Features + +### Environment Variable Substitution (envsubst) + +Replace environment variable placeholders in manifest XML files: + +```xml + + + + + +``` + +```bash +# Set environment variables +export GITBASE=https://github.com/myorg +export GITREV=main + +# Run envsubst to replace variables +repo envsubst +``` + +**Result:** +```xml + + + + +``` + +The command replaces all `${VARIABLE}` placeholders in: +- Attribute values +- Text content +- Any XML element in manifest files under `.repo/manifests/` + +## Caylent Enhancements + +- Automatic detection of latest `caylent-*` tag during initialization +- Improved trace file handling for non-writable directories +- Environment variable substitution in manifest files +- Custom bug tracking: https://github.com/caylent-solutions/git-repo/issues + +## Development + +### Setup + +```bash +# Clone the repository +git clone https://github.com/caylent-solutions/git-repo +cd git-repo + +# Install development dependencies +pip install -r requirements-dev.txt +``` + +### Running Tests + +```bash +# Run specific tests +tox -- tests/test_subcmds_envsubst.py + +# Run all tests +tox +``` + +### Creating a Release + +1. Update version and create a semver tag: + ```bash + git tag -a caylent-0.1.3 -m "Release caylent-0.1.3" + git push origin caylent-0.1.3 + ``` + +2. Users can then install using the tag as shown in the installation section above. + +## Upstream Sync + +To sync with upstream Google repo: + +```bash +git remote add upstream https://gerrit.googlesource.com/git-repo +git fetch upstream +git merge upstream/main +``` + +## Releases + +Latest release: `caylent-0.1.2` + +View all releases: https://github.com/caylent-solutions/git-repo/tags diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..81f822c19 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +# git-repo Makefile — task runner for development workflow +# All targets dispatch to standard tools; no business logic in recipes. + +SHELL := /bin/bash +.SHELLFLAGS := -euo pipefail -c + +.DEFAULT_GOAL := help + +.PHONY: lint format format-check check test test-unit test-functional validate clean help + +help: ## Show this help message + @echo "Available make targets:" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +lint: ## Run all linters (ruff, markdownlint, yamllint) + @echo "lint: placeholder — will be implemented in E0-F1-S1-T2" + +format: ## Auto-fix formatting issues (ruff format) + @echo "format: placeholder — will be implemented in E0-F1-S1-T2" + +format-check: ## Verify formatting without modifying files (CI-safe) + @echo "format-check: placeholder — will be implemented in E0-F1-S1-T2" + +check: lint format-check ## Run all checks: lint + format verification (read-only, CI-safe) + +test: ## Run pytest with coverage + @echo "test: placeholder — will be implemented in E0-F1-S1-T3" + +test-unit: ## Run unit tests only (-m unit) + @echo "test-unit: placeholder — will be implemented in E0-F1-S1-T3" + +test-functional: ## Run functional tests only (-m functional) + @echo "test-functional: placeholder — will be implemented in E0-F1-S1-T3" + +validate: check test ## Full CI equivalent: check + test + +clean: ## Remove build artifacts and caches + find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true + rm -rf .pytest_cache + rm -rf .ruff_cache + rm -rf htmlcov + rm -f .coverage + find . -type f -name '*.pyc' -delete 2>/dev/null || true + rm -rf .tox + rm -rf *.egg-info + @echo "clean: all build artifacts removed" diff --git a/README.md b/README.md index 5c5ee5d91..d99e71cae 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # repo +> **Note:** This is a Caylent fork of the repo tool. For Caylent-specific instructions and usage, see [CAYLENT-README.md](./CAYLENT-README.md). + Repo is a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it diff --git a/man/repo-abandon.1 b/man/repo-abandon.1 deleted file mode 100644 index 4e1b6b3de..000000000 --- a/man/repo-abandon.1 +++ /dev/null @@ -1,49 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo abandon" "Repo Manual" -.SH NAME -repo \- repo abandon - manual page for repo abandon -.SH SYNOPSIS -.B repo -\fI\,abandon \/\fR[\fI\,--all | \/\fR] [\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Permanently abandon a development branch -.PP -This subcommand permanently abandons a development branch by -deleting it (and all its history) from your local repository. -.PP -It is equivalent to "git branch \fB\-D\fR ". -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-\-all\fR -delete all branches in all projects -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help abandon` to view the detailed manual. diff --git a/man/repo-branch.1 b/man/repo-branch.1 deleted file mode 100644 index 854ee98b6..000000000 --- a/man/repo-branch.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/repo-branches.1 \ No newline at end of file diff --git a/man/repo-branches.1 b/man/repo-branches.1 deleted file mode 100644 index 5e9892d49..000000000 --- a/man/repo-branches.1 +++ /dev/null @@ -1,72 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo branches" "Repo Manual" -.SH NAME -repo \- repo branches - manual page for repo branches -.SH SYNOPSIS -.B repo -\fI\,branches \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -View current topic branches -.PP -Summarizes the currently available topic branches. -.PP -# Branch Display -.PP -The branch display output by this command is organized into four -columns of information; for example: -.TP -*P nocolor -| in repo -.TP -repo2 -| -.PP -The first column contains a * if the branch is the currently -checked out branch in any of the specified projects, or a blank -if no project has the branch checked out. -.PP -The second column contains either blank, p or P, depending upon -the upload status of the branch. -.IP -(blank): branch not yet published by repo upload -.IP -P: all commits were published by repo upload -p: only some commits were published by repo upload -.PP -The third column contains the branch name. -.PP -The fourth column (after the | separator) lists the projects that -the branch appears in, or does not appear in. If no project list -is shown, then the branch appears in all projects. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help branches` to view the detailed manual. diff --git a/man/repo-checkout.1 b/man/repo-checkout.1 deleted file mode 100644 index f79b83c6a..000000000 --- a/man/repo-checkout.1 +++ /dev/null @@ -1,49 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo checkout" "Repo Manual" -.SH NAME -repo \- repo checkout - manual page for repo checkout -.SH SYNOPSIS -.B repo -\fI\,checkout \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Checkout a branch for development -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help checkout` to view the detailed manual. -.SH DETAILS -.PP -The 'repo checkout' command checks out an existing branch that was previously -created by 'repo start'. -.PP -The command is equivalent to: -.IP -repo forall [...] \fB\-c\fR git checkout diff --git a/man/repo-cherry-pick.1 b/man/repo-cherry-pick.1 deleted file mode 100644 index b109cbfaf..000000000 --- a/man/repo-cherry-pick.1 +++ /dev/null @@ -1,41 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo cherry-pick" "Repo Manual" -.SH NAME -repo \- repo cherry-pick - manual page for repo cherry-pick -.SH SYNOPSIS -.B repo -\fI\,cherry-pick \/\fR -.SH DESCRIPTION -Summary -.PP -Cherry\-pick a change. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help cherry\-pick` to view the detailed manual. -.SH DETAILS -.PP -\&'repo cherry\-pick' cherry\-picks a change from one branch to another. The change -id will be updated, and a reference to the old change id will be added. diff --git a/man/repo-diff.1 b/man/repo-diff.1 deleted file mode 100644 index 94d19c31a..000000000 --- a/man/repo-diff.1 +++ /dev/null @@ -1,48 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo diff" "Repo Manual" -.SH NAME -repo \- repo diff - manual page for repo diff -.SH SYNOPSIS -.B repo -\fI\,diff \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Show changes between commit and working tree -.PP -The \fB\-u\fR option causes 'repo diff' to generate diff output with file paths -relative to the repository root, so the output can be applied -to the Unix 'patch' command. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-u\fR, \fB\-\-absolute\fR -paths are relative to the repository root -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help diff` to view the detailed manual. diff --git a/man/repo-diffmanifests.1 b/man/repo-diffmanifests.1 deleted file mode 100644 index 92c77df6f..000000000 --- a/man/repo-diffmanifests.1 +++ /dev/null @@ -1,74 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo diffmanifests" "Repo Manual" -.SH NAME -repo \- repo diffmanifests - manual page for repo diffmanifests -.SH SYNOPSIS -.B repo -\fI\,diffmanifests manifest1.xml \/\fR[\fI\,manifest2.xml\/\fR] [\fI\,options\/\fR] -.SH DESCRIPTION -Summary -.PP -Manifest diff utility -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-\-raw\fR -display raw diff -.TP -\fB\-\-no\-color\fR -does not display the diff in color -.TP -\fB\-\-pretty\-format=\fR -print the log using a custom git pretty format string -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help diffmanifests` to view the detailed manual. -.SH DETAILS -.PP -The repo diffmanifests command shows differences between project revisions of -manifest1 and manifest2. if manifest2 is not specified, current manifest.xml -will be used instead. Both absolute and relative paths may be used for -manifests. Relative paths start from project's ".repo/manifests" folder. -.PP -The \fB\-\-raw\fR option Displays the diff in a way that facilitates parsing, the -project pattern will be [] and the -commit pattern will be with status values respectively : -.IP -A = Added project -R = Removed project -C = Changed project -U = Project with unreachable revision(s) (revision(s) not found) -.PP -for project, and -.IP -A = Added commit -R = Removed commit -.PP -for a commit. -.PP -Only changed projects may contain commits, and commit status always starts with -a space, and are part of last printed project. Unreachable revisions may occur -if project is not up to date or if repo has not been initialized with all the -groups, in which case some projects won't be synced and their revisions won't be -found. diff --git a/man/repo-download.1 b/man/repo-download.1 deleted file mode 100644 index ada4fd386..000000000 --- a/man/repo-download.1 +++ /dev/null @@ -1,57 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo download" "Repo Manual" -.SH NAME -repo \- repo download - manual page for repo download -.SH SYNOPSIS -.B repo -\fI\,download {\/\fR[\fI\,project\/\fR] \fI\,change\/\fR[\fI\,/patchset\/\fR]\fI\,}\/\fR... -.SH DESCRIPTION -Summary -.PP -Download and checkout a change -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-b\fR BRANCH, \fB\-\-branch\fR=\fI\,BRANCH\/\fR -create a new branch first -.TP -\fB\-c\fR, \fB\-\-cherry\-pick\fR -cherry\-pick instead of checkout -.TP -\fB\-x\fR, \fB\-\-record\-origin\fR -pass \fB\-x\fR when cherry\-picking -.TP -\fB\-r\fR, \fB\-\-revert\fR -revert instead of checkout -.TP -\fB\-f\fR, \fB\-\-ff\-only\fR -force fast\-forward merge -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help download` to view the detailed manual. -.SH DETAILS -.PP -The 'repo download' command downloads a change from the review system and makes -it available in your project's local working directory. If no project is -specified try to use current directory as a project. diff --git a/man/repo-forall.1 b/man/repo-forall.1 deleted file mode 100644 index f14912f9b..000000000 --- a/man/repo-forall.1 +++ /dev/null @@ -1,146 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo forall" "Repo Manual" -.SH NAME -repo \- repo forall - manual page for repo forall -.SH SYNOPSIS -.B repo -\fI\,forall \/\fR[\fI\,\/\fR...] \fI\,-c \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Run a shell command in each project -.PP -repo forall \fB\-r\fR str1 [str2] ... \fB\-c\fR [...] -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-r\fR, \fB\-\-regex\fR -execute the command only on projects matching regex or -wildcard expression -.TP -\fB\-i\fR, \fB\-\-inverse\-regex\fR -execute the command only on projects not matching -regex or wildcard expression -.TP -\fB\-g\fR GROUPS, \fB\-\-groups\fR=\fI\,GROUPS\/\fR -execute the command only on projects matching the -specified groups -.TP -\fB\-c\fR, \fB\-\-command\fR -command (and arguments) to execute -.TP -\fB\-e\fR, \fB\-\-abort\-on\-errors\fR -abort if a command exits unsuccessfully -.TP -\fB\-\-ignore\-missing\fR -silently skip & do not exit non\-zero due missing -checkouts -.TP -\fB\-\-interactive\fR -force interactive usage -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.TP -\fB\-p\fR -show project headers before output -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help forall` to view the detailed manual. -.SH DETAILS -.PP -Executes the same shell command in each project. -.PP -The \fB\-r\fR option allows running the command only on projects matching regex or -wildcard expression. -.PP -By default, projects are processed non\-interactively in parallel. If you want to -run interactive commands, make sure to pass \fB\-\-interactive\fR to force \fB\-\-jobs\fR 1. -While the processing order of projects is not guaranteed, the order of project -output is stable. -.PP -Output Formatting -.PP -The \fB\-p\fR option causes 'repo forall' to bind pipes to the command's stdin, stdout -and stderr streams, and pipe all output into a continuous stream that is -displayed in a single pager session. Project headings are inserted before the -output of each command is displayed. If the command produces no output in a -project, no heading is displayed. -.PP -The formatting convention used by \fB\-p\fR is very suitable for some types of -searching, e.g. `repo forall \fB\-p\fR \fB\-c\fR git log \fB\-SFoo\fR` will print all commits that -add or remove references to Foo. -.PP -The \fB\-v\fR option causes 'repo forall' to display stderr messages if a command -produces output only on stderr. Normally the \fB\-p\fR option causes command output to -be suppressed until the command produces at least one byte of output on stdout. -.PP -Environment -.PP -pwd is the project's working directory. If the current client is a mirror -client, then pwd is the Git repository. -.PP -REPO_PROJECT is set to the unique name of the project. -.PP -REPO_PATH is the path relative the the root of the client. -.PP -REPO_OUTERPATH is the path of the sub manifest's root relative to the root of -the client. -.PP -REPO_INNERPATH is the path relative to the root of the sub manifest. -.PP -REPO_REMOTE is the name of the remote system from the manifest. -.PP -REPO_LREV is the name of the revision from the manifest, translated to a local -tracking branch. If you need to pass the manifest revision to a locally executed -git command, use REPO_LREV. -.PP -REPO_RREV is the name of the revision from the manifest, exactly as written in -the manifest. -.PP -REPO_COUNT is the total number of projects being iterated. -.PP -REPO_I is the current (1\-based) iteration count. Can be used in conjunction with -REPO_COUNT to add a simple progress indicator to your command. -.PP -REPO__* are any extra environment variables, specified by the "annotation" -element under any project element. This can be useful for differentiating trees -based on user\-specific criteria, or simply annotating tree details. -.PP -shell positional arguments ($1, $2, .., $#) are set to any arguments following -. -.PP -Example: to list projects: -.IP -repo forall \fB\-c\fR 'echo $REPO_PROJECT' -.PP -Notice that $REPO_PROJECT is quoted to ensure it is expanded in the context of -running instead of in the calling shell. -.PP -Unless \fB\-p\fR is used, stdin, stdout, stderr are inherited from the terminal and are -not redirected. -.PP -If \fB\-e\fR is used, when a command exits unsuccessfully, 'repo forall' will abort -without iterating through the remaining projects. diff --git a/man/repo-gc.1 b/man/repo-gc.1 deleted file mode 100644 index aadff005d..000000000 --- a/man/repo-gc.1 +++ /dev/null @@ -1,47 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "April 2025" "repo gc" "Repo Manual" -.SH NAME -repo \- repo gc - manual page for repo gc -.SH SYNOPSIS -.B repo -\fI\,gc\/\fR -.SH DESCRIPTION -Summary -.PP -Cleaning up internal repo and Git state. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-n\fR, \fB\-\-dry\-run\fR -do everything except actually delete -.TP -\fB\-y\fR, \fB\-\-yes\fR -answer yes to all safe prompts -.TP -\fB\-\-repack\fR -repack all projects that use partial clone with -filter=blob:none -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help gc` to view the detailed manual. diff --git a/man/repo-grep.1 b/man/repo-grep.1 deleted file mode 100644 index 29ef4071a..000000000 --- a/man/repo-grep.1 +++ /dev/null @@ -1,132 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo grep" "Repo Manual" -.SH NAME -repo \- repo grep - manual page for repo grep -.SH SYNOPSIS -.B repo -\fI\,grep {pattern | -e pattern} \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Print lines matching a pattern -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.SS Logging options: -.TP -\fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.SS Sources: -.TP -\fB\-\-cached\fR -Search the index, instead of the work tree -.TP -\fB\-r\fR TREEish, \fB\-\-revision\fR=\fI\,TREEish\/\fR -Search TREEish, instead of the work tree -.SS Pattern: -.TP -\fB\-e\fR PATTERN -Pattern to search for -.TP -\fB\-i\fR, \fB\-\-ignore\-case\fR -Ignore case differences -.TP -\fB\-a\fR, \fB\-\-text\fR -Process binary files as if they were text -.TP -\fB\-I\fR -Don't match the pattern in binary files -.TP -\fB\-w\fR, \fB\-\-word\-regexp\fR -Match the pattern only at word boundaries -.TP -\fB\-v\fR, \fB\-\-invert\-match\fR -Select non\-matching lines -.TP -\fB\-G\fR, \fB\-\-basic\-regexp\fR -Use POSIX basic regexp for patterns (default) -.TP -\fB\-E\fR, \fB\-\-extended\-regexp\fR -Use POSIX extended regexp for patterns -.TP -\fB\-F\fR, \fB\-\-fixed\-strings\fR -Use fixed strings (not regexp) for pattern -.SS Pattern Grouping: -.TP -\fB\-\-all\-match\fR -Limit match to lines that have all patterns -.TP -\fB\-\-and\fR, \fB\-\-or\fR, \fB\-\-not\fR -Boolean operators to combine patterns -.TP -\-(, \-) -Boolean operator grouping -.SS Output: -.TP -\fB\-n\fR -Prefix the line number to matching lines -.TP -\fB\-C\fR CONTEXT -Show CONTEXT lines around match -.TP -\fB\-B\fR CONTEXT -Show CONTEXT lines before match -.TP -\fB\-A\fR CONTEXT -Show CONTEXT lines after match -.TP -\fB\-l\fR, \fB\-\-name\-only\fR, \fB\-\-files\-with\-matches\fR -Show only file names containing matching lines -.TP -\fB\-L\fR, \fB\-\-files\-without\-match\fR -Show only file names not containing matching lines -.PP -Run `repo help grep` to view the detailed manual. -.SH DETAILS -.PP -Search for the specified patterns in all project files. -.PP -Boolean Options -.PP -The following options can appear as often as necessary to express the pattern to -locate: -.HP -\fB\-e\fR PATTERN -.HP -\fB\-\-and\fR, \fB\-\-or\fR, \fB\-\-not\fR, \-(, \-) -.PP -Further, the \fB\-r\fR/\-\-revision option may be specified multiple times in order to -scan multiple trees. If the same file matches in more than one tree, only the -first result is reported, prefixed by the revision name it was found under. -.PP -Examples -.PP -Look for a line that has '#define' and either 'MAX_PATH or 'PATH_MAX': -.IP -repo grep \fB\-e\fR '#define' \fB\-\-and\fR \-\e( \fB\-e\fR MAX_PATH \fB\-e\fR PATH_MAX \e) -.PP -Look for a line that has 'NODE' or 'Unexpected' in files that contain a line -that matches both expressions: -.IP -repo grep \fB\-\-all\-match\fR \fB\-e\fR NODE \fB\-e\fR Unexpected diff --git a/man/repo-help.1 b/man/repo-help.1 deleted file mode 100644 index d41307267..000000000 --- a/man/repo-help.1 +++ /dev/null @@ -1,46 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo help" "Repo Manual" -.SH NAME -repo \- repo help - manual page for repo help -.SH SYNOPSIS -.B repo -\fI\,help \/\fR[\fI\,--all|command\/\fR] -.SH DESCRIPTION -Summary -.PP -Display detailed help on a command -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-a\fR, \fB\-\-all\fR -show the complete list of commands -.TP -\fB\-\-help\-all\fR -show the \fB\-\-help\fR of all commands -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help help` to view the detailed manual. -.SH DETAILS -.PP -Displays detailed usage information about a command. diff --git a/man/repo-info.1 b/man/repo-info.1 deleted file mode 100644 index 2cb25809e..000000000 --- a/man/repo-info.1 +++ /dev/null @@ -1,53 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo info" "Repo Manual" -.SH NAME -repo \- repo info - manual page for repo info -.SH SYNOPSIS -.B repo -\fI\,info \/\fR[\fI\,-dl\/\fR] [\fI\,-o \/\fR[\fI\,-c\/\fR]] [\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Get info on the manifest branch, current branch or unmerged branches -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-d\fR, \fB\-\-diff\fR -show full info and commit diff including remote -branches -.TP -\fB\-o\fR, \fB\-\-overview\fR -show overview of all local commits -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -consider only checked out branches -.TP -\fB\-\-no\-current\-branch\fR -consider all local branches -.TP -\fB\-l\fR, \fB\-\-local\-only\fR -disable all remote operations -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help info` to view the detailed manual. diff --git a/man/repo-init.1 b/man/repo-init.1 deleted file mode 100644 index 374117527..000000000 --- a/man/repo-init.1 +++ /dev/null @@ -1,204 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "September 2024" "repo init" "Repo Manual" -.SH NAME -repo \- repo init - manual page for repo init -.SH SYNOPSIS -.B repo -\fI\,init \/\fR[\fI\,options\/\fR] [\fI\,manifest url\/\fR] -.SH DESCRIPTION -Summary -.PP -Initialize a repo client checkout in the current directory -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Manifest options: -.TP -\fB\-u\fR URL, \fB\-\-manifest\-url\fR=\fI\,URL\/\fR -manifest repository location -.TP -\fB\-b\fR REVISION, \fB\-\-manifest\-branch\fR=\fI\,REVISION\/\fR -manifest branch or revision (use HEAD for default) -.TP -\fB\-\-manifest\-upstream\-branch\fR=\fI\,BRANCH\/\fR -when a commit is provided to \fB\-\-manifest\-branch\fR, this -is the name of the git ref in which the commit can be -found -.TP -\fB\-m\fR NAME.xml, \fB\-\-manifest\-name\fR=\fI\,NAME\/\fR.xml -initial manifest file -.TP -\fB\-g\fR GROUP, \fB\-\-groups\fR=\fI\,GROUP\/\fR -restrict manifest projects to ones with specified -group(s) [default|all|G1,G2,G3|G4,\-G5,\-G6] -.TP -\fB\-p\fR PLATFORM, \fB\-\-platform\fR=\fI\,PLATFORM\/\fR -restrict manifest projects to ones with a specified -platform group [auto|all|none|linux|darwin|...] -.TP -\fB\-\-submodules\fR -sync any submodules associated with the manifest repo -.TP -\fB\-\-standalone\-manifest\fR -download the manifest as a static file rather then -create a git checkout of the manifest repo -.TP -\fB\-\-manifest\-depth\fR=\fI\,DEPTH\/\fR -create a shallow clone of the manifest repo with given -depth (0 for full clone); see git clone (default: 0) -.SS Manifest (only) checkout options: -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -fetch only current manifest branch from server -(default) -.TP -\fB\-\-no\-current\-branch\fR -fetch all manifest branches from server -.TP -\fB\-\-tags\fR -fetch tags in the manifest -.TP -\fB\-\-no\-tags\fR -don't fetch tags in the manifest -.SS Checkout modes: -.TP -\fB\-\-mirror\fR -create a replica of the remote repositories rather -than a client working directory -.TP -\fB\-\-archive\fR -checkout an archive instead of a git repository for -each project. See git archive. -.TP -\fB\-\-worktree\fR -use git\-worktree to manage projects -.SS Project checkout optimizations: -.TP -\fB\-\-reference\fR=\fI\,DIR\/\fR -location of mirror directory -.TP -\fB\-\-dissociate\fR -dissociate from reference mirrors after clone -.TP -\fB\-\-depth\fR=\fI\,DEPTH\/\fR -create a shallow clone with given depth; see git clone -.TP -\fB\-\-partial\-clone\fR -perform partial clone (https://gitscm.com/docs/gitrepositorylayout#_code_partialclone_code) -.TP -\fB\-\-no\-partial\-clone\fR -disable use of partial clone (https://gitscm.com/docs/gitrepositorylayout#_code_partialclone_code) -.TP -\fB\-\-partial\-clone\-exclude\fR=\fI\,PARTIAL_CLONE_EXCLUDE\/\fR -exclude the specified projects (a comma\-delimited -project names) from partial clone (https://gitscm.com/docs/gitrepositorylayout#_code_partialclone_code) -.TP -\fB\-\-clone\-filter\fR=\fI\,CLONE_FILTER\/\fR -filter for use with \fB\-\-partial\-clone\fR [default: -blob:none] -.TP -\fB\-\-use\-superproject\fR -use the manifest superproject to sync projects; -implies \fB\-c\fR -.TP -\fB\-\-no\-use\-superproject\fR -disable use of manifest superprojects -.TP -\fB\-\-clone\-bundle\fR -enable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS (default if -not \fB\-\-partial\-clone\fR) -.TP -\fB\-\-no\-clone\-bundle\fR -disable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS (default if -\fB\-\-partial\-clone\fR) -.TP -\fB\-\-git\-lfs\fR -enable Git LFS support -.TP -\fB\-\-no\-git\-lfs\fR -disable Git LFS support -.SS repo Version options: -.TP -\fB\-\-repo\-url\fR=\fI\,URL\/\fR -repo repository location ($REPO_URL) -.TP -\fB\-\-repo\-rev\fR=\fI\,REV\/\fR -repo branch or revision ($REPO_REV) -.TP -\fB\-\-no\-repo\-verify\fR -do not verify repo source code -.SS Other options: -.TP -\fB\-\-config\-name\fR -Always prompt for name/e\-mail -.SS Multi\-manifest: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help init` to view the detailed manual. -.SH DETAILS -.PP -The 'repo init' command is run once to install and initialize repo. The latest -repo source code and manifest collection is downloaded from the server and is -installed in the .repo/ directory in the current working directory. -.PP -When creating a new checkout, the manifest URL is the only required setting. It -may be specified using the \fB\-\-manifest\-url\fR option, or as the first optional -argument. -.PP -The optional \fB\-b\fR argument can be used to select the manifest branch to checkout -and use. If no branch is specified, the remote's default branch is used. This is -equivalent to using \fB\-b\fR HEAD. -.PP -The optional \fB\-\-manifest\-upstream\-branch\fR argument can be used when a commit is -provided to \fB\-\-manifest\-branch\fR (or \fB\-b\fR), to specify the name of the git ref in -which the commit can be found. -.PP -The optional \fB\-m\fR argument can be used to specify an alternate manifest to be -used. If no manifest is specified, the manifest default.xml will be used. -.PP -If the \fB\-\-standalone\-manifest\fR argument is set, the manifest will be downloaded -directly from the specified \fB\-\-manifest\-url\fR as a static file (rather than setting -up a manifest git checkout). With \fB\-\-standalone\-manifest\fR, the manifest will be -fully static and will not be re\-downloaded during subsesquent `repo init` and -`repo sync` calls. -.PP -The \fB\-\-reference\fR option can be used to point to a directory that has the content -of a \fB\-\-mirror\fR sync. This will make the working directory use as much data as -possible from the local reference directory when fetching from the server. This -will make the sync go a lot faster by reducing data traffic on the network. -.PP -The \fB\-\-dissociate\fR option can be used to borrow the objects from the directory -specified with the \fB\-\-reference\fR option only to reduce network transfer, and stop -borrowing from them after a first clone is made by making necessary local copies -of borrowed objects. -.PP -The \fB\-\-no\-clone\-bundle\fR option disables any attempt to use \fI\,$URL/clone.bundle\/\fP to -bootstrap a new Git repository from a resumeable bundle file on a content -delivery network. This may be necessary if there are problems with the local -Python HTTP client or proxy configuration, but the Git binary works. -.PP -Switching Manifest Branches -.PP -To switch to another manifest branch, `repo init \fB\-b\fR otherbranch` may be used in -an existing client. However, as this only updates the manifest, a subsequent -`repo sync` (or `repo sync \fB\-d\fR`) is necessary to update the working directory -files. diff --git a/man/repo-list.1 b/man/repo-list.1 deleted file mode 100644 index 2444d3e0b..000000000 --- a/man/repo-list.1 +++ /dev/null @@ -1,74 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo list" "Repo Manual" -.SH NAME -repo \- repo list - manual page for repo list -.SH SYNOPSIS -.B repo -\fI\,list \/\fR[\fI\,-f\/\fR] [\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -List projects and their associated directories -.PP -repo list [\-f] \fB\-r\fR str1 [str2]... -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-r\fR, \fB\-\-regex\fR -filter the project list based on regex or wildcard -matching of strings -.TP -\fB\-g\fR GROUPS, \fB\-\-groups\fR=\fI\,GROUPS\/\fR -filter the project list based on the groups the -project is in -.TP -\fB\-a\fR, \fB\-\-all\fR -show projects regardless of checkout state -.TP -\fB\-n\fR, \fB\-\-name\-only\fR -display only the name of the repository -.TP -\fB\-p\fR, \fB\-\-path\-only\fR -display only the path of the repository -.TP -\fB\-f\fR, \fB\-\-fullpath\fR -display the full work tree path instead of the -relative path -.TP -\fB\-\-relative\-to\fR=\fI\,PATH\/\fR -display paths relative to this one (default: top of -repo client checkout) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help list` to view the detailed manual. -.SH DETAILS -.PP -List all projects; pass '.' to list the project for the cwd. -.PP -By default, only projects that currently exist in the checkout are shown. If you -want to list all projects (using the specified filter settings), use the \fB\-\-all\fR -option. If you want to show all projects regardless of the manifest groups, then -also pass \fB\-\-groups\fR all. -.PP -This is similar to running: repo forall \fB\-c\fR 'echo "$REPO_PATH : $REPO_PROJECT"'. diff --git a/man/repo-manifest.1 b/man/repo-manifest.1 deleted file mode 100644 index 74e09145b..000000000 --- a/man/repo-manifest.1 +++ /dev/null @@ -1,671 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "April 2025" "repo manifest" "Repo Manual" -.SH NAME -repo \- repo manifest - manual page for repo manifest -.SH SYNOPSIS -.B repo -\fI\,manifest \/\fR[\fI\,-o {-|NAME.xml}\/\fR] [\fI\,-m MANIFEST.xml\/\fR] [\fI\,-r\/\fR] -.SH DESCRIPTION -Summary -.PP -Manifest inspection utility -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-r\fR, \fB\-\-revision\-as\-HEAD\fR -save revisions as current HEAD -.TP -\fB\-m\fR NAME.xml, \fB\-\-manifest\-name\fR=\fI\,NAME\/\fR.xml -temporary manifest to use for this sync -.TP -\fB\-\-suppress\-upstream\-revision\fR -if in \fB\-r\fR mode, do not write the upstream field (only -of use if the branch names for a sha1 manifest are -sensitive) -.TP -\fB\-\-suppress\-dest\-branch\fR -if in \fB\-r\fR mode, do not write the dest\-branch field -(only of use if the branch names for a sha1 manifest -are sensitive) -.TP -\fB\-\-format\fR=\fI\,FORMAT\/\fR -output format: xml, json (default: xml) -.TP -\fB\-\-pretty\fR -format output for humans to read -.TP -\fB\-\-no\-local\-manifests\fR -ignore local manifests -.TP -\fB\-o\fR \-|NAME.xml, \fB\-\-output\-file\fR=\fI\,\-\/\fR|NAME.xml -file to save the manifest to. (Filename prefix for -multi\-tree.) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help manifest` to view the detailed manual. -.SH DETAILS -.PP -With the \fB\-o\fR option, exports the current manifest for inspection. The manifest -and (if present) local_manifests/ are combined together to produce a single -manifest file. This file can be stored in a Git repository for use during future -\&'repo init' invocations. -.PP -The \fB\-r\fR option can be used to generate a manifest file with project revisions set -to the current commit hash. These are known as "revision locked manifests", as -they don't follow a particular branch. In this case, the 'upstream' attribute is -set to the ref we were on when the manifest was generated. The 'dest\-branch' -attribute is set to indicate the remote ref to push changes to via 'repo -upload'. -.PP -Multiple output formats are supported via \fB\-\-format\fR. The default output is XML, -and formats are generally "condensed". Use \fB\-\-pretty\fR for more human\-readable -variations. -.PP -repo Manifest Format -.PP -A repo manifest describes the structure of a repo client; that is the -directories that are visible and where they should be obtained from with git. -.PP -The basic structure of a manifest is a bare Git repository holding a single -`default.xml` XML file in the top level directory. -.PP -Manifests are inherently version controlled, since they are kept within a Git -repository. Updates to manifests are automatically obtained by clients during -`repo sync`. -.PP -[TOC] -.PP -XML File Format -.PP -A manifest XML file (e.g. `default.xml`) roughly conforms to the following DTD: -.PP -```xml -.IP - -.IP - - - - - - - -.IP - - - - - - - - - -.IP - - -.IP - - - - - - - - - -.TP - -.TP - -.TP - -.TP - -.TP - -.IP - - - - - - - - -.IP - - - - -.IP - - - -.IP - - - -.IP - - - - - - - - - - -.IP - - - - - -.IP - - - -.IP - - - - -.IP - - -.IP - - - - -.PP -]> -``` -.PP -For compatibility purposes across repo releases, all unknown elements are -silently ignored. However, repo reserves all possible names for itself for -future use. If you want to use custom elements, the `x\-*` namespace is reserved -for that purpose, and repo guarantees to never allocate any corresponding names. -.PP -A description of the elements and their attributes follows. -.PP -Element manifest -.PP -The root element of the file. -.PP -Element notice -.PP -Arbitrary text that is displayed to users whenever `repo sync` finishes. The -content is simply passed through as it exists in the manifest. -.PP -Element remote -.PP -One or more remote elements may be specified. Each remote element specifies a -Git URL shared by one or more projects and (optionally) the Gerrit review server -those projects upload changes through. -.PP -Attribute `name`: A short name unique to this manifest file. The name specified -here is used as the remote name in each project's .git/config, and is therefore -automatically available to commands like `git fetch`, `git remote`, `git pull` -and `git push`. -.PP -Attribute `alias`: The alias, if specified, is used to override `name` to be set -as the remote name in each project's .git/config. Its value can be duplicated -while attribute `name` has to be unique in the manifest file. This helps each -project to be able to have same remote name which actually points to different -remote url. -.PP -Attribute `fetch`: The Git URL prefix for all projects which use this remote. -Each project's name is appended to this prefix to form the actual URL used to -clone the project. -.PP -Attribute `pushurl`: The Git "push" URL prefix for all projects which use this -remote. Each project's name is appended to this prefix to form the actual URL -used to "git push" the project. This attribute is optional; if not specified -then "git push" will use the same URL as the `fetch` attribute. -.PP -Attribute `review`: Hostname of the Gerrit server where reviews are uploaded to -by `repo upload`. This attribute is optional; if not specified then `repo -upload` will not function. -.PP -Attribute `revision`: Name of a Git branch (e.g. `main` or `refs/heads/main`). -Remotes with their own revision will override the default revision. -.PP -Element default -.PP -At most one default element may be specified. Its remote and revision attributes -are used when a project element does not specify its own remote or revision -attribute. -.PP -Attribute `remote`: Name of a previously defined remote element. Project -elements lacking a remote attribute of their own will use this remote. -.PP -Attribute `revision`: Name of a Git branch (e.g. `main` or `refs/heads/main`). -Project elements lacking their own revision attribute will use this revision. -.PP -Attribute `dest\-branch`: Name of a Git branch (e.g. `main`). Project elements -not setting their own `dest\-branch` will inherit this value. If this value is -not set, projects will use `revision` by default instead. -.PP -Attribute `upstream`: Name of the Git ref in which a sha1 can be found. Used -when syncing a revision locked manifest in \fB\-c\fR mode to avoid having to sync the -entire ref space. Project elements not setting their own `upstream` will inherit -this value. -.PP -Attribute `sync\-j`: Number of parallel jobs to use when synching. -.PP -Attribute `sync\-c`: Set to true to only sync the given Git branch (specified in -the `revision` attribute) rather than the whole ref space. Project elements -lacking a sync\-c element of their own will use this value. -.PP -Attribute `sync\-s`: Set to true to also sync sub\-projects. -.PP -Attribute `sync\-tags`: Set to false to only sync the given Git branch (specified -in the `revision` attribute) rather than the other ref tags. -.PP -Element manifest\-server -.PP -At most one manifest\-server may be specified. The url attribute is used to -specify the URL of a manifest server, which is an XML RPC service. -.PP -See the [smart sync documentation](./smart\-sync.md) for more details. -.PP -Element submanifest -.PP -One or more submanifest elements may be specified. Each element describes a -single manifest to be checked out as a child. -.PP -Attribute `name`: A unique name (within the current (sub)manifest) for this -submanifest. It acts as a default for `revision` below. The same name can be -used for submanifests with different parent (sub)manifests. -.PP -Attribute `remote`: Name of a previously defined remote element. If not supplied -the remote given by the default element is used. -.PP -Attribute `project`: The manifest project name. The project's name is appended -onto its remote's fetch URL to generate the actual URL to configure the Git -remote with. The URL gets formed as: -.IP -${remote_fetch}/${project_name}.git -.PP -where ${remote_fetch} is the remote's fetch attribute and ${project_name} is the -project's name attribute. The suffix ".git" is always appended as repo assumes -the upstream is a forest of bare Git repositories. If the project has a parent -element, its name will be prefixed by the parent's. -.PP -The project name must match the name Gerrit knows, if Gerrit is being used for -code reviews. -.PP -`project` must not be empty, and may not be an absolute path or use "." or ".." -path components. It is always interpreted relative to the remote's fetch -settings, so if a different base path is needed, declare a different remote with -the new settings needed. -.PP -If not supplied the remote and project for this manifest will be used: `remote` -cannot be supplied. -.PP -Projects from a submanifest and its submanifests are added to the -submanifest::path: group. -.PP -Attribute `manifest\-name`: The manifest filename in the manifest project. If not -supplied, `default.xml` is used. -.PP -Attribute `revision`: Name of a Git branch (e.g. "main" or "refs/heads/main"), -tag (e.g. "refs/tags/stable"), or a commit hash. If not supplied, `name` is -used. -.PP -Attribute `path`: An optional path relative to the top directory of the repo -client where the submanifest repo client top directory should be placed. If not -supplied, `revision` is used. -.PP -`path` may not be an absolute path or use "." or ".." path components. -.PP -Attribute `groups`: List of additional groups to which all projects in the -included submanifest belong. This appends and recurses, meaning all projects in -submanifests carry all parent submanifest groups. Same syntax as the -corresponding element of `project`. -.PP -Attribute `default\-groups`: The list of manifest groups to sync if no -`\-\-groups=` parameter was specified at init. When that list is empty, use this -list instead of "default" as the list of groups to sync. -.PP -Element project -.PP -One or more project elements may be specified. Each element describes a single -Git repository to be cloned into the repo client workspace. You may specify -Git\-submodules by creating a nested project. Git\-submodules will be -automatically recognized and inherit their parent's attributes, but those may be -overridden by an explicitly specified project element. -.PP -Attribute `name`: A unique name for this project. The project's name is appended -onto its remote's fetch URL to generate the actual URL to configure the Git -remote with. The URL gets formed as: -.IP -${remote_fetch}/${project_name}.git -.PP -where ${remote_fetch} is the remote's fetch attribute and ${project_name} is the -project's name attribute. The suffix ".git" is always appended as repo assumes -the upstream is a forest of bare Git repositories. If the project has a parent -element, its name will be prefixed by the parent's. -.PP -The project name must match the name Gerrit knows, if Gerrit is being used for -code reviews. -.PP -"name" must not be empty, and may not be an absolute path or use "." or ".." -path components. It is always interpreted relative to the remote's fetch -settings, so if a different base path is needed, declare a different remote with -the new settings needed. These restrictions are not enforced for [Local -Manifests]. -.PP -Attribute `path`: An optional path relative to the top directory of the repo -client where the Git working directory for this project should be placed. If not -supplied the project "name" is used. If the project has a parent element, its -path will be prefixed by the parent's. -.PP -"path" may not be an absolute path or use "." or ".." path components. These -restrictions are not enforced for [Local Manifests]. -.PP -If you want to place files into the root of the checkout (e.g. a README or -Makefile or another build script), use the [copyfile] or [linkfile] elements -instead. -.PP -Attribute `remote`: Name of a previously defined remote element. If not supplied -the remote given by the default element is used. -.PP -Attribute `revision`: Name of the Git branch the manifest wants to track for -this project. Names can be relative to refs/heads (e.g. just "main") or absolute -(e.g. "refs/heads/main"). Tags and/or explicit SHA\-1s should work in theory, but -have not been extensively tested. If not supplied the revision given by the -remote element is used if applicable, else the default element is used. -.PP -Attribute `dest\-branch`: Name of a Git branch (e.g. `main`). When using `repo -upload`, changes will be submitted for code review on this branch. If -unspecified both here and in the default element, `revision` is used instead. -.PP -Attribute `groups`: List of groups to which this project belongs, whitespace or -comma separated. All projects belong to the group "all", and each project -automatically belongs to a group of its name:`name` and path:`path`. E.g. for -``, that project definition is -implicitly in the following manifest groups: default, name:monkeys, and -path:barrel\-of. If you place a project in the group "notdefault", it will not be -automatically downloaded by repo. If the project has a parent element, the -`name` and `path` here are the prefixed ones. -.PP -Attribute `sync\-c`: Set to true to only sync the given Git branch (specified in -the `revision` attribute) rather than the whole ref space. -.PP -Attribute `sync\-s`: Set to true to also sync sub\-projects. -.PP -Attribute `upstream`: Name of the Git ref in which a sha1 can be found. Used -when syncing a revision locked manifest in \fB\-c\fR mode to avoid having to sync the -entire ref space. -.PP -Attribute `clone\-depth`: Set the depth to use when fetching this project. If -specified, this value will override any value given to repo init with the -\fB\-\-depth\fR option on the command line. -.PP -Attribute `force\-path`: Set to true to force this project to create the local -mirror repository according to its `path` attribute (if supplied) rather than -the `name` attribute. This attribute only applies to the local mirrors syncing, -it will be ignored when syncing the projects in a client working directory. -.PP -Element extend\-project -.PP -Modify the attributes of the named project. -.PP -This element is mostly useful in a local manifest file, to modify the attributes -of an existing project without completely replacing the existing project -definition. This makes the local manifest more robust against changes to the -original manifest. -.PP -Attribute `path`: If specified, limit the change to projects checked out at the -specified path, rather than all projects with the given name. -.PP -Attribute `dest\-path`: If specified, a path relative to the top directory of the -repo client where the Git working directory for this project should be placed. -This is used to move a project in the checkout by overriding the existing `path` -setting. -.PP -Attribute `groups`: List of additional groups to which this project belongs. -Same syntax as the corresponding element of `project`. -.PP -Attribute `revision`: If specified, overrides the revision of the original -project. Same syntax as the corresponding element of `project`. -.PP -Attribute `remote`: If specified, overrides the remote of the original project. -Same syntax as the corresponding element of `project`. -.PP -Attribute `dest\-branch`: If specified, overrides the dest\-branch of the original -project. Same syntax as the corresponding element of `project`. -.PP -Attribute `upstream`: If specified, overrides the upstream of the original -project. Same syntax as the corresponding element of `project`. -.PP -Attribute `base\-rev`: If specified, adds a check against the revision to be -extended. Manifest parse will fail and give a list of mismatch extends if the -revisions being extended have changed since base\-rev was set. Intended for use -with layered manifests using hash revisions to prevent patch branches hiding -newer upstream revisions. Also compares named refs like branches or tags but is -misleading if branches are used as base\-rev. Same syntax as the corresponding -element of `project`. -.PP -Element annotation -.PP -Zero or more annotation elements may be specified as children of a project or -remote element. Each element describes a name\-value pair. For projects, this -name\-value pair will be exported into each project's environment during a -\&'forall' command, prefixed with `REPO__`. In addition, there is an optional -attribute "keep" which accepts the case insensitive values "true" (default) or -"false". This attribute determines whether or not the annotation will be kept -when exported with the manifest subcommand. -.PP -Element copyfile -.PP -Zero or more copyfile elements may be specified as children of a project -element. Each element describes a src\-dest pair of files; the "src" file will be -copied to the "dest" place during `repo sync` command. -.PP -"src" is project relative, "dest" is relative to the top of the tree. Copying -from paths outside of the project or to paths outside of the repo client is not -allowed. -.PP -"src" and "dest" must be files. Directories or symlinks are not allowed. -Intermediate paths must not be symlinks either. -.PP -Parent directories of "dest" will be automatically created if missing. -.PP -Element linkfile -.PP -It's just like copyfile and runs at the same time as copyfile but instead of -copying it creates a symlink. -.PP -The symlink is created at "dest" (relative to the top of the tree) and points to -the path specified by "src" which is a path in the project. -.PP -Parent directories of "dest" will be automatically created if missing. -.PP -The symlink target may be a file or directory, but it may not point outside of -the repo client. -.PP -Element remove\-project -.PP -Deletes a project from the internal manifest table, possibly allowing a -subsequent project element in the same manifest file to replace the project with -a different source. -.PP -This element is mostly useful in a local manifest file, where the user can -remove a project, and possibly replace it with their own definition. -.PP -The project `name` or project `path` can be used to specify the remove target -meaning one of them is required. If only name is specified, all projects with -that name are removed. -.PP -If both name and path are specified, only projects with the same name and path -are removed, meaning projects with the same name but in other locations are -kept. -.PP -If only path is specified, a matching project is removed regardless of its name. -Logic otherwise behaves like both are specified. -.PP -Attribute `optional`: Set to true to ignore remove\-project elements with no -matching `project` element. -.PP -Attribute `base\-rev`: If specified, adds a check against the revision to be -removed. Manifest parse will fail and give a list of mismatch removes if the -revisions being removed have changed since base\-rev was set. Intended for use -with layered manifests using hash revisions to prevent patch branches hiding -newer upstream revisions. Also compares named refs like branches or tags but is -misleading if branches are used as base\-rev. Same syntax as the corresponding -element of `project`. -.PP -Element repo\-hooks -.PP -NB: See the [practical documentation](./repo\-hooks.md) for using repo hooks. -.PP -Only one repo\-hooks element may be specified at a time. Attempting to redefine -it will fail to parse. -.PP -Attribute `in\-project`: The project where the hooks are defined. The value must -match the `name` attribute (**not** the `path` attribute) of a previously -defined `project` element. -.PP -Attribute `enabled\-list`: List of hooks to use, whitespace or comma separated. -.PP -Element superproject -.PP -*** *Note*: This is currently a WIP. *** -.PP -NB: See the [git superprojects documentation]( -https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects) for background -information. -.PP -This element is used to specify the URL of the superproject. It has "name" and -"remote" as atrributes. Only "name" is required while the others have reasonable -defaults. At most one superproject may be specified. Attempting to redefine it -will fail to parse. -.PP -Attribute `name`: A unique name for the superproject. This attribute has the -same meaning as project's name attribute. See the [element -project](#element\-project) for more information. -.PP -Attribute `remote`: Name of a previously defined remote element. If not supplied -the remote given by the default element is used. -.PP -Attribute `revision`: Name of the Git branch the manifest wants to track for -this superproject. If not supplied the revision given by the remote element is -used if applicable, else the default element is used. -.PP -Element contactinfo -.PP -*** *Note*: This is currently a WIP. *** -.PP -This element is used to let manifest authors self\-register contact info. It has -"bugurl" as a required atrribute. This element can be repeated, and any later -entries will clobber earlier ones. This would allow manifest authors who extend -manifests to specify their own contact info. -.PP -Attribute `bugurl`: The URL to file a bug against the manifest owner. -.PP -Element include -.PP -This element provides the capability of including another manifest file into the -originating manifest. Normal rules apply for the target manifest to include \- it -must be a usable manifest on its own. -.PP -Attribute `name`: the manifest to include, specified relative to the manifest -repository's root. -.PP -"name" may not be an absolute path or use "." or ".." path components. These -restrictions are not enforced for [Local Manifests]. -.PP -Attribute `groups`: List of additional groups to which all projects in the -included manifest belong. This appends and recurses, meaning all projects in -included manifests carry all parent include groups. Same syntax as the -corresponding element of `project`. -.PP -Attribute `revision`: Name of a Git branch (e.g. `main` or `refs/heads/main`) -default to which all projects in the included manifest belong. -.PP -Local Manifests -.PP -Additional remotes and projects may be added through local manifest files stored -in `$TOP_DIR/.repo/local_manifests/*.xml`. -.PP -For example: -.IP -\f(CW$ ls .repo/local_manifests\fR -.IP -local_manifest.xml -another_local_manifest.xml -.IP -\f(CW$ cat .repo/local_manifests/local_manifest.xml\fR -.IP - - -.IP - -.IP - -.IP - -.PP -Users may add projects to the local manifest(s) prior to a `repo sync` -invocation, instructing repo to automatically download and manage these extra -projects. -.PP -Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will be loaded -in alphabetical order. -.PP -Projects from local manifest files are added into local:: group. -.PP -The legacy `$TOP_DIR/.repo/local_manifest.xml` path is no longer supported. -.SS [copyfile]: #Element\-copyfile [linkfile]: #Element\-linkfile [Local Manifests]: -.PP -#local\-manifests diff --git a/man/repo-overview.1 b/man/repo-overview.1 deleted file mode 100644 index 92292c09f..000000000 --- a/man/repo-overview.1 +++ /dev/null @@ -1,52 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo overview" "Repo Manual" -.SH NAME -repo \- repo overview - manual page for repo overview -.SH SYNOPSIS -.B repo -\fI\,overview \/\fR[\fI\,--current-branch\/\fR] [\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Display overview of unmerged project branches -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -consider only checked out branches -.TP -\fB\-\-no\-current\-branch\fR -consider all local branches -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help overview` to view the detailed manual. -.SH DETAILS -.PP -The 'repo overview' command is used to display an overview of the projects -branches, and list any local commits that have not yet been merged into the -project. -.PP -The \fB\-c\fR/\-\-current\-branch option can be used to restrict the output to only -branches currently checked out in each project. By default, all branches are -displayed. diff --git a/man/repo-prune.1 b/man/repo-prune.1 deleted file mode 100644 index 4af775d2a..000000000 --- a/man/repo-prune.1 +++ /dev/null @@ -1,41 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo prune" "Repo Manual" -.SH NAME -repo \- repo prune - manual page for repo prune -.SH SYNOPSIS -.B repo -\fI\,prune \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Prune (delete) already merged topics -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help prune` to view the detailed manual. diff --git a/man/repo-rebase.1 b/man/repo-rebase.1 deleted file mode 100644 index e4ff344ab..000000000 --- a/man/repo-rebase.1 +++ /dev/null @@ -1,68 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo rebase" "Repo Manual" -.SH NAME -repo \- repo rebase - manual page for repo rebase -.SH SYNOPSIS -.B repo -\fI\,rebase {\/\fR[\fI\,\/\fR...] \fI\,| -i \/\fR...\fI\,}\/\fR -.SH DESCRIPTION -Summary -.PP -Rebase local branches on upstream branch -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-\-fail\-fast\fR -stop rebasing after first error is hit -.TP -\fB\-f\fR, \fB\-\-force\-rebase\fR -pass \fB\-\-force\-rebase\fR to git rebase -.TP -\fB\-\-no\-ff\fR -pass \fB\-\-no\-ff\fR to git rebase -.TP -\fB\-\-autosquash\fR -pass \fB\-\-autosquash\fR to git rebase -.TP -\fB\-\-whitespace\fR=\fI\,WS\/\fR -pass \fB\-\-whitespace\fR to git rebase -.TP -\fB\-\-auto\-stash\fR -stash local modifications before starting -.TP -\fB\-m\fR, \fB\-\-onto\-manifest\fR -rebase onto the manifest version instead of upstream -HEAD (this helps to make sure the local tree stays -consistent if you previously synced to a manifest) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.TP -\fB\-i\fR, \fB\-\-interactive\fR -interactive rebase (single project only) -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help rebase` to view the detailed manual. -.SH DETAILS -.PP -\&'repo rebase' uses git rebase to move local changes in the current topic branch -to the HEAD of the upstream history, useful when you have made commits in a -topic branch but need to incorporate new upstream changes "underneath" them. diff --git a/man/repo-selfupdate.1 b/man/repo-selfupdate.1 deleted file mode 100644 index f7d4bafad..000000000 --- a/man/repo-selfupdate.1 +++ /dev/null @@ -1,48 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo selfupdate" "Repo Manual" -.SH NAME -repo \- repo selfupdate - manual page for repo selfupdate -.SH SYNOPSIS -.B repo -\fI\,selfupdate\/\fR -.SH DESCRIPTION -Summary -.PP -Update repo to the latest version -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.SS repo Version options: -.TP -\fB\-\-no\-repo\-verify\fR -do not verify repo source code -.PP -Run `repo help selfupdate` to view the detailed manual. -.SH DETAILS -.PP -The 'repo selfupdate' command upgrades repo to the latest version, if a newer -version is available. -.PP -Normally this is done automatically by 'repo sync' and does not need to be -performed by an end\-user. diff --git a/man/repo-smartsync.1 b/man/repo-smartsync.1 deleted file mode 100644 index dd36df016..000000000 --- a/man/repo-smartsync.1 +++ /dev/null @@ -1,156 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "June 2025" "repo smartsync" "Repo Manual" -.SH NAME -repo \- repo smartsync - manual page for repo smartsync -.SH SYNOPSIS -.B repo -\fI\,smartsync \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Update working tree to the latest known good revision -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-\-jobs\-network\fR=\fI\,JOBS\/\fR -number of network jobs to run in parallel (defaults to -\fB\-\-jobs\fR or 1). Ignored when \fB\-\-interleaved\fR is set -.TP -\fB\-\-jobs\-checkout\fR=\fI\,JOBS\/\fR -number of local checkout jobs to run in parallel -(defaults to \fB\-\-jobs\fR or 8). Ignored when \fB\-\-interleaved\fR -is set -.TP -\fB\-f\fR, \fB\-\-force\-broken\fR -obsolete option (to be deleted in the future) -.TP -\fB\-\-fail\-fast\fR -stop syncing after first error is hit -.TP -\fB\-\-force\-sync\fR -overwrite an existing git directory if it needs to -point to a different object directory. WARNING: this -may cause loss of data -.TP -\fB\-\-force\-checkout\fR -force checkout even if it results in throwing away -uncommitted modifications. WARNING: this may cause -loss of data -.TP -\fB\-\-force\-remove\-dirty\fR -force remove projects with uncommitted modifications -if projects no longer exist in the manifest. WARNING: -this may cause loss of data -.TP -\fB\-\-rebase\fR -rebase local commits regardless of whether they are -published -.TP -\fB\-l\fR, \fB\-\-local\-only\fR -only update working tree, don't fetch -.TP -\fB\-\-no\-manifest\-update\fR, \fB\-\-nmu\fR -use the existing manifest checkout as\-is. (do not -update to the latest revision) -.TP -\fB\-\-interleaved\fR -fetch and checkout projects in parallel (experimental) -.TP -\fB\-n\fR, \fB\-\-network\-only\fR -fetch only, don't update working tree -.TP -\fB\-d\fR, \fB\-\-detach\fR -detach projects back to manifest revision -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -fetch only current branch from server -.TP -\fB\-\-no\-current\-branch\fR -fetch all branches from server -.TP -\fB\-m\fR NAME.xml, \fB\-\-manifest\-name\fR=\fI\,NAME\/\fR.xml -temporary manifest to use for this sync -.TP -\fB\-\-clone\-bundle\fR -enable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS -.TP -\fB\-\-no\-clone\-bundle\fR -disable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS -.TP -\fB\-u\fR MANIFEST_SERVER_USERNAME, \fB\-\-manifest\-server\-username\fR=\fI\,MANIFEST_SERVER_USERNAME\/\fR -username to authenticate with the manifest server -.TP -\fB\-p\fR MANIFEST_SERVER_PASSWORD, \fB\-\-manifest\-server\-password\fR=\fI\,MANIFEST_SERVER_PASSWORD\/\fR -password to authenticate with the manifest server -.TP -\fB\-\-fetch\-submodules\fR -fetch submodules from server -.TP -\fB\-\-use\-superproject\fR -use the manifest superproject to sync projects; -implies \fB\-c\fR -.TP -\fB\-\-no\-use\-superproject\fR -disable use of manifest superprojects -.TP -\fB\-\-tags\fR -fetch tags -.TP -\fB\-\-no\-tags\fR -don't fetch tags (default) -.TP -\fB\-\-optimized\-fetch\fR -only fetch projects fixed to sha1 if revision does not -exist locally -.TP -\fB\-\-retry\-fetches\fR=\fI\,RETRY_FETCHES\/\fR -number of times to retry fetches on transient errors -.TP -\fB\-\-prune\fR -delete refs that no longer exist on the remote -(default) -.TP -\fB\-\-no\-prune\fR -do not delete refs that no longer exist on the remote -.TP -\fB\-\-auto\-gc\fR -run garbage collection on all synced projects -.TP -\fB\-\-no\-auto\-gc\fR -do not run garbage collection on any projects -(default) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.SS repo Version options: -.TP -\fB\-\-no\-repo\-verify\fR -do not verify repo source code -.PP -Run `repo help smartsync` to view the detailed manual. -.SH DETAILS -.PP -The 'repo smartsync' command is a shortcut for sync \fB\-s\fR. diff --git a/man/repo-stage.1 b/man/repo-stage.1 deleted file mode 100644 index 063db00e5..000000000 --- a/man/repo-stage.1 +++ /dev/null @@ -1,43 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo stage" "Repo Manual" -.SH NAME -repo \- repo stage - manual page for repo stage -.SH SYNOPSIS -.B repo -\fI\,stage -i \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Stage file(s) for commit -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.TP -\fB\-i\fR, \fB\-\-interactive\fR -use interactive staging -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help stage` to view the detailed manual. -.SH DETAILS -.PP -The 'repo stage' command stages files to prepare the next commit. diff --git a/man/repo-start.1 b/man/repo-start.1 deleted file mode 100644 index f972d9573..000000000 --- a/man/repo-start.1 +++ /dev/null @@ -1,54 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo start" "Repo Manual" -.SH NAME -repo \- repo start - manual page for repo start -.SH SYNOPSIS -.B repo -\fI\,start \/\fR[\fI\,--all | \/\fR...] -.SH DESCRIPTION -Summary -.PP -Start a new branch for development -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-\-all\fR -begin branch in all projects -.TP -\fB\-r\fR REVISION, \fB\-\-rev\fR=\fI\,REVISION\/\fR, \fB\-\-revision\fR=\fI\,REVISION\/\fR -point branch at this revision instead of upstream -.TP -\fB\-\-head\fR, \fB\-\-HEAD\fR -abbreviation for \fB\-\-rev\fR HEAD -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help start` to view the detailed manual. -.SH DETAILS -.PP -\&'repo start' begins a new branch of development, starting from the revision -specified in the manifest. diff --git a/man/repo-status.1 b/man/repo-status.1 deleted file mode 100644 index db8723fb2..000000000 --- a/man/repo-status.1 +++ /dev/null @@ -1,111 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo status" "Repo Manual" -.SH NAME -repo \- repo status - manual page for repo status -.SH SYNOPSIS -.B repo -\fI\,status \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Show the working tree status -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-o\fR, \fB\-\-orphans\fR -include objects in working directory outside of repo -projects -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help status` to view the detailed manual. -.SH DETAILS -.PP -\&'repo status' compares the working tree to the staging area (aka index), and the -most recent commit on this branch (HEAD), in each project specified. A summary -is displayed, one line per file where there is a difference between these three -states. -.PP -The \fB\-j\fR/\-\-jobs option can be used to run multiple status queries in parallel. -.PP -The \fB\-o\fR/\-\-orphans option can be used to show objects that are in the working -directory, but not associated with a repo project. This includes unmanaged -top\-level files and directories, but also includes deeper items. For example, if -dir/subdir/proj1 and dir/subdir/proj2 are repo projects, dir/subdir/proj3 will -be shown if it is not known to repo. -.PP -Status Display -.PP -The status display is organized into three columns of information, for example -if the file 'subcmds/status.py' is modified in the project 'repo' on branch -\&'devwork': -.TP -project repo/ -branch devwork -.TP -\fB\-m\fR -subcmds/status.py -.PP -The first column explains how the staging area (index) differs from the last -commit (HEAD). Its values are always displayed in upper case and have the -following meanings: -.TP -\-: -no difference -.TP -A: -added (not in HEAD, in index ) -.TP -M: -modified ( in HEAD, in index, different content ) -.TP -D: -deleted ( in HEAD, not in index ) -.TP -R: -renamed (not in HEAD, in index, path changed ) -.TP -C: -copied (not in HEAD, in index, copied from another) -.TP -T: -mode changed ( in HEAD, in index, same content ) -.TP -U: -unmerged; conflict resolution required -.PP -The second column explains how the working directory differs from the index. Its -values are always displayed in lower case and have the following meanings: -.TP -\-: -new / unknown (not in index, in work tree ) -.TP -m: -modified ( in index, in work tree, modified ) -.TP -d: -deleted ( in index, not in work tree ) diff --git a/man/repo-sync.1 b/man/repo-sync.1 deleted file mode 100644 index 6e9dd8ad8..000000000 --- a/man/repo-sync.1 +++ /dev/null @@ -1,255 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "June 2025" "repo sync" "Repo Manual" -.SH NAME -repo \- repo sync - manual page for repo sync -.SH SYNOPSIS -.B repo -\fI\,sync \/\fR[\fI\,\/\fR...] -.SH DESCRIPTION -Summary -.PP -Update working tree to the latest revision -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-\-jobs\-network\fR=\fI\,JOBS\/\fR -number of network jobs to run in parallel (defaults to -\fB\-\-jobs\fR or 1). Ignored when \fB\-\-interleaved\fR is set -.TP -\fB\-\-jobs\-checkout\fR=\fI\,JOBS\/\fR -number of local checkout jobs to run in parallel -(defaults to \fB\-\-jobs\fR or 8). Ignored when \fB\-\-interleaved\fR -is set -.TP -\fB\-f\fR, \fB\-\-force\-broken\fR -obsolete option (to be deleted in the future) -.TP -\fB\-\-fail\-fast\fR -stop syncing after first error is hit -.TP -\fB\-\-force\-sync\fR -overwrite an existing git directory if it needs to -point to a different object directory. WARNING: this -may cause loss of data -.TP -\fB\-\-force\-checkout\fR -force checkout even if it results in throwing away -uncommitted modifications. WARNING: this may cause -loss of data -.TP -\fB\-\-force\-remove\-dirty\fR -force remove projects with uncommitted modifications -if projects no longer exist in the manifest. WARNING: -this may cause loss of data -.TP -\fB\-\-rebase\fR -rebase local commits regardless of whether they are -published -.TP -\fB\-l\fR, \fB\-\-local\-only\fR -only update working tree, don't fetch -.TP -\fB\-\-no\-manifest\-update\fR, \fB\-\-nmu\fR -use the existing manifest checkout as\-is. (do not -update to the latest revision) -.TP -\fB\-\-interleaved\fR -fetch and checkout projects in parallel (experimental) -.TP -\fB\-n\fR, \fB\-\-network\-only\fR -fetch only, don't update working tree -.TP -\fB\-d\fR, \fB\-\-detach\fR -detach projects back to manifest revision -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -fetch only current branch from server -.TP -\fB\-\-no\-current\-branch\fR -fetch all branches from server -.TP -\fB\-m\fR NAME.xml, \fB\-\-manifest\-name\fR=\fI\,NAME\/\fR.xml -temporary manifest to use for this sync -.TP -\fB\-\-clone\-bundle\fR -enable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS -.TP -\fB\-\-no\-clone\-bundle\fR -disable use of \fI\,/clone.bundle\/\fP on HTTP/HTTPS -.TP -\fB\-u\fR MANIFEST_SERVER_USERNAME, \fB\-\-manifest\-server\-username\fR=\fI\,MANIFEST_SERVER_USERNAME\/\fR -username to authenticate with the manifest server -.TP -\fB\-p\fR MANIFEST_SERVER_PASSWORD, \fB\-\-manifest\-server\-password\fR=\fI\,MANIFEST_SERVER_PASSWORD\/\fR -password to authenticate with the manifest server -.TP -\fB\-\-fetch\-submodules\fR -fetch submodules from server -.TP -\fB\-\-use\-superproject\fR -use the manifest superproject to sync projects; -implies \fB\-c\fR -.TP -\fB\-\-no\-use\-superproject\fR -disable use of manifest superprojects -.TP -\fB\-\-tags\fR -fetch tags -.TP -\fB\-\-no\-tags\fR -don't fetch tags (default) -.TP -\fB\-\-optimized\-fetch\fR -only fetch projects fixed to sha1 if revision does not -exist locally -.TP -\fB\-\-retry\-fetches\fR=\fI\,RETRY_FETCHES\/\fR -number of times to retry fetches on transient errors -.TP -\fB\-\-prune\fR -delete refs that no longer exist on the remote -(default) -.TP -\fB\-\-no\-prune\fR -do not delete refs that no longer exist on the remote -.TP -\fB\-\-auto\-gc\fR -run garbage collection on all synced projects -.TP -\fB\-\-no\-auto\-gc\fR -do not run garbage collection on any projects -(default) -.TP -\fB\-s\fR, \fB\-\-smart\-sync\fR -smart sync using manifest from the latest known good -build -.TP -\fB\-t\fR SMART_TAG, \fB\-\-smart\-tag\fR=\fI\,SMART_TAG\/\fR -smart sync using manifest from a known tag -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.SS repo Version options: -.TP -\fB\-\-no\-repo\-verify\fR -do not verify repo source code -.PP -Run `repo help sync` to view the detailed manual. -.SH DETAILS -.PP -The 'repo sync' command synchronizes local project directories with the remote -repositories specified in the manifest. If a local project does not yet exist, -it will clone a new local directory from the remote repository and set up -tracking branches as specified in the manifest. If the local project already -exists, 'repo sync' will update the remote branches and rebase any new local -changes on top of the new remote changes. -.PP -\&'repo sync' will synchronize all projects listed at the command line. Projects -can be specified either by name, or by a relative or absolute path to the -project's local directory. If no projects are specified, 'repo sync' will -synchronize all projects listed in the manifest. -.PP -The \fB\-d\fR/\-\-detach option can be used to switch specified projects back to the -manifest revision. This option is especially helpful if the project is currently -on a topic branch, but the manifest revision is temporarily needed. -.PP -The \fB\-s\fR/\-\-smart\-sync option can be used to sync to a known good build as -specified by the manifest\-server element in the current manifest. The -\fB\-t\fR/\-\-smart\-tag option is similar and allows you to specify a custom tag/label. -.PP -The \fB\-u\fR/\-\-manifest\-server\-username and \fB\-p\fR/\-\-manifest\-server\-password options can -be used to specify a username and password to authenticate with the manifest -server when using the \fB\-s\fR or \fB\-t\fR option. -.PP -If \fB\-u\fR and \fB\-p\fR are not specified when using the \fB\-s\fR or \fB\-t\fR option, 'repo sync' will -attempt to read authentication credentials for the manifest server from the -user's .netrc file. -.PP -\&'repo sync' will not use authentication credentials from \fB\-u\fR/\-p or .netrc if the -manifest server specified in the manifest file already includes credentials. -.PP -By default, all projects will be synced. The \fB\-\-fail\-fast\fR option can be used to -halt syncing as soon as possible when the first project fails to sync. -.PP -The \fB\-\-force\-sync\fR option can be used to overwrite existing git directories if -they have previously been linked to a different object directory. WARNING: This -may cause data to be lost since refs may be removed when overwriting. -.PP -The \fB\-\-force\-checkout\fR option can be used to force git to switch revs even if the -index or the working tree differs from HEAD, and if there are untracked files. -WARNING: This may cause data to be lost since uncommitted changes may be -removed. -.PP -The \fB\-\-force\-remove\-dirty\fR option can be used to remove previously used projects -with uncommitted changes. WARNING: This may cause data to be lost since -uncommitted changes may be removed with projects that no longer exist in the -manifest. -.PP -The \fB\-\-no\-clone\-bundle\fR option disables any attempt to use \fI\,$URL/clone.bundle\/\fP to -bootstrap a new Git repository from a resumeable bundle file on a content -delivery network. This may be necessary if there are problems with the local -Python HTTP client or proxy configuration, but the Git binary works. -.PP -The \fB\-\-fetch\-submodules\fR option enables fetching Git submodules of a project from -server. -.PP -The \fB\-c\fR/\-\-current\-branch option can be used to only fetch objects that are on the -branch specified by a project's revision. -.PP -The \fB\-\-optimized\-fetch\fR option can be used to only fetch projects that are fixed -to a sha1 revision if the sha1 revision does not already exist locally. -.PP -The \fB\-\-prune\fR option can be used to remove any refs that no longer exist on the -remote. -.PP -The \fB\-\-auto\-gc\fR option can be used to trigger garbage collection on all projects. -By default, repo does not run garbage collection. -.PP -SSH Connections -.PP -If at least one project remote URL uses an SSH connection (ssh://, git+ssh://, -or user@host:path syntax) repo will automatically enable the SSH ControlMaster -option when connecting to that host. This feature permits other projects in the -same 'repo sync' session to reuse the same SSH tunnel, saving connection setup -overheads. -.PP -To disable this behavior on UNIX platforms, set the GIT_SSH environment variable -to 'ssh'. For example: -.IP -export GIT_SSH=ssh -repo sync -.PP -Compatibility -.PP -This feature is automatically disabled on Windows, due to the lack of UNIX -domain socket support. -.PP -This feature is not compatible with url.insteadof rewrites in the user's -~/.gitconfig. 'repo sync' is currently not able to perform the rewrite early -enough to establish the ControlMaster tunnel. -.PP -If the remote SSH daemon is Gerrit Code Review, version 2.0.10 or later is -required to fix a server side protocol bug. diff --git a/man/repo-upload.1 b/man/repo-upload.1 deleted file mode 100644 index c0ae5816e..000000000 --- a/man/repo-upload.1 +++ /dev/null @@ -1,215 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "June 2024" "repo upload" "Repo Manual" -.SH NAME -repo \- repo upload - manual page for repo upload -.SH SYNOPSIS -.B repo -\fI\,upload \/\fR[\fI\,--re --cc\/\fR] [\fI\,\/\fR]... -.SH DESCRIPTION -Summary -.PP -Upload changes for code review -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-j\fR JOBS, \fB\-\-jobs\fR=\fI\,JOBS\/\fR -number of jobs to run in parallel (default: based on -number of CPU cores) -.TP -\fB\-t\fR, \fB\-\-topic\-branch\fR -set the topic to the local branch name -.TP -\fB\-\-topic\fR=\fI\,TOPIC\/\fR -set topic for the change -.TP -\fB\-\-hashtag\fR=\fI\,HASHTAGS\/\fR, \fB\-\-ht\fR=\fI\,HASHTAGS\/\fR -add hashtags (comma delimited) to the review -.TP -\fB\-\-hashtag\-branch\fR, \fB\-\-htb\fR -add local branch name as a hashtag -.TP -\fB\-l\fR LABELS, \fB\-\-label\fR=\fI\,LABELS\/\fR -add a label when uploading -.TP -\fB\-\-pd\fR=\fI\,PATCHSET_DESCRIPTION\/\fR, \fB\-\-patchset\-description\fR=\fI\,PATCHSET_DESCRIPTION\/\fR -description for patchset -.TP -\fB\-\-re\fR=\fI\,REVIEWERS\/\fR, \fB\-\-reviewers\fR=\fI\,REVIEWERS\/\fR -request reviews from these people -.TP -\fB\-\-cc\fR=\fI\,CC\/\fR -also send email to these email addresses -.TP -\fB\-\-br\fR=\fI\,BRANCH\/\fR, \fB\-\-branch\fR=\fI\,BRANCH\/\fR -(local) branch to upload -.TP -\fB\-c\fR, \fB\-\-current\-branch\fR -upload current git branch -.TP -\fB\-\-no\-current\-branch\fR -upload all git branches -.TP -\fB\-\-ne\fR, \fB\-\-no\-emails\fR -do not send e\-mails on upload -.TP -\fB\-p\fR, \fB\-\-private\fR -upload as a private change (deprecated; use \fB\-\-wip\fR) -.TP -\fB\-w\fR, \fB\-\-wip\fR -upload as a work\-in\-progress change -.TP -\fB\-r\fR, \fB\-\-ready\fR -mark change as ready (clears work\-in\-progress setting) -.TP -\fB\-o\fR PUSH_OPTIONS, \fB\-\-push\-option\fR=\fI\,PUSH_OPTIONS\/\fR -additional push options to transmit -.TP -\fB\-D\fR BRANCH, \fB\-\-destination\fR=\fI\,BRANCH\/\fR, \fB\-\-dest\fR=\fI\,BRANCH\/\fR -submit for review on this target branch -.TP -\fB\-n\fR, \fB\-\-dry\-run\fR -do everything except actually upload the CL -.TP -\fB\-y\fR, \fB\-\-yes\fR -answer yes to all safe prompts -.TP -\fB\-\-ignore\-untracked\-files\fR -ignore untracked files in the working copy -.TP -\fB\-\-no\-ignore\-untracked\-files\fR -always ask about untracked files in the working copy -.TP -\fB\-\-no\-cert\-checks\fR -disable verifying ssl certs (unsafe) -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.SS pre\-upload hooks: -.TP -\fB\-\-no\-verify\fR -Do not run the pre\-upload hook. -.TP -\fB\-\-verify\fR -Run the pre\-upload hook without prompting. -.TP -\fB\-\-ignore\-hooks\fR -Do not abort if pre\-upload hooks fail. -.PP -Run `repo help upload` to view the detailed manual. -.SH DETAILS -.PP -The 'repo upload' command is used to send changes to the Gerrit Code Review -system. It searches for topic branches in local projects that have not yet been -published for review. If multiple topic branches are found, 'repo upload' opens -an editor to allow the user to select which branches to upload. -.PP -\&'repo upload' searches for uploadable changes in all projects listed at the -command line. Projects can be specified either by name, or by a relative or -absolute path to the project's local directory. If no projects are specified, -\&'repo upload' will search for uploadable changes in all projects listed in the -manifest. -.PP -If the \fB\-\-reviewers\fR or \fB\-\-cc\fR options are passed, those emails are added to the -respective list of users, and emails are sent to any new users. Users passed as -\fB\-\-reviewers\fR must already be registered with the code review system, or the -upload will fail. -.PP -While most normal Gerrit options have dedicated command line options, direct -access to the Gerit options is available via \fB\-\-push\-options\fR. This is useful when -Gerrit has newer functionality that repo upload doesn't yet support, or doesn't -have plans to support. See the Push Options documentation for more details: -https://gerrit\-review.googlesource.com/Documentation/user\-upload.html#push_options -.PP -Configuration -.PP -review.URL.autoupload: -.PP -To disable the "Upload ... (y/N)?" prompt, you can set a per\-project or global -Git configuration option. If review.URL.autoupload is set to "true" then repo -will assume you always answer "y" at the prompt, and will not prompt you -further. If it is set to "false" then repo will assume you always answer "n", -and will abort. -.PP -review.URL.autoreviewer: -.PP -To automatically append a user or mailing list to reviews, you can set a -per\-project or global Git option to do so. -.PP -review.URL.autocopy: -.PP -To automatically copy a user or mailing list to all uploaded reviews, you can -set a per\-project or global Git option to do so. Specifically, -review.URL.autocopy can be set to a comma separated list of reviewers who you -always want copied on all uploads with a non\-empty \fB\-\-re\fR argument. -.PP -review.URL.username: -.PP -Override the username used to connect to Gerrit Code Review. By default the -local part of the email address is used. -.PP -The URL must match the review URL listed in the manifest XML file, or in the -\&.git/config within the project. For example: -.IP -[remote "origin"] -.IP -url = git://git.example.com/project.git -review = http://review.example.com/ -.IP -[review "http://review.example.com/"] -.IP -autoupload = true -autocopy = johndoe@company.com,my\-team\-alias@company.com -.PP -review.URL.uploadtopic: -.PP -To add a topic branch whenever uploading a commit, you can set a per\-project or -global Git option to do so. If review.URL.uploadtopic is set to "true" then repo -will assume you always want the equivalent of the \fB\-t\fR option to the repo command. -If unset or set to "false" then repo will make use of only the command line -option. -.PP -review.URL.uploadhashtags: -.PP -To add hashtags whenever uploading a commit, you can set a per\-project or global -Git option to do so. The value of review.URL.uploadhashtags will be used as -comma delimited hashtags like the \fB\-\-hashtag\fR option. -.PP -review.URL.uploadlabels: -.PP -To add labels whenever uploading a commit, you can set a per\-project or global -Git option to do so. The value of review.URL.uploadlabels will be used as comma -delimited labels like the \fB\-\-label\fR option. -.PP -review.URL.uploadnotify: -.PP -Control e\-mail notifications when uploading. -https://gerrit\-review.googlesource.com/Documentation/user\-upload.html#notify -.PP -review.URL.uploadwarningthreshold: -.PP -Repo will warn you if you are attempting to upload a large number of commits in -one or more branches. By default, the threshold is five commits. This option -allows you to override the warning threshold to a different value. -.PP -References -.PP -Gerrit Code Review: https://www.gerritcodereview.com/ diff --git a/man/repo-version.1 b/man/repo-version.1 deleted file mode 100644 index 67d25d7b5..000000000 --- a/man/repo-version.1 +++ /dev/null @@ -1,37 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "July 2022" "repo version" "Repo Manual" -.SH NAME -repo \- repo version - manual page for repo version -.SH SYNOPSIS -.B repo -\fI\,version\/\fR -.SH DESCRIPTION -Summary -.PP -Display the version of repo -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.SS Logging options: -.TP -\fB\-v\fR, \fB\-\-verbose\fR -show all output -.TP -\fB\-q\fR, \fB\-\-quiet\fR -only show errors -.SS Multi\-manifest options: -.TP -\fB\-\-outer\-manifest\fR -operate starting at the outermost manifest -.TP -\fB\-\-no\-outer\-manifest\fR -do not operate on outer manifests -.TP -\fB\-\-this\-manifest\-only\fR -only operate on this (sub)manifest -.TP -\fB\-\-no\-this\-manifest\-only\fR, \fB\-\-all\-manifests\fR -operate on this manifest and its submanifests -.PP -Run `repo help version` to view the detailed manual. diff --git a/man/repo.1 b/man/repo.1 deleted file mode 100644 index 6c0e02558..000000000 --- a/man/repo.1 +++ /dev/null @@ -1,137 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH REPO "1" "April 2025" "repo" "Repo Manual" -.SH NAME -repo \- repository management tool built on top of git -.SH SYNOPSIS -.B repo -[\fI\,-p|--paginate|--no-pager\/\fR] \fI\,COMMAND \/\fR[\fI\,ARGS\/\fR] -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-\-help\-all\fR -show this help message with all subcommands and exit -.TP -\fB\-p\fR, \fB\-\-paginate\fR -display command output in the pager -.TP -\fB\-\-no\-pager\fR -disable the pager -.TP -\fB\-\-color\fR=\fI\,COLOR\/\fR -control color usage: auto, always, never -.TP -\fB\-\-trace\fR -trace git command execution (REPO_TRACE=1) -.TP -\fB\-\-trace\-to\-stderr\fR -trace outputs go to stderr in addition to -\&.repo/TRACE_FILE -.TP -\fB\-\-trace\-python\fR -trace python command execution -.TP -\fB\-\-time\fR -time repo command execution -.TP -\fB\-\-version\fR -display this version of repo -.TP -\fB\-\-show\-toplevel\fR -display the path of the top\-level directory of the -repo client checkout -.TP -\fB\-\-event\-log\fR=\fI\,EVENT_LOG\/\fR -filename of event log to append timeline to -.TP -\fB\-\-git\-trace2\-event\-log\fR=\fI\,GIT_TRACE2_EVENT_LOG\/\fR -directory to write git trace2 event log to -.TP -\fB\-\-submanifest\-path\fR=\fI\,REL_PATH\/\fR -submanifest path -.SS "The complete list of recognized repo commands is:" -.TP -abandon -Permanently abandon a development branch -.TP -branch -View current topic branches -.TP -branches -View current topic branches -.TP -checkout -Checkout a branch for development -.TP -cherry\-pick -Cherry\-pick a change. -.TP -diff -Show changes between commit and working tree -.TP -diffmanifests -Manifest diff utility -.TP -download -Download and checkout a change -.TP -forall -Run a shell command in each project -.TP -gc -Cleaning up internal repo and Git state. -.TP -grep -Print lines matching a pattern -.TP -help -Display detailed help on a command -.TP -info -Get info on the manifest branch, current branch or unmerged branches -.TP -init -Initialize a repo client checkout in the current directory -.TP -list -List projects and their associated directories -.TP -manifest -Manifest inspection utility -.TP -overview -Display overview of unmerged project branches -.TP -prune -Prune (delete) already merged topics -.TP -rebase -Rebase local branches on upstream branch -.TP -selfupdate -Update repo to the latest version -.TP -smartsync -Update working tree to the latest known good revision -.TP -stage -Stage file(s) for commit -.TP -start -Start a new branch for development -.TP -status -Show the working tree status -.TP -sync -Update working tree to the latest revision -.TP -upload -Upload changes for code review -.TP -version -Display the version of repo -.PP -See 'repo help ' for more information on a specific command. -Bug reports: https://issues.gerritcodereview.com/issues/new?component=1370071 diff --git a/project.py b/project.py index 2d802f249..6307d7602 100644 --- a/project.py +++ b/project.py @@ -20,7 +20,6 @@ import random import re import shutil -import stat import string import subprocess import sys @@ -431,12 +430,12 @@ def _Copy(self): if not platform_utils.isdir(dest_dir): os.makedirs(dest_dir) shutil.copy(src, dest) - # Make the file read-only. - mode = os.stat(dest)[stat.ST_MODE] - mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) - os.chmod(dest, mode) - except OSError: - logger.error("error: Cannot copy file %s to %s", src, dest) + # Don't mess with the file's attributes. + # mode = os.stat(dest)[stat.ST_MODE] + # mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) + # os.chmod(dest, mode) + except IOError: + logger.error("Cannot copy file %s to %s", src, dest) class _LinkFile: diff --git a/pyproject.toml b/pyproject.toml index 6a6a583af..b1618e6a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,14 @@ line-length = 80 # NB: Keep in sync with tox.ini. target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py311'] #, 'py312' +extend-exclude = ''' +( + \.devcontainer/fix-line-endings\.py +) +''' + +[tool.isort] +skip = [".devcontainer/fix-line-endings.py"] [tool.pytest.ini_options] markers = """ diff --git a/release/update-manpages b/release/update-manpages deleted file mode 100755 index 6679b1790..000000000 --- a/release/update-manpages +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (C) 2021 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Helper tool for generating manual page for all repo commands. - -This is intended to be run before every official Repo release. -""" - -import sys - -import update_manpages - - -sys.exit(update_manpages.main(sys.argv[1:])) diff --git a/release/update_manpages.py b/release/update_manpages.py deleted file mode 100644 index 9ada83ff3..000000000 --- a/release/update_manpages.py +++ /dev/null @@ -1,183 +0,0 @@ -# Copyright (C) 2021 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Helper tool for generating manual page for all repo commands. - -Most code lives in this module so it can be unittested. -""" - -import argparse -import functools -import multiprocessing -import os -from pathlib import Path -import re -import shutil -import subprocess -import sys -import tempfile -from typing import List - - -THIS_FILE = Path(__file__).resolve() -TOPDIR = THIS_FILE.parent.parent -MANDIR = TOPDIR.joinpath("man") - -# Load repo local modules. -sys.path.insert(0, str(TOPDIR)) -from git_command import RepoSourceVersion -import subcmds - - -def worker(cmd, **kwargs): - subprocess.run(cmd, **kwargs) - - -def get_parser() -> argparse.ArgumentParser: - """Get argument parser.""" - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument( - "-n", - "--check", - "--dry-run", - action="store_const", - const=True, - help="Check if changes are necessary; don't actually change files", - ) - return parser - - -def main(argv: List[str]) -> int: - parser = get_parser() - opts = parser.parse_args(argv) - - if not shutil.which("help2man"): - sys.exit("Please install help2man to continue.") - - # Let repo know we're generating man pages so it can avoid some dynamic - # behavior (like probing active number of CPUs). We use a weird name & - # value to make it less likely for users to set this var themselves. - os.environ["_REPO_GENERATE_MANPAGES_"] = " indeed! " - - # "repo branch" is an alias for "repo branches". - del subcmds.all_commands["branch"] - (MANDIR / "repo-branch.1").write_text(".so man1/repo-branches.1") - - version = RepoSourceVersion() - cmdlist = [ - [ - "help2man", - "-N", - "-n", - f"repo {cmd} - manual page for repo {cmd}", - "-S", - f"repo {cmd}", - "-m", - "Repo Manual", - f"--version-string={version}", - "-o", - MANDIR.joinpath(f"repo-{cmd}.1.tmp"), - "./repo", - "-h", - f"help {cmd}", - ] - for cmd in subcmds.all_commands - ] - cmdlist.append( - [ - "help2man", - "-N", - "-n", - "repository management tool built on top of git", - "-S", - "repo", - "-m", - "Repo Manual", - f"--version-string={version}", - "-o", - MANDIR.joinpath("repo.1.tmp"), - "./repo", - "-h", - "--help-all", - ] - ) - - with tempfile.TemporaryDirectory() as tempdir: - tempdir = Path(tempdir) - repo_dir = tempdir / ".repo" - repo_dir.mkdir() - (repo_dir / "repo").symlink_to(TOPDIR) - - # Create a repo wrapper using the active Python executable. We can't - # pass this directly to help2man as it's too simple, so insert it via - # shebang. - data = (TOPDIR / "repo").read_text(encoding="utf-8") - tempbin = tempdir / "repo" - tempbin.write_text(f"#!{sys.executable}\n" + data, encoding="utf-8") - tempbin.chmod(0o755) - - # Run all cmd in parallel, and wait for them to finish. - with multiprocessing.Pool() as pool: - pool.map( - functools.partial(worker, cwd=tempdir, check=True), cmdlist - ) - - ret = 0 - for tmp_path in MANDIR.glob("*.1.tmp"): - path = tmp_path.parent / tmp_path.stem - old_data = path.read_text() if path.exists() else "" - - data = tmp_path.read_text() - tmp_path.unlink() - - data = replace_regex(data) - - # If the only thing that changed was the date, don't refresh. This - # avoids a lot of noise when only one file actually updates. - old_data = re.sub( - r'^(\.TH REPO "1" ")([^"]+)', r"\1", old_data, flags=re.M - ) - new_data = re.sub(r'^(\.TH REPO "1" ")([^"]+)', r"\1", data, flags=re.M) - if old_data != new_data: - if opts.check: - ret = 1 - print( - f"{THIS_FILE.name}: {path.name}: " - "man page needs regenerating", - file=sys.stderr, - ) - else: - path.write_text(data) - - return ret - - -def replace_regex(data): - """Replace semantically null regexes in the data. - - Args: - data: manpage text. - - Returns: - Updated manpage text. - """ - regex = ( - (r"(It was generated by help2man) [0-9.]+", r"\g<1>."), - (r"^\033\[[0-9;]*m([^\033]*)\033\[m", r"\g<1>"), - (r"^\.IP\n(.*:)\n", r".SS \g<1>\n"), - (r"^\.PP\nDescription", r".SH DETAILS"), - ) - for pattern, replacement in regex: - data = re.sub(pattern, replacement, data, flags=re.M) - return data diff --git a/repo b/repo index 2526ab03f..7112c4ae1 100755 --- a/repo +++ b/repo @@ -22,12 +22,14 @@ copy of repo in the checkout. """ import datetime +import json import os import platform import shlex import subprocess import sys from typing import NamedTuple +import urllib.request # These should never be newer than the main.py version since this needs to be a @@ -118,16 +120,36 @@ if __name__ == "__main__": check_python_version() +def _GetLatestCaylentTag(): + """Fetch the latest caylent-* tag from GitHub.""" + try: + url = "https://api.github.com/repos/caylent-solutions/git-repo/tags" + response = urllib.request.urlopen(url, timeout=5) + tags = json.loads(response.read()) + for tag in tags: + name = tag.get("name", "") + if name.startswith("caylent-"): + return name + raise Exception("No caylent-* tags found in repository") + except Exception as e: + print( + f"fatal: Unable to fetch latest caylent tag from GitHub: {e}\n" + "Please specify --repo-rev explicitly or check your network connection.", + file=sys.stderr, + ) + sys.exit(1) + + # repo default configuration # REPO_URL = os.environ.get("REPO_URL", None) if not REPO_URL: - REPO_URL = "https://gerrit.googlesource.com/git-repo" + REPO_URL = "https://github.com/caylent-solutions/git-repo" REPO_REV = os.environ.get("REPO_REV") if not REPO_REV: - REPO_REV = "stable" + REPO_REV = None # Will be set lazily in _Init # URL to file bug reports for repo tool issues. -BUG_URL = "https://issues.gerritcodereview.com/issues/new?component=1370071" +BUG_URL = "https://github.com/caylent-solutions/git-repo/issues" # increment this whenever we make important changes to this script VERSION = (2, 54) @@ -604,7 +626,7 @@ def _Init(args): opt.clone_bundle = False if opt.partial_clone else True url = opt.repo_url or REPO_URL - rev = opt.repo_rev or REPO_REV + rev = opt.repo_rev or REPO_REV or _GetLatestCaylentTag() try: os.mkdir(repodir) diff --git a/repo_trace.py b/repo_trace.py index ee224ea7c..2d7bff83e 100644 --- a/repo_trace.py +++ b/repo_trace.py @@ -133,6 +133,9 @@ def _GetTraceFile(quiet): """Get the trace file or create one.""" # TODO: refactor to pass repodir to Trace. repo_dir = os.path.dirname(os.path.dirname(__file__)) + # Use temp directory if repo_dir is not writable + if not os.access(repo_dir, os.W_OK): + repo_dir = tempfile.gettempdir() trace_file = os.path.join(repo_dir, _TRACE_FILE_NAME) if not quiet: print(f"Trace outputs in {trace_file}", file=sys.stderr) diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..b884657e6 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,7 @@ +tox~=4.32.0 +pytest~=9.0.0 +pytest-cov~=7.0.0 +pytest-timeout~=2.4.0 +black~=25.11.0 +flake8~=7.3.0 +isort~=7.0.0 diff --git a/run_tests b/run_tests index 9a8fad3bc..49a2b45d2 100755 --- a/run_tests +++ b/run_tests @@ -17,7 +17,6 @@ import functools import os -import shutil import subprocess import sys from typing import List @@ -37,36 +36,16 @@ def run_pytest(argv: List[str]) -> int: if is_ci(): argv = ["-m", "not skip_cq"] + argv + env = os.environ.copy() + env["REPO_REV"] = "stable" return subprocess.run( [sys.executable, "-m", "pytest"] + argv, check=False, cwd=ROOT_DIR, + env=env, ).returncode -def run_pytest_py38(argv: List[str]) -> int: - """Returns the exit code from pytest under Python 3.8.""" - if is_ci(): - argv = ["-m", "not skip_cq"] + argv - - try: - return subprocess.run( - [ - "vpython3", - "-vpython-spec", - "run_tests.vpython3.8", - "-m", - "pytest", - ] - + argv, - check=False, - cwd=ROOT_DIR, - ).returncode - except FileNotFoundError: - # Skip if the user doesn't have vpython from depot_tools. - return 0 - - def run_black(): """Returns the exit code from black.""" # Black by default only matches .py files. We have to list standalone @@ -75,7 +54,6 @@ def run_black(): "repo", "run_tests", "release/update-hooks", - "release/update-manpages", ] return subprocess.run( [sys.executable, "-m", "black", "--check", ROOT_DIR] + extra_programs, @@ -102,29 +80,13 @@ def run_isort(): ).returncode -def run_update_manpages() -> int: - """Returns the exit code from release/update-manpages.""" - # Allow this to fail on CI, but not local devs. - if is_ci() and not shutil.which("help2man"): - print("update-manpages: help2man not found; skipping test") - return 0 - - return subprocess.run( - [sys.executable, "release/update-manpages", "--check"], - check=False, - cwd=ROOT_DIR, - ).returncode - - def main(argv): """The main entry.""" checks = ( functools.partial(run_pytest, argv), - functools.partial(run_pytest_py38, argv), run_black, run_flake8, run_isort, - run_update_manpages, ) # Run all the tests all the time to get full feedback. Don't exit on the # first error as that makes it more difficult to iterate in the CQ. diff --git a/setup.py b/setup.py index dca44ade1..7269ce29e 100755 --- a/setup.py +++ b/setup.py @@ -59,4 +59,5 @@ ], python_requires=">=3.6", packages=["subcmds"], + scripts=["repo"], ) diff --git a/subcmds/envsubst.py b/subcmds/envsubst.py new file mode 100644 index 000000000..59b2c1b4e --- /dev/null +++ b/subcmds/envsubst.py @@ -0,0 +1,99 @@ +# Copyright (C) 2011 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import glob +import os +from xml.dom import minidom +from xml.dom.minidom import parseString + +from command import Command +from command import MirrorSafeCommand + + +class Envsubst(Command, MirrorSafeCommand): + COMMON = True + helpSummary = "Replace ENV vars in all xml manifest files" + helpUsage = """ +%prog +""" + helpDescription = """ +Replace ENV vars in all xml manifest files + +Finds all XML files in the manifests and replaces environment +variables with values. +""" + path = ".repo/manifests/**/*.xml" + + def Execute(self, opt, args): + """Substitute all ${ENVVAR} references in manifest xml files. + + Args: + opt: The options. + args: Positional args (unused). + """ + print(f"Executing envsubst {opt}, {args}") + files = glob.glob(self.path, recursive=True) + + for file in files: + print(file) + if os.path.getsize(file) > 0: + self.EnvSubst(file) + + def EnvSubst(self, infile): + doc = minidom.parse(infile) + self.search_replace_placeholders(doc) + os.rename(infile, infile + ".bak") + self.save(infile, doc) + + def save(self, outfile, doc): + """Save the modified XML document with comments and the XML header.""" + + def pretty_print(data): + return "\n".join( + [ + line + for line in parseString(data) + .toprettyxml(indent=" " * 2) + .split("\n") + if line.strip() + ] + ) + + with open(outfile, "wb") as f: + f.write(str.encode(pretty_print(doc.toprettyxml(encoding="utf-8")))) + + def search_replace_placeholders(self, doc): + """Replace ${PLACEHOLDER} in texts and attributes with values.""" + for elem in doc.getElementsByTagName("*"): + for key, value in elem.attributes.items(): + # Check if the attribute value contains an environment variable + if self.is_placeholder_detected(value): + # Replace the environment variable with its value + elem.setAttribute(key, self.resolve_variable(value)) + if ( + elem.firstChild + and elem.firstChild.nodeType == elem.TEXT_NODE + and self.is_placeholder_detected(elem.firstChild.nodeValue) + ): + # Replace the environment variable with its value + elem.firstChild.nodeValue = self.resolve_variable( + elem.firstChild.nodeValue + ) + + def is_placeholder_detected(self, value): + return "$" in value + + def resolve_variable(self, var_name): + """Resolve variables from OS environment variables.""" + return os.path.expandvars(var_name) diff --git a/tests/test_git_trace2_event_log.py b/tests/test_git_trace2_event_log.py index d32148872..38a73614b 100644 --- a/tests/test_git_trace2_event_log.py +++ b/tests/test_git_trace2_event_log.py @@ -386,14 +386,17 @@ def test_write_socket(self): server_thread.start() with server_ready: - server_ready.wait(timeout=120) + server_ready.wait(timeout=5) self._event_log_module.StartEvent([]) path = self._event_log_module.Write( path=f"af_unix:{socket_path}" ) finally: - server_thread.join(timeout=5) + server_thread.join(timeout=2) + if server_thread.is_alive(): + # Force cleanup if thread is still hanging + pass self.assertEqual(path, f"af_unix:stream:{socket_path}") self.assertEqual(len(received_traces), 2) diff --git a/tests/test_subcmds.py b/tests/test_subcmds.py index 2d680fb78..2ae904721 100644 --- a/tests/test_subcmds.py +++ b/tests/test_subcmds.py @@ -28,7 +28,15 @@ def test_required_basic(self): # NB: We don't test all subcommands as we want to avoid "change # detection" tests, so we just look for the most common/important ones # here that are unlikely to ever change. - for cmd in {"cherry-pick", "help", "init", "start", "sync", "upload"}: + for cmd in { + "cherry-pick", + "help", + "init", + "start", + "sync", + "upload", + "envsubst", + }: self.assertIn(cmd, subcmds.all_commands) def test_naming(self): diff --git a/tests/test_subcmds_envsubst.py b/tests/test_subcmds_envsubst.py new file mode 100644 index 000000000..5887ef283 --- /dev/null +++ b/tests/test_subcmds_envsubst.py @@ -0,0 +1,237 @@ +# Copyright (C) 2020 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unittests for the subcmds/envsubst.py module.""" + +import os +import unittest +import unittest.mock +from unittest.mock import call +from unittest.mock import mock_open +from unittest.mock import patch + +from subcmds import envsubst + + +def _mock_os_env_var_resolve(var_name): + if var_name == "${GITBASE}": + return "fake_gitbase" + elif var_name == "${GITREV}": + return "fake_gitrev" + elif var_name == "${TEST}": + return "test" + else: + return os.path.expandvars(var_name) + + +class EnvsubstCommand(unittest.TestCase): + """Test envsubst subcommand""" + + mock_top_level_manifest_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + "\n" + ) + mock_expected_top_level_manifest_file_overwritten_content = ( + b'\n' + b"\n" + b' \n' + b' \n' + b"" + ) + + mock_top_level_manifest_no_local_override_supplied_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + "\n" + ) + expected_no_local_override_supplied = ( + b'\n' + b"\n" + b' \n' + b' \n' + b"" + ) + + mock_2nd_level_manifest_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + " \n' + " \n" + "\n" + ) + mock_expected_2nd_level_manifest_file_overwritten_content = ( + b'\n' + b"\n" + b' \n' + b' \n' + b" \n' + b" \n" + b"" + ) + + mock_2nd_level_manifest_negative_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + " \n' + " \n" + "\n" + ) + mock_expected_2nd_level_manifest_negative_file_overwritten_content = ( + b'\n' + b"\n" + b' \n' + b' \n' + b" \n' + b" \n" + b"" + ) + + mock_2nd_level_manifest_existing_attr_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + " \n' + " \n" + "\n" + ) + expected_2nd_level_existing_attr = ( + b'\n' + b"\n" + b' \n' + b' \n' + b" \n' + b" \n" + b"" + ) + + mock_2nd_level_manifest_multi_attrs_file_content = ( + '\n' + "\n" + ' \n' + ' \n' + " \n' + " \n" + "\n" + ) + expected_2nd_level_multi_attrs = ( + b'\n' + b"\n" + b' \n' + b' \n' + b" \n' + b" \n" + b"" + ) + + def setUp(self): + self.cmd = envsubst.Envsubst() + + def test_replacement_basic(self): + """Check baseline xml attr value string replacement""" + self.util_generic_test( + self.mock_top_level_manifest_file_content, + self.mock_expected_top_level_manifest_file_overwritten_content, + ) + + def test_replacement_when_no_local_overrides_requested(self): + """Check xml attr value replacement when no local OS subs.""" + content = ( + self.mock_top_level_manifest_no_local_override_supplied_file_content + ) + self.util_generic_test( + content, + self.expected_no_local_override_supplied, + ) + + def util_generic_test(self, input_file_content, expected_file_content): + """ + generic test fixture test for expected output vs actual + """ + with patch("os.rename") as rename: + with patch( + "builtins.open", new=mock_open(read_data=input_file_content) + ) as mocked_file: + self.cmd.resolve_variable = _mock_os_env_var_resolve + self.cmd.EnvSubst("mock-ignored.xml") + self.assertEqual( + rename.call_args_list, + [call("mock-ignored.xml", "mock-ignored.xml.bak")], + "test of Manifest backup before overwrite", + ) + mocked_file().write.assert_called_once_with( + expected_file_content + ) diff --git a/tests/test_update_manpages.py b/tests/test_update_manpages.py deleted file mode 100644 index 12b19ec48..000000000 --- a/tests/test_update_manpages.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2022 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Unittests for the update_manpages module.""" - -import unittest - -from release import update_manpages - - -class UpdateManpagesTest(unittest.TestCase): - """Tests the update-manpages code.""" - - def test_replace_regex(self): - """Check that replace_regex works.""" - data = "\n\033[1mSummary\033[m\n" - self.assertEqual(update_manpages.replace_regex(data), "\nSummary\n") diff --git a/tox.ini b/tox.ini index 2847f2ac3..7c41ee7ee 100644 --- a/tox.ini +++ b/tox.ini @@ -15,20 +15,15 @@ # https://tox.readthedocs.io/ [tox] -envlist = lint, py36, py37, py38, py39, py310, py311, py312 -requires = virtualenv<20.22.0 +envlist = lint, py312 [gh-actions] python = - 3.6: py36 - 3.7: py37 - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 3.12: py312 [testenv] +skip_install = true +usedevelop = false deps = -c constraints.txt black @@ -38,6 +33,7 @@ deps = pytest-timeout commands = {envpython} run_tests {posargs} setenv = + REPO_REV = stable GIT_AUTHOR_NAME = Repo test author GIT_COMMITTER_NAME = Repo test committer EMAIL = repo@gerrit.nodomain @@ -49,7 +45,7 @@ deps = black flake8 commands = - black --check {posargs:. repo run_tests release/update-hooks release/update-manpages} + black --check {posargs:. repo run_tests release/update-hooks} flake8 [testenv:format] @@ -59,5 +55,5 @@ deps = black flake8 commands = - black {posargs:. repo run_tests release/update-hooks release/update-manpages} + black {posargs:. repo run_tests release/update-hooks} flake8