Refactor credit command's handling of repo and channel

dblsaiko
Mar 29, 2024, 9:20 PM
6YOM7WMHRWVWXNWDT6A3CCQR2VVRR6TAPTM7L4WX5HD2546TPJKQC

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] RUBBHYZ7 Removing unnecessary async/await
  • [6] YXAVFTPP Allowing vertex buffer to use references to the transaction, by changing `output::output` to take an ArcTxn<T> instead of a simple T
  • [7] AEPEFS7O Write help for each argument
  • [8] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [9] Y6EVFMTA Don't output files if they aren't in the current channel
  • [10] PIQCNEEB Upgrading to Clap 3.0.0-alpha.5
  • [11] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [12] YN63NUZO Sanakirja 1.0
  • [13] A3RM526Y Integrating identity malleability
  • [14] 4H2XTVJ2 Fix some mistakes in the docs
  • [15] I7VL7VPZ Minor cleanup
  • [16] 5OGOE4VW Store the current channel in the pristine
  • [17] Y7YAFMFF Fix path prefix striping on Windows.
  • [18] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [19] KWAMD2KR A few fixes in the documentation comments
  • [20] 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/credit.rs at line 4
    [5.2811][5.18084:18102]()
    use anyhow::bail;
  • edit in pijul/src/commands/credit.rs at line 11
    [5.178930]
    [22.1967]
    use crate::commands::common_opts::RepoAndChannel;
    use crate::commands::load_channel;
  • replacement in pijul/src/commands/credit.rs at line 17
    [5.178973][5.3260:3410](),[5.3410][3.2210:2276](),[3.2276][5.179006:179038](),[5.179006][5.179006:179038](),[5.179038][5.4453:4509](),[5.4509][5.179038:179097](),[5.179038][5.179038:179097]()
    /// 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.178973]
    [5.3182]
    #[clap(flatten)]
    base: RepoAndChannel,
  • replacement in pijul/src/commands/credit.rs at line 26
    [5.2305][5.179185:179239](),[5.15721][5.179185:179239](),[5.179185][5.179185:179239](),[5.179239][4.2467:2537]()
    let has_repo_path = self.repo_path.is_some();
    let repo = Repository::find_root(self.repo_path.as_deref())?;
    [5.2305]
    [5.999]
    let has_repo_path = self.base.repo_path().is_some();
    let repo = Repository::find_root(self.base.repo_path())?;
  • replacement in pijul/src/commands/credit.rs at line 30
    [5.1081][5.3573:3667](),[5.179348][5.3573:3667](),[5.3667][2.1126:1197](),[2.1197][5.3735:3746](),[5.3735][5.3735:3746](),[5.1063][5.18121:18201](),[5.2631][5.18121:18201](),[5.3746][5.18121:18201](),[5.179431][5.18121:18201](),[5.18201][5.179510:179547](),[5.179510][5.179510:179547](),[5.179547][5.18202:18259](),[5.18259][5.179682:179693](),[5.179682][5.179682:179693]()
    let channel_name = if let Some(ref c) = self.channel {
    c
    } else {
    txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)
    };
    let channel = if let Some(channel) = txn.load_channel(&channel_name)? {
    channel
    } else {
    bail!("No such channel: {:?}", channel_name)
    };
    [5.1081]
    [5.729]
    let (channel, _) = load_channel(self.base.channel(), &*txn)?;