Refactor archive command's handling of repo and channel

dblsaiko
Mar 29, 2024, 9:18 PM
4PX6WLAFTZZY6O57NEAPWZG25NR2TZ4KESKPRMS3G3QVKL7L6LNQC

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] UDHP4ZVB Fixing SSH asynchronicity issues
  • [6] 3X5ZCEPZ Fixing a panic when `pijul archive` does not find the channel
  • [7] WW2EOFBB Umask in archives
  • [8] 5OGOE4VW Store the current channel in the pristine
  • [9] 76PCXGML Pushing to, and pulling from the local repository
  • [10] ZBNKSYA6 Fixing a bus error when starting a transaction on a full disk
  • [11] AEPEFS7O Write help for each argument
  • [12] Y2Y4OOIE Move `pijul::DEFAULT_CHANNEL` to `libpijul`
  • [13] 2RXOCWUW Making libpijul deterministic (and getting rid of `rand`)
  • [14] KWAMD2KR A few fixes in the documentation comments
  • [15] A3RM526Y Integrating identity malleability
  • [16] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [17] I52XSRUH Massive cleanup, and simplification
  • [18] C4MJ7D7Q Verbose printing of conflicts to stderr
  • [19] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [20] PIQCNEEB Upgrading to Clap 3.0.0-alpha.5
  • [21] YXAVFTPP Allowing vertex buffer to use references to the transaction, by changing `output::output` to take an ArcTxn<T> instead of a simple T
  • [22] MEK57BAD Optional user in ssh_remote, allows to fix the key proof in `pijul id ed`
  • [23] BY5FVZAV Add a prefix in `pijul archive` in all cases
  • [24] 2UTQVDLP Do not create an archive if the prefix is absolute
  • [25] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [26] 4H2XTVJ2 Fix some mistakes in the docs
  • [27] JL4WKA5P Implement the Sanakirja concurrency model in a cross-process way
  • [*] ABQDWHNG Migrate from `pijul::repository` to `pijul-repository`

Change contents

  • edit in pijul/src/commands/archive.rs at line 1
    [5.191222][5.191222:191246](),[5.191246][5.3152:3153]()
    use std::path::PathBuf;
  • replacement in pijul/src/commands/archive.rs at line 3
    [3.2746][5.1796:1832](),[5.1637][5.1796:1832]()
    use libpijul::{Hash, Merkle, TxnT};
    [3.2746]
    [5.3252]
    use libpijul::{Hash, Merkle};
  • edit in pijul/src/commands/archive.rs at line 6
    [5.191247]
    [29.2089]
    use crate::commands::common_opts::RepoAndChannel;
    use crate::commands::load_channel;
  • replacement in pijul/src/commands/archive.rs at line 12
    [5.191291][5.3705:3855](),[5.3855][3.2747:2813](),[3.2813][5.191324:191356](),[5.191324][5.191324:191356](),[5.191356][5.3700:3757](),[5.3757][5.191356:191415](),[5.5537][5.191356:191415](),[5.191356][5.191356:191415]()
    /// 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>,
    /// Use this channel, instead of the current channel
    #[clap(long = "channel")]
    channel: Option<String>,
    [5.191291]
    [5.3758]
    #[clap(flatten)]
    base: RepoAndChannel,
  • edit in pijul/src/commands/archive.rs at line 70
    [5.192144]
    [5.192144]
    let mut actual_repo = self.base.repo_path().map(|v| v.to_path_buf());
  • replacement in pijul/src/commands/archive.rs at line 79
    [5.192302][5.192302:192413](),[5.192413][5.1364:1410](),[5.1410][5.192456:192475](),[5.192456][5.192456:192475]()
    if let Some(ref channel) = self.channel {
    channel
    } else {
    libpijul::DEFAULT_CHANNEL
    },
    [5.192302]
    [5.192475]
    self.base.channel().unwrap_or(libpijul::DEFAULT_CHANNEL),
  • replacement in pijul/src/commands/archive.rs at line 85
    [2.854][5.8391:8522](),[5.8391][5.8391:8522]()
    if let Some(ref mut path) = self.repo_path {
    path.clear();
    path.push(rem);
    [2.854]
    [5.8522]
    if self.base.repo_path().is_some() {
    actual_repo = Some(rem.into());
  • replacement in pijul/src/commands/archive.rs at line 100
    [5.8987][4.3013:3090]()
    if let Ok(repo) = Repository::find_root(self.repo_path.as_deref()) {
    [5.8987]
    [5.193066]
    if let Ok(repo) = Repository::find_root(actual_repo.as_deref()) {
  • edit in pijul/src/commands/archive.rs at line 107
    [5.851]
    [5.193379]
    let txn = repo.pristine.arc_txn_begin()?;
    let (channel, _) = load_channel(self.base.channel(), &*txn.read())?;
  • edit in pijul/src/commands/archive.rs at line 113
    [5.193436][5.1833:2095](),[5.2095][5.1411:1494](),[5.1494][5.2175:2260](),[5.2175][5.2175:2260](),[5.2260][5.4586:4605](),[5.4586][5.4586:4605]()
    let txn = repo.pristine.arc_txn_begin()?;
    let channel = {
    let txn = txn.read();
    let channel_name = if let Some(ref c) = self.channel {
    c
    } else {
    txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)
    };
    txn.load_channel(&channel_name)?.unwrap()
    };
  • edit in pijul/src/commands/archive.rs at line 122
    [5.193815][5.2292:2554](),[5.2554][5.1495:1578](),[5.1578][5.2634:2888](),[5.2634][5.2634:2888](),[5.2888][5.4800:4819](),[5.4800][5.4800:4819]()
    let txn = repo.pristine.arc_txn_begin()?;
    let channel = {
    let txn = txn.read();
    let channel_name = if let Some(ref c) = self.channel {
    c
    } else {
    txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)
    };
    if let Some(channel) = txn.load_channel(&channel_name)? {
    channel
    } else {
    bail!("No such channel: {:?}", channel_name);
    }
    };
  • edit in pijul/src/commands/archive.rs at line 124
    [5.194024]
    [5.3077]