Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions crates/mergify-cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//! `mergify` binary entry point.
//!
//! Dispatch logic: every invocation is speculatively parsed with
//! clap, which knows about the native commands
//! ([`ConfigSubcommand::Validate`], [`ConfigSubcommand::Simulate`]).
//! If clap succeeds with a known native variant the binary runs
//! that code path natively. Any parse failure — including
//! subcommands clap doesn't know about (``stack push``, ``ci
//! junit-process``, …) — falls through to [`mergify_py_shim::run`],
//! which hands the original argv to ``python3 -m mergify_cli``.
//! clap, which knows about the natively-ported commands listed in
//! [`NATIVE_COMMANDS`]. If clap succeeds with a known native
//! variant the binary runs that code path natively. Any parse
//! failure — including subcommands clap doesn't know about
//! (``stack push``, ``ci junit-process``, …) — falls through to
//! [`mergify_py_shim::run`], which hands the original argv to
//! ``python3 -m mergify_cli``.
//!
//! As each command ports (Phase 1.4+), new variants land on the
//! clap enum and the shim fallback shrinks. Phase 6 deletes the
//! shim entirely.
//! As each Python command is ported to Rust, a new entry lands in
//! [`NATIVE_COMMANDS`] and a matching clap variant; the shim
//! fallback shrinks accordingly until it can be removed entirely.

use std::env;
use std::path::PathBuf;
Expand Down
4 changes: 2 additions & 2 deletions crates/mergify-config/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Native Rust implementation of the `mergify config` subcommands.
//!
//! Phase 1.3 ports `config validate`. Phase 1.3b adds `config
//! simulate`. Both share the config-file resolver in [`paths`].
//! Hosts `config validate` and `config simulate`; both share the
//! config-file resolver in [`paths`].

pub mod paths;
pub mod simulate;
Expand Down
7 changes: 3 additions & 4 deletions crates/mergify-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
//! the appropriate `ExitCode` and writes a human-readable message
//! to stderr before exiting.
//!
//! This enum grows as new error sources are added. Today it covers
//! the categories needed to port the `config` pilot (Phase 1.3);
//! subsequent sub-phases add variants for HTTP failures, git
//! subprocess failures, and so on.
//! This enum grows as new error sources are added — add a variant
//! per error category, never a generic `String` catch-all for new
//! kinds of failure that have their own exit code.

use std::io;

Expand Down
6 changes: 3 additions & 3 deletions crates/mergify-core/src/exit_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//!
//! Mirrors `mergify_cli.exit_codes.ExitCode` in the Python
//! implementation. The contract — which (command, failure mode)
//! maps to which exit code — is locked by Phase 0.1 and enforced by
//! the compat-test harness. Changing a variant's numeric value is a
//! breaking change for downstream scripts.
//! maps to which exit code — is enforced by the compat-test
//! harness. Changing a variant's numeric value is a breaking change
//! for downstream scripts.

use std::process::ExitCode as ProcessExitCode;

Expand Down
10 changes: 5 additions & 5 deletions crates/mergify-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Shared foundations for the mergify CLI Rust port.
//!
//! Phase 1.2 populates this crate with:
//!
//! - [`exit_code::ExitCode`] — typed exit codes mirroring the
//! Python `exit_codes.py` contract.
//! - [`error::CliError`] — top-level error enum with deterministic
Expand All @@ -11,9 +9,11 @@
//! in.
//! - [`http::Client`] — wraps `reqwest` with bearer auth, retry,
//! and typed error mapping for the Mergify and GitHub APIs.
//!
//! Git operations, interactive prompts, and config loading arrive
//! in subsequent sub-phases.
//! - [`auth`] — resolve `--repository` / `--token` / `--api-url`
//! from the same flag → env → fallback chain the Python CLI uses.
//! - [`command_context::CommandContext`] — bundle the resolved
//! trio + a pre-configured Mergify HTTP client for the
//! queue/freeze command preludes.

pub mod auth;
pub mod command_context;
Expand Down
2 changes: 1 addition & 1 deletion crates/mergify-core/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! directly. This keeps the JSON and human rendering paths
//! symmetric, lets commands stay test-friendly, and gives a single
//! place to enforce the "stdout must be a single JSON document
//! under `--json`" invariant (Phase 0.3).
//! under `--json`" invariant.
//!
//! The trait is deliberately small. Commands emit one "result"
//! value that knows how to render itself both as JSON (via
Expand Down
12 changes: 4 additions & 8 deletions crates/mergify-freeze/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,12 @@ fn write_row(
spaces = " ".repeat(pad),
)?;
} else if HEADERS[i] == "Status" {
// `Theme::fg` already collapses to `Style::new()` when
// colors are disabled — no need for an extra branch.
let style = if cell == "active" {
if theme.enabled {
theme.fg(AnsiColor::Green)
} else {
anstyle::Style::new()
}
} else if theme.enabled {
theme.fg(AnsiColor::Yellow)
theme.fg(AnsiColor::Green)
} else {
anstyle::Style::new()
theme.fg(AnsiColor::Yellow)
};
write!(
w,
Expand Down
3 changes: 2 additions & 1 deletion crates/mergify-py-shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
//! native impl first and only falls back to [`run`] for un-ported
//! commands. The plan is for each port PR to delete its Python
//! implementation in the same change, so the shim's reach shrinks
//! one command at a time. Phase 6 deletes this crate entirely.
//! one command at a time; this crate is deleted entirely once
//! everything is ported.

use std::env;
use std::io;
Expand Down
11 changes: 3 additions & 8 deletions crates/mergify-queue/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
//! Native Rust implementation of the `mergify queue` subcommands.
//!
//! Phase 1.5 ported `pause` and `unpause` — two idempotent API
//! calls that rest on the HTTP client added in 1.2b and the
//! `put`/`delete_if_exists` methods added alongside this crate.
//! Phase 1.7 ports `status`, the read-only command that fetches
//! the merge-queue snapshot and renders it either as a JSON
//! passthrough or as the human-friendly batch tree + waiting list.
//! `queue show` stays shimmed until its conditions/checks tree
//! ports next.
//! Hosts `pause` / `unpause` (idempotent API mutations), `status`
//! (read-only batch tree + waiting list, with JSON passthrough),
//! and `show` (per-PR detail with checks + conditions tree).

pub mod pause;
pub mod show;
Expand Down
Loading