Refactor unrecord command's handling of repo and channel

dblsaiko
Mar 29, 2024, 9:44 PM
ORZKNFDB7JJGZNMJQ5W4SIYNU3JOGNY7R3B5G53IC72CSLMHKVBQC

Dependencies

  • [2] 3OPNBBAU Migrate from `pijul::remote` to `pijul_remote`
  • [3] QQS7LII4 Add value hints to arguments
  • [4] GKSVBEUW Refactor Repository constructors to take Option<&Path> instead of Option<PathBuf>
  • [5] LGEJSLTY Fixing output (including its uses in reset and pull)
  • [6] 4H2XTVJ2 Fix some mistakes in the docs
  • [7] YAJAXIV5 Unrecording changes atomically
  • [8] 5OGOE4VW Store the current channel in the pristine
  • [9] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [10] SLJ3OHD4 unrecord: show list of changes if none were given as arguments
  • [11] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [12] PIQCNEEB Upgrading to Clap 3.0.0-alpha.5
  • [13] 3KRGVQFU Do not update the mtime of unmodified files
  • [14] 5DVRL6MF Hard-unrecord
  • [15] DO2Y5TY5 Tag synchronisation
  • [16] O2U2JAFV Solve ordering conflicts
  • [17] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [18] I24UEJQL Various post-fire fixes
  • [19] RUBBHYZ7 Removing unnecessary async/await
  • [20] Y2Y4OOIE Move `pijul::DEFAULT_CHANNEL` to `libpijul`
  • [21] KWAMD2KR A few fixes in the documentation comments
  • [22] AEPEFS7O Write help for each argument
  • [23] A3RM526Y Integrating identity malleability

Change contents

  • replacement in pijul/src/commands/unrecord.rs at line 1
    [5.514][5.95761:95785](),[5.95761][5.95761:95785](),[5.1959][5.1143:1144](),[5.95785][5.1143:1144](),[5.1144][5.823:871]()
    use std::path::PathBuf;
    use super::{make_changelist, parse_changelist};
    [5.95630]
    [2.0]
    use super::{load_channel, make_changelist, parse_changelist};
  • edit in pijul/src/commands/unrecord.rs at line 4
    [5.86]
    [5.871]
    use crate::commands::common_opts::RepoPath;
  • replacement in pijul/src/commands/unrecord.rs at line 6
    [5.899][3.0:31]()
    use clap::{Parser, ValueHint};
    [5.899]
    [5.19]
    use clap::Parser;
  • replacement in pijul/src/commands/unrecord.rs at line 14
    [5.95831][5.151:301](),[5.301][3.32:98](),[3.98][5.95864:95896](),[5.95864][5.95864:95896]()
    /// 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)]
    repo_path: Option<PathBuf>,
    [5.95831]
    [5.300]
    #[clap(flatten)]
    base: RepoPath,
  • replacement in pijul/src/commands/unrecord.rs at line 33
    [5.1080][4.1044:1118]()
    let mut repo = Repository::find_root(self.repo_path.as_deref())?;
    [5.1080]
    [5.96236]
    let mut repo = Repository::find_root(self.base.repo_path())?;
  • replacement in pijul/src/commands/unrecord.rs at line 36
    [5.1576][5.1576:1649](),[5.1649][5.88:138](),[5.138][5.1696:1722](),[5.1696][5.1696:1722](),[5.1722][5.75:169](),[5.75][5.75:169](),[5.169][5.1723:1748](),[5.1748][5.185:250](),[5.185][5.185:250](),[5.250][5.1749:1836](),[5.330][5.2089:2195](),[5.1836][5.2089:2195](),[5.2089][5.2089:2195]()
    let cur = txn
    .read()
    .current_channel()
    .unwrap_or(libpijul::DEFAULT_CHANNEL)
    .to_string();
    let channel_name = if let Some(ref c) = self.channel {
    c
    } else {
    cur.as_str()
    };
    let is_current_channel = cur == channel_name;
    let channel = if let Some(channel) = txn.read().load_channel(&channel_name)? {
    channel
    } else {
    bail!("No such channel: {:?}", channel_name);
    };
    [5.1576]
    [5.2547]
    let (channel, is_current_channel) = load_channel(self.channel.as_deref(), &*txn.read())?;