Refactor dependents command's handling of repo and channel

dblsaiko
Mar 29, 2024, 9:25 PM
KSHG4L44N3RSAEY7UTKMGIWDDR2L5GZDH7MVHM7SUD6DC2BBGYUQC

Dependencies

  • [2] MYB5C3FP Solving conflicts
  • [3] GKSVBEUW Refactor Repository constructors to take Option<&Path> instead of Option<PathBuf>
  • [4] Y2Y4OOIE Move `pijul::DEFAULT_CHANNEL` to `libpijul`
  • [5] ABQDWHNG Migrate from `pijul::repository` to `pijul-repository`
  • [6] QQS7LII4 Add value hints to arguments
  • [7] STOFOQI4 Fixing a bug in `pijul dependents` where non-dependents could be listed (and making the command deterministic)
  • [8] QWIYNMI5 Formatting + big-endian Sanakirja
  • [9] VWJ2JL63 Adding a `pijul dependents` command to list the transitive closure of the reverse dependency relation
  • [10] Y6TBQN7M Automatically format `pijul` crate

Change contents

  • replacement in pijul/src/commands/dependents.rs at line 1
    [4.288][4.1959:1990]()
    use clap::{Parser, ValueHint};
    [4.243]
    [4.306]
    use clap::Parser;
  • edit in pijul/src/commands/dependents.rs at line 4
    [4.1705][4.1705:1729]()
    use std::path::PathBuf;
  • edit in pijul/src/commands/dependents.rs at line 5
    [4.324]
    [4.1906]
    use crate::commands::common_opts::RepoPath;
    use crate::commands::get_channel;
  • replacement in pijul/src/commands/dependents.rs at line 11
    [4.400][4.400:468](),[4.468][4.1991:2078](),[4.2078][4.522:554](),[4.522][4.522:554]()
    /// Use the repository at PATH instead of the current directory
    #[clap(long = "repository", value_name = "PATH", value_hint = ValueHint::DirPath)]
    repo_path: Option<PathBuf>,
    [4.400]
    [4.554]
    #[clap(flatten)]
    base: RepoPath,
  • replacement in pijul/src/commands/dependents.rs at line 20
    [4.759][3.2325:2395]()
    let repo = Repository::find_root(self.repo_path.as_deref())?;
    [4.759]
    [4.826]
    let repo = Repository::find_root(self.base.repo_path())?;
  • replacement in pijul/src/commands/dependents.rs at line 22
    [4.872][4.966:1053](),[4.1053][4.101:218](),[4.101][4.101:218]()
    let channel_name = txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL);
    let channel = if let Some(channel) = txn.load_channel(&channel_name)? {
    channel
    } else {
    [4.872]
    [4.218]
    let (channel_name, _) = get_channel(None, &txn);
    let Some(channel) = txn.load_channel(&channel_name)? else {
  • edit in pijul/src/commands/dependents.rs at line 27
    [4.256]
    [4.256]