Refactor reset command's handling of repo and channel
Dependencies
- [2]
Y2Y4OOIEMove `pijul::DEFAULT_CHANNEL` to `libpijul` - [3]
G7HJHNFDMigrate from `pijul_interaction::progress` to `pijul_interaction` - [4]
QQS7LII4Add value hints to arguments - [5]
GKSVBEUWRefactor Repository constructors to take Option<&Path> instead of Option<PathBuf> - [6]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [7]
Y7YAFMFFFix path prefix striping on Windows. - [8]
I7VL7VPZMinor cleanup - [9]
KWAMD2KRA few fixes in the documentation comments - [10]
M3VTIZCPValidate change before reset - [11]
I24UEJQLVarious post-fire fixes - [12]
5OGOE4VWStore the current channel in the pristine - [13]
PIQCNEEBUpgrading to Clap 3.0.0-alpha.5 - [14]
AEPEFS7OWrite help for each argument - [15]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [16]
VQPAUKBQchannel switch as an alias to reset - [17]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [18]
Y6EVFMTADon't output files if they aren't in the current channel - [19]
EUZFFJSOUpdating Pijul with the latest changes in Libpijul - [20]
UAXGGNAZImprove command feedback - [21]
4H2XTVJ2Fix some mistakes in the docs - [22]
A3RM526YIntegrating identity malleability - [23]
RUBBHYZ7Removing unnecessary async/await - [*]
L4JXJHWXpijul/*: reorganize imports and remove extern crate
Change contents
- edit in pijul/src/commands/reset.rs at line 11[25.1348][3.402]
use crate::commands::common_opts::RepoPath;use crate::commands::load_channel; - replacement in pijul/src/commands/reset.rs at line 18[6.97841]→[6.302:452](∅→∅),[6.452]→[4.514:580](∅→∅),[4.580]→[6.290:326](∅→∅),[6.97874]→[6.290:326](∅→∅)
/// 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>,#[clap(flatten)]pub base: RepoPath, - replacement in pijul/src/commands/reset.rs at line 56[6.236]→[6.98164:98218](∅→∅),[6.642]→[6.98164:98218](∅→∅),[6.1369]→[6.98164:98218](∅→∅),[6.6093]→[6.98164:98218](∅→∅),[6.98164]→[6.98164:98218](∅→∅),[6.98218]→[5.1498:1568](∅→∅)
let has_repo_path = self.repo_path.is_some();let repo = Repository::find_root(self.repo_path.as_deref())?;let has_repo_path = self.base.repo_path().is_some();let repo = Repository::find_root(self.base.repo_path())?; - edit in pijul/src/commands/reset.rs at line 60[6.6482]→[6.3389:3462](∅→∅),[6.3462]→[2.328:378](∅→∅),[2.378]→[6.3509:3535](∅→∅),[6.3509]→[6.3509:3535](∅→∅),[6.3535]→[6.770:864](∅→∅),[6.6482]→[6.770:864](∅→∅),[6.864]→[6.3536:3561](∅→∅),[6.3561]→[6.932:943](∅→∅),[6.932]→[6.932:943](∅→∅)
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()}; - replacement in pijul/src/commands/reset.rs at line 61[6.108]→[6.3562:3649](∅→∅),[6.3649]→[6.98538:98558](∅→∅),[6.6732]→[6.98538:98558](∅→∅),[6.12223]→[6.98538:98558](∅→∅),[6.98538]→[6.98538:98558](∅→∅),[6.98655]→[6.98655:98672](∅→∅),[6.98672]→[6.12224:12281](∅→∅),[6.12281]→[6.98807:98818](∅→∅),[6.98807]→[6.98807:98818](∅→∅)
let channel = if let Some(channel) = txn.read().load_channel(&channel_name)? {channel} else {bail!("No such channel: {:?}", channel_name)};let (channel, _) = load_channel(self.channel.as_deref(), &*txn.read())?;