Refactor channel command's handling of repo and channel
Dependencies
- [2]
QQS7LII4Add value hints to arguments - [3]
GKSVBEUWRefactor Repository constructors to take Option<&Path> instead of Option<PathBuf> - [4]
5OGOE4VWStore the current channel in the pristine - [5]
GHO6DWPIRefactoring iterators - [6]
YN63NUZOSanakirja 1.0 - [7]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [8]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [9]
A7NTQINQpijul channel delete: error if channel doesn't exist - [10]
I52XSRUHMassive cleanup, and simplification - [11]
AEPEFS7OWrite help for each argument - [12]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [13]
FMKKWCFVBetter clap attributes - [14]
ABQDWHNGMigrate from `pijul::repository` to `pijul-repository` - [15]
4H2XTVJ2Fix some mistakes in the docs - [16]
3AMEP2Y5More convenient interface for channels - [17]
PGERZ3KJChannel renaming (also do not create a new channel when recording on a channel that doesn't exist) - [18]
KWAMD2KRA few fixes in the documentation comments - [19]
53SC53QWAdding --force to reset/switch, to ignore name conflicts - [20]
VQPAUKBQchannel switch as an alias to reset - [21]
I24UEJQLVarious post-fire fixes - [22]
A3RM526YIntegrating identity malleability - [23]
Q4SVMHAERemoving --channel from the changes command - [24]
PIQCNEEBUpgrading to Clap 3.0.0-alpha.5 - [25]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [26]
TFK7CYFQ`pijul channel new` to create new, empty channels - [27]
ZBNKSYA6Fixing a bus error when starting a transaction on a full disk - [28]
YK7EBTF6Safeguarding `pijul channel new`: it was too easy to create a new, independent root
Change contents
- edit in pijul/src/commands/channel.rs at line 2
use std::path::PathBuf; - edit in pijul/src/commands/channel.rs at line 3
use crate::commands::common_opts::RepoPath;use crate::commands::{load_channel, load_channel_exact}; - replacement in pijul/src/commands/channel.rs at line 7
use clap::{Parser, ValueHint};use clap::Parser; - replacement in pijul/src/commands/channel.rs at line 14[4.187058]→[4.3554:3704](∅→∅),[4.3704]→[2.2528:2594](∅→∅),[2.2594]→[4.187091:187123](∅→∅),[4.187091]→[4.187091:187123](∅→∅)
/// 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>,#[clap(flatten)]base: RepoPath, - replacement in pijul/src/commands/channel.rs at line 53
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/channel.rs at line 67
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/channel.rs at line 74
return Err(anyhow!("Channel {} not found", delete));return Err(anyhow!("No such channel: {}", delete)); - replacement in pijul/src/commands/channel.rs at line 80
repo_path: self.repo_path,base: self.base, - replacement in pijul/src/commands/channel.rs at line 89
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/channel.rs at line 99[4.188838]→[4.18898:18981](∅→∅),[4.18981]→[4.188920:188973](∅→∅),[4.188920]→[4.188920:188973](∅→∅),[4.188973]→[4.18982:19039](∅→∅),[4.19039]→[4.189141:189160](∅→∅),[4.189141]→[4.189141:189160](∅→∅)
let mut channel = if let Some(channel) = txn.load_channel(from)? {channel} else {bail!("No such channel: {:?}", from)};let mut channel = load_channel_exact(from, &txn)?; - replacement in pijul/src/commands/channel.rs at line 110
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/channel.rs at line 118
let current = txn.current_channel()?;let channel = if let Some(channel) = txn.load_channel(current)? {channel} else {bail!("No such channel: {:?}", current)};let (channel, _) = load_channel(None, &txn)?;