Allow deleting remote by URL and remove default remote if set to deleted remote
Dependencies
- [2]
IVLLXQ5ZImproved push/pull reporting - [3]
YN63NUZOSanakirja 1.0 - [4]
QCPIBC6MMake the default remote configurable through the cli - [5]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [6]
JL4WKA5PImplement the Sanakirja concurrency model in a cross-process way - [7]
ZBNKSYA6Fixing a bus error when starting a transaction on a full disk - [8]
A3RM526YIntegrating identity malleability - [9]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [10]
VZL5OHF5Remove the obsolete `remote list` command
Change contents
- edit in pijul/src/commands/pushpull.rs at line 11
use libpijul::pristine::RemoteId;use libpijul::small_string::SmallString; - edit in pijul/src/commands/pushpull.rs at line 40
struct RemoteInfo {id: Option<RemoteId>,path: SmallString,}fn get_remote_by_any(repo: &Repository,txn: &mut MutTxn<()>,spec: &str,) -> Result<Option<RemoteInfo>, anyhow::Error> {// Try indexing by ID firstif let Some(id) = RemoteId::from_base32(spec.as_bytes()) {if let Some(r) = txn.get_remote(id)? {let path = r.lock().path.clone();return Ok(Some(RemoteInfo { id: Some(id), path }));}}// Look it up by URLfor r in txn.iter_remotes(&RemoteId::nil())? {let r = r?;let path = r.lock().path.clone();if path.as_str() == spec {return Ok(Some(RemoteInfo {id: Some(*r.id()),path,}));}}// Otherwise, is it set as the default remote?if repo.config.default_remote.as_deref() == Some(spec) {return Ok(Some(RemoteInfo {id: None,path: SmallString::from_str(spec),}));}Ok(None)} - replacement in pijul/src/commands/pushpull.rs at line 91
for r in txn.iter_remotes(&libpijul::pristine::RemoteId::nil())? {for r in txn.iter_remotes(&RemoteId::nil())? { - replacement in pijul/src/commands/pushpull.rs at line 102
let remote =if let Some(r) = libpijul::pristine::RemoteId::from_base32(remote.as_bytes()) {r} else {bail!("Could not parse identifier: {:?}", remote)};let mut repo = repo; - replacement in pijul/src/commands/pushpull.rs at line 104
if !txn.drop_named_remote(remote)? {bail!("Remote not found: {:?}", remote)} else {txn.commit()?;let Some(ri) = get_remote_by_any(&repo, &mut txn, &remote)? else {bail!("No such remote: {}", remote);};if let Some(id) = ri.id {txn.drop_named_remote(id)?;}if repo.config.default_remote.as_deref() == Some(ri.path.as_str()) {repo.config.default_remote = None; - edit in pijul/src/commands/pushpull.rs at line 116
txn.commit()?;repo.update_config()?;