Refactor push/pull commands' 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]
AEPEFS7OWrite help for each argument - [7]
MU5GSJAWPartial push and pull (WARNING: breaks the existing protocol) - [8]
KWAMD2KRA few fixes in the documentation comments - [9]
367UBQ6KForwarding SSH stderr, and progress bar for push - [10]
5OGOE4VWStore the current channel in the pristine - [11]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [12]
3KRGVQFUDo not update the mtime of unmodified files - [13]
IVLLXQ5ZImproved push/pull reporting - [14]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [15]
I24UEJQLVarious post-fire fixes - [16]
PIQCNEEBUpgrading to Clap 3.0.0-alpha.5 - [17]
A3RM526YIntegrating identity malleability - [18]
RUBBHYZ7Removing unnecessary async/await - [19]
5HF7C67Mpush/pull: fixed "changes" arguments - [20]
HQ2C4VT5Pull: confusion between from and to channels - [21]
VMPAOJS2Don't output after pushing to a local channel - [22]
ABQDWHNGMigrate from `pijul::repository` to `pijul-repository` - [23]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [24]
YN63NUZOSanakirja 1.0 - [25]
ZBNKSYA6Fixing a bus error when starting a transaction on a full disk - [26]
SLJ3OHD4unrecord: show list of changes if none were given as arguments - [27]
EUZFFJSOUpdating Pijul with the latest changes in Libpijul - [28]
6ZPDI7QGpull uses None as the base case path when outputing repo - [29]
LGEJSLTYFixing output (including its uses in reset and pull) - [30]
QWD7UE76push/pull: rename `channel` option - [31]
4H2XTVJ2Fix some mistakes in the docs
Change contents
- edit in pijul/src/commands/pushpull.rs at line 3
use std::path::PathBuf; - replacement in pijul/src/commands/pushpull.rs at line 4
use super::{make_changelist, parse_changelist};use super::{get_channel, make_changelist, parse_changelist}; - edit in pijul/src/commands/pushpull.rs at line 14
use crate::commands::common_opts::RepoPath; - edit in pijul/src/commands/pushpull.rs at line 21
#[clap(flatten)]base: RepoPath, - edit in pijul/src/commands/pushpull.rs at line 25[6.111977]→[6.815:965](∅→∅),[6.965]→[4.759:825](∅→∅),[4.825]→[6.112010:112042](∅→∅),[6.112010]→[6.112010:112042](∅→∅)
/// 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>, - replacement in pijul/src/commands/pushpull.rs at line 39
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/pushpull.rs at line 76[6.113077]→[6.1106:1193](∅→∅),[6.1193]→[4.826:892](∅→∅),[4.892]→[6.113110:113142](∅→∅),[6.113110]→[6.113110:113142](∅→∅)
/// Path to the repository. Uses the current repository if the argument is omitted#[clap(long = "repository", value_hint = ValueHint::DirPath)]repo_path: Option<PathBuf>,#[clap(flatten)]base: RepoPath, - replacement in pijul/src/commands/pushpull.rs at line 106[6.113567]→[6.966:1116](∅→∅),[6.1116]→[4.954:1020](∅→∅),[4.1020]→[6.113600:113632](∅→∅),[6.113600]→[6.113600:113632](∅→∅)
/// 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/pushpull.rs at line 179
let repo = Repository::find_root(self.repo_path.as_deref())?;let repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/pushpull.rs at line 182
let cur = txn.read().current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL)let channel_name = get_channel(self.from_channel.as_deref(), &*txn.read()).0 - edit in pijul/src/commands/pushpull.rs at line 185
let channel_name = if let Some(ref c) = self.from_channel {c} else {cur.as_str()}; - replacement in pijul/src/commands/pushpull.rs at line 192[6.114936]→[6.114936:115226](∅→∅),[6.115226]→[6.6865:6894](∅→∅),[6.2010]→[6.115255:115325](∅→∅),[6.6894]→[6.115255:115325](∅→∅),[6.115255]→[6.115255:115325](∅→∅),[6.115325]→[6.6895:6920](∅→∅),[6.2045]→[6.115350:115361](∅→∅),[6.6920]→[6.115350:115361](∅→∅),[6.115350]→[6.115350:115361](∅→∅)
let mut push_channel = None;let remote_channel = if let Some(ref c) = self.to_channel {let c = CHANNEL.captures(c).unwrap();push_channel = c.get(3).map(|x| x.as_str());let c = c.get(1).unwrap().as_str();if c.is_empty() {channel_name} else {c}} else {channel_name};let (remote_channel, push_channel) = self.to_channel.as_deref().map(|c| {let c = CHANNEL.captures(c).unwrap();let push_channel = c.get(3).map(|x| x.as_str());let remote_channel = Some(c.get(1).unwrap().as_str()).filter(|v| !v.is_empty());(remote_channel, push_channel)}).unwrap_or_default();let remote_channel = remote_channel.unwrap_or(&channel_name); - replacement in pijul/src/commands/pushpull.rs at line 364
let mut repo = Repository::find_root(self.repo_path.as_deref())?;let mut repo = Repository::find_root(self.base.repo_path())?; - replacement in pijul/src/commands/pushpull.rs at line 366[6.9070]→[6.9070:9143](∅→∅),[6.9143]→[2.532:582](∅→∅),[2.582]→[6.9190:9216](∅→∅),[6.9190]→[6.9190:9216](∅→∅),[6.9216]→[6.0:66](∅→∅),[6.2188]→[6.0:66](∅→∅),[6.66]→[6.2256:2287](∅→∅),[6.2256]→[6.2256:2287](∅→∅),[6.2287]→[6.9217:9253](∅→∅),[6.9253]→[6.2335:2389](∅→∅),[6.2335]→[6.2335:2389](∅→∅)
let cur = txn.read().current_channel().unwrap_or(libpijul::DEFAULT_CHANNEL).to_string();let channel_name = if let Some(ref c) = self.to_channel {c} else {cur.as_str()};let is_current_channel = channel_name == cur;let txn_read = txn.read();let (channel_name, is_current_channel) =get_channel(self.to_channel.as_deref(), &*txn_read);let channel_name = channel_name.to_string();drop(txn_read); - replacement in pijul/src/commands/pushpull.rs at line 382[6.118138]→[6.118138:118237](∅→∅),[6.118237]→[2.583:621](∅→∅),[2.621]→[6.118272:118283](∅→∅),[6.118272]→[6.118272:118283](∅→∅)
let from_channel = if let Some(ref c) = self.from_channel {c} else {libpijul::DEFAULT_CHANNEL};let from_channel = self.from_channel.as_deref().unwrap_or(libpijul::DEFAULT_CHANNEL);