Apply changes with prefixes in .pijul/changes
Dependencies
- [2]
TYTQGSKZApply: proper error message when the change is not found - [3]
A3RM526YIntegrating identity malleability - [4]
FZ7MXL3BAllow to use short tag hashes - [5]
DX2FO4HZTag CLI cleanup - [6]
R3H7D42UDebugging `pijul git`: proper error reporting - [7]
QL6K2ZM3Tags - [8]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [*]
SLJ3OHD4unrecord: show list of changes if none were given as arguments
Change contents
- edit in pijul/src/commands/tag.rs at line 115
} else if tag.len() < 2 {bail!("Ambiguous tag hash, need at least two characters") - replacement in pijul/src/commands/tag.rs at line 116
find_tag(&mut tag_path, &tag)?super::find_hash(&mut tag_path, &tag)? - edit in pijul/src/commands/tag.rs at line 235
}fn find_tag(tag_path: &mut PathBuf, tag: &str) -> Result<libpijul::Hash, anyhow::Error> {let (a, b) = tag.split_at(2);tag_path.push(a);let mut result = None;for f in std::fs::read_dir(&tag_path)? {let e = f?;let p = if let Ok(p) = e.file_name().into_string() {p} else {continue;};if p.starts_with(b) {if result.is_none() {result = Some(p)} else {bail!("Ambiguous tag hash");}}}if let Some(mut r) = result {tag_path.push(&r);if let Some(i) = r.find('.') {r.truncate(i)}let f = format!("{}{}", a, r);if let Some(h) = libpijul::Hash::from_base32(f.as_bytes()) {return Ok(h);}}bail!("Tag not found") - edit in pijul/src/commands/mod.rs at line 259
}}fn find_hash(path: &mut std::path::PathBuf, hash: &str) -> Result<libpijul::Hash, anyhow::Error> {use libpijul::Base32;if hash.len() < 2 {bail!("Ambiguous hash, need at least two characters")}let (a, b) = hash.split_at(2);path.push(a);let mut result = None;for f in std::fs::read_dir(&path)? {let e = f?;let p = if let Ok(p) = e.file_name().into_string() {p} else {continue;};if p.starts_with(b) {if result.is_none() {result = Some(p)} else {bail!("Ambiguous hash");}}}if let Some(mut r) = result {path.push(&r);if let Some(i) = r.find('.') {r.truncate(i)}let f = format!("{}{}", a, r);if let Some(h) = libpijul::Hash::from_base32(f.as_bytes()) {return Ok(h);} - edit in pijul/src/commands/mod.rs at line 295[3.21048][10.5215]
bail!("Hash not found") - replacement in pijul/src/commands/apply.rs at line 51
let change = match change {Ok(change) => change,match change {Ok(change) => repo.changes.save_change(&change)?, - replacement in pijul/src/commands/apply.rs at line 55
let extra = if std::path::Path::new(&ch).is_relative() {" Using the full path to the change file may help."} else {""};bail!("File {} not found, and not recognised as a prefix of a known change identifier.{}", ch, extra)let mut changes = repo.changes_dir.clone();super::find_hash(&mut changes, &ch)? - replacement in pijul/src/commands/apply.rs at line 58
return Err(e.into())return Err(e.into()); - replacement in pijul/src/commands/apply.rs at line 61
Err(e) => return Err(e.into())};repo.changes.save_change(&change)?Err(e) => return Err(e.into()),}