Refactor fork command's handling of repo and channel
Dependencies
- [2]
MYB5C3FPSolving conflicts - [3]
GKSVBEUWRefactor Repository constructors to take Option<&Path> instead of Option<PathBuf> - [4]
KWAMD2KRA few fixes in the documentation comments - [5]
QQS7LII4Add value hints to arguments - [6]
RUBBHYZ7Removing unnecessary async/await - [7]
I52XSRUHMassive cleanup, and simplification - [8]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [9]
PIQCNEEBUpgrading to Clap 3.0.0-alpha.5 - [10]
I7VL7VPZMinor cleanup - [11]
X243Z3Y5Recording only the required metadata (can even be changed later!) - [12]
YN63NUZOSanakirja 1.0 - [13]
EUZFFJSOUpdating Pijul with the latest changes in Libpijul - [14]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [15]
4H2XTVJ2Fix some mistakes in the docs - [16]
AEPEFS7OWrite help for each argument - [17]
Y6EVFMTADon't output files if they aren't in the current channel - [18]
5OGOE4VWStore the current channel in the pristine - [19]
A3RM526YIntegrating identity malleability - [20]
E3DD265TFork to a *state* - [*]
ABQDWHNGMigrate from `pijul::repository` to `pijul-repository`
Change contents
- replacement in pijul/src/commands/fork.rs at line 1
use clap::{Parser, ValueHint};use clap::Parser; - edit in pijul/src/commands/fork.rs at line 4
use std::path::PathBuf; - edit in pijul/src/commands/fork.rs at line 5[4.2368][22.1810]
use crate::commands::common_opts::RepoPath;use crate::commands::load_channel; - replacement in pijul/src/commands/fork.rs at line 11[4.168042]→[4.1960:2110](∅→∅),[4.2110]→[4.1715:1781](∅→∅),[4.1781]→[4.168075:168107](∅→∅),[4.168075]→[4.168075:168107](∅→∅)
/// 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/fork.rs at line 28
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/fork.rs at line 37[4.168764]→[4.429:745](∅→∅),[4.745]→[4.2825:2846](∅→∅),[4.2825]→[4.2825:2846](∅→∅),[4.2846]→[4.746:1132](∅→∅),[4.1132]→[4.15864:15879](∅→∅),[4.15864]→[4.15864:15879](∅→∅)
let mut fork = if let Some(ref channel_name) = self.channel {if let Some(channel) = txn.load_channel(channel_name)? {txn.fork(&channel, &self.to)?} else {anyhow::bail!("Channel not found: {:?}", channel_name);}} else {let cur = txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL).to_string();if let Some(channel) = txn.load_channel(&cur)? {txn.fork(&channel, &self.to)?} else {anyhow::bail!("Channel not found: {:?}", cur);}};let (channel, _) = load_channel(self.channel.as_deref(), &txn)?;let mut fork = txn.fork(&channel, &self.to)?;