diff --git a/nixpkgs_review/report.py b/nixpkgs_review/report.py index 12b7766..d29ddd0 100644 --- a/nixpkgs_review/report.py +++ b/nixpkgs_review/report.py @@ -3,6 +3,7 @@ import subprocess from collections.abc import Callable from pathlib import Path +from typing import Literal from .nix import Attr from .utils import info, link, warn @@ -90,10 +91,12 @@ def write_error_logs(attrs: list[Attr], directory: Path) -> None: class Report: def __init__( - self, system: str, attrs: list[Attr], extra_nixpkgs_config: str + self, system: str, attrs: list[Attr], extra_nixpkgs_config: str, *, + checkout: Literal["merge", "commit"] = "merge", ) -> None: self.system = system self.attrs = attrs + self.checkout = checkout self.broken: list[Attr] = [] self.failed: list[Attr] = [] self.non_existent: list[Attr] = [] @@ -144,6 +147,7 @@ def serialize_attrs(attrs: list[Attr]) -> list[str]: { "system": self.system, "pr": pr, + "checkout": self.checkout, "extra-nixpkgs-config": self.extra_nixpkgs_config, "broken": serialize_attrs(self.broken), "non-existent": serialize_attrs(self.non_existent), @@ -162,6 +166,8 @@ def markdown(self, pr: int | None) -> str: cmd += f" pr {pr}" if self.extra_nixpkgs_config: cmd += f" --extra-nixpkgs-config '{self.extra_nixpkgs_config}'" + if self.checkout != "merge": + cmd += f" --checkout {self.checkout}" msg = f"Result of `{cmd}` run on {self.system} [1](https://github.com/Mic92/nixpkgs-review)\n" diff --git a/nixpkgs_review/review.py b/nixpkgs_review/review.py index 84e72f2..a5754f4 100644 --- a/nixpkgs_review/review.py +++ b/nixpkgs_review/review.py @@ -272,7 +272,7 @@ def start_review( os.environ["NIXPKGS_REVIEW_ROOT"] = str(path) if pr: os.environ["PR"] = str(pr) - report = Report(self.system, attr, self.extra_nixpkgs_config) + report = Report(self.system, attr, self.extra_nixpkgs_config, checkout=self.checkout.name.lower()) report.print_console(pr) report.write(path, pr)