Refactor log command's handling of repo and channel
Dependencies
- [2]
Y2Y4OOIEMove `pijul::DEFAULT_CHANNEL` to `libpijul` - [3]
QQS7LII4Add value hints to arguments - [4]
GKSVBEUWRefactor Repository constructors to take Option<&Path> instead of Option<PathBuf> - [5]
AEPEFS7OWrite help for each argument - [6]
U6TQX5Z2pager function respects cli option and user config files, PAGER env var - [7]
4H2XTVJ2Fix some mistakes in the docs - [8]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [9]
ATUZBEPEAdd hunk paths to log ouput - [10]
2K7JLB4ZNo pager on Windows - [11]
I52XSRUHMassive cleanup, and simplification - [12]
GURIBVW6Fixing the pager - [13]
OU6JOR3CAdd path filtering for log, add json output for log - [14]
PIQCNEEBUpgrading to Clap 3.0.0-alpha.5 - [15]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [16]
KWAMD2KRA few fixes in the documentation comments - [17]
ZDK3GNDBTag transactions (including a massive refactoring of errors) - [18]
NAUECZW3Fixing the map between keys and identities - [19]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [20]
6F6AAHK4Simplifying pijul::commands::log, and fixing Broken Pipe errors
Change contents
- edit in pijul/src/commands/log.rs at line 7
use crate::commands::common_opts::RepoAndChannel;use crate::commands::load_channel; - replacement in pijul/src/commands/log.rs at line 10
use clap::{Parser, ValueHint};use clap::Parser; - replacement in pijul/src/commands/log.rs at line 15[5.93]→[5.3357:3396](∅→∅),[5.224]→[5.3357:3396](∅→∅),[5.7127]→[5.3357:3396](∅→∅),[5.134460]→[5.3357:3396](∅→∅)
use libpijul::{Base32, TxnT, TxnTExt};use libpijul::{Base32, TxnTExt}; - replacement in pijul/src/commands/log.rs at line 25[5.134600]→[5.1268:1418](∅→∅),[5.1418]→[3.1114:1180](∅→∅),[3.1180]→[5.134633:134665](∅→∅),[5.134633]→[5.134633:134665](∅→∅),[5.134665]→[5.2884:2950](∅→∅),[5.2950]→[5.134665:134724](∅→∅),[5.134665]→[5.134665:134724](∅→∅)
/// 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>,/// Show logs for this channel instead of the current channel#[clap(long = "channel")]channel: Option<String>,#[clap(flatten)]base: RepoAndChannel, - replacement in pijul/src/commands/log.rs at line 58
let repo = Repository::find_root(cmd.repo_path.as_deref())?;let repo = Repository::find_root(cmd.base.repo_path())?; - replacement in pijul/src/commands/log.rs at line 60
let channel_name = if let Some(ref c) = cmd.channel {c} else {txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)};let (channel_ref, is_current_channel) = load_channel(cmd.base.channel(), &txn)?; - replacement in pijul/src/commands/log.rs at line 65
if !cmd.filters.is_empty()&& !(channel_name == txn.current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)){if !cmd.filters.is_empty() && !is_current_channel { - replacement in pijul/src/commands/log.rs at line 69
let channel_ref = if let Some(channel) = txn.load_channel(channel_name)? {channel} else {bail!("No such channel: {:?}", channel_name)};let limit = cmd.limit.unwrap_or(std::usize::MAX);let limit = cmd.limit.unwrap_or(usize::MAX);