Refactor diff command's handling of repo and channel

dblsaiko
Mar 29, 2024, 9:31 PM
S4ZDDHTLHU6XCUOCGWZ3TUZGSB7Q5PIECZ7JKEPZEW4VR2XQ4XXAC

Dependencies

  • [2] Y2Y4OOIE Move `pijul::DEFAULT_CHANNEL` to `libpijul`
  • [3] QQS7LII4 Add value hints to arguments
  • [4] GKSVBEUW Refactor Repository constructors to take Option<&Path> instead of Option<PathBuf>
  • [5] ZHABNS3S Canonicalize all paths
  • [6] I52XSRUH Massive cleanup, and simplification
  • [7] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [8] PIQCNEEB Upgrading to Clap 3.0.0-alpha.5
  • [9] A3RM526Y Integrating identity malleability
  • [10] 5OGOE4VW Store the current channel in the pristine
  • [11] KWAMD2KR A few fixes in the documentation comments
  • [12] I24UEJQL Various post-fire fixes
  • [13] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [14] ZBNKSYA6 Fixing a bus error when starting a transaction on a full disk
  • [15] J33DKFPM Do not traverse unindexed directories in `pijul diff -su`
  • [16] HSEYMLO2 Adding an untracked change iterator
  • [17] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [18] RUBBHYZ7 Removing unnecessary async/await
  • [19] V6J6DTJC Do not compute the entire diff if all we want is --json --untracked
  • [*] ABQDWHNG Migrate from `pijul::repository` to `pijul-repository`
  • [*] ZRUPLBBT Colours in diff and change: separating concerns and dependencies

Change contents

  • replacement in pijul/src/commands/diff.rs at line 6
    [5.1104][3.1860:1891]()
    use clap::{Parser, ValueHint};
    [5.1104]
    [5.2570]
    use clap::Parser;
  • replacement in pijul/src/commands/diff.rs at line 8
    [5.2595][5.68:108]()
    use libpijul::{MutTxnT, TxnT, TxnTExt};
    [5.2595]
    [5.2654]
    use libpijul::{MutTxnT, TxnTExt};
  • edit in pijul/src/commands/diff.rs at line 11
    [5.173739]
    [21.1880]
    use crate::commands::common_opts::RepoPath;
  • replacement in pijul/src/commands/diff.rs at line 17
    [5.173780][5.2715:2865](),[5.2865][3.1892:1958](),[3.1958][5.173813:173849](),[5.173813][5.173813:173849]()
    /// 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>,
    [5.173780]
    [5.2866]
    #[clap(flatten)]
    pub base: RepoPath,
  • replacement in pijul/src/commands/diff.rs at line 22
    [5.173896][5.2949:2984]()
    /// Compare with this channel.
    [5.173896]
    [5.173896]
    /// Compare with CHANNEL instead of the current channel
  • replacement in pijul/src/commands/diff.rs at line 43
    [5.2199][4.2254:2324]()
    let repo = Repository::find_root(self.repo_path.as_deref())?;
    [5.2199]
    [5.15999]
    let repo = Repository::find_root(self.base.repo_path())?;
  • replacement in pijul/src/commands/diff.rs at line 56
    [5.306][5.16050:16123](),[5.174275][5.16050:16123](),[5.16123][2.915:965]()
    let cur = txn
    .read()
    .current_channel()
    .unwrap_or(libpijul::DEFAULT_CHANNEL)
    [5.306]
    [5.16170]
    let channel = get_channel(self.channel.as_deref(), &*txn.read())
    .0
  • edit in pijul/src/commands/diff.rs at line 59
    [5.16196][5.3061:3150](),[5.174275][5.3061:3150](),[5.3150][5.16197:16233]()
    let channel = if let Some(ref c) = self.channel {
    c
    } else {
    cur.as_str()
    };
  • edit in pijul/src/commands/diff.rs at line 302
    [22.776]
    [22.776]
    use crate::commands::get_channel;