✨ Add `pijul status` subcommand

berkus
Jun 22, 2025, 4:14 PM
IBLJI7IAS7KNEHONURYUFRAINAMUC65HODM4G7XCRSGVIWJ7O5OQC

Dependencies

  • [2] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [3] 62XVBWPY remove redundant Clap attributes
  • [4] LJFJEX43 Fixing newline issues in the protocol over OpenSSH
  • [5] VWJ2JL63 Adding a `pijul dependents` command to list the transitive closure of the reverse dependency relation

Change contents

  • edit in pijul/src/commands/mod.rs at line 24
    [2.133860]
    [5.155]
    mod status;
    pub use status::Status;
  • edit in pijul/src/main.rs at line 34
    [2.84782]
    [3.34]
    /// Shows a brief overview of changes
    Status(Status),
  • edit in pijul/src/main.rs at line 223
    [4.277]
    [2.88682]
    SubCommand::Status(status) => status.run(),
  • file addition: status.rs (----------)
    [2.93386]
    use clap::{Parser, ValueHint};
    use std::path::PathBuf;
    #[derive(Parser, Debug)]
    pub struct Status {
    /// Set the repository where this command should run. Defaults to the first ancestor of the current directory that contains a `.pijul` directory.
    #[clap(long = "repository", value_hint = ValueHint::DirPath)]
    pub repo_path: Option<PathBuf>,
    /// Compare with this channel.
    #[clap(long = "channel")]
    pub channel: Option<String>,
    /// Add all the changes of this channel as dependencies (except changes implied transitively), instead of the minimal dependencies.
    #[clap(long = "tag")]
    pub tag: bool,
    /// Include the untracked files
    #[clap(short = 'u', long = "untracked")]
    pub untracked: bool,
    /// Only diff those paths (files or directories). If missing, diff the entire repository.
    pub prefixes: Vec<PathBuf>,
    /// Use Patience diff instead of the default Myers diff
    #[clap(long = "patience")]
    pub patience: bool,
    }
    impl Status {
    pub fn run(self) -> Result<(), anyhow::Error> {
    // Status is just diff with benefits.
    let diff = super::Diff {
    repo_path: self.repo_path,
    json: false,
    channel: self.channel,
    tag: self.tag,
    short: true,
    untracked: self.untracked,
    prefixes: self.prefixes,
    patience: false,
    };
    diff.run()
    }
    }