FileSet: implement rename
Dependencies
- [2]
FIIUZR4LInclude file content - [3]
ZGFCBIPXFileSet: no error for remove_path - [*]
ATRA7XTTRIIR: factor out Repository struct
Change contents
- edit in src/repo.rs at line 306
RenameNotImplemented(String, String), - edit in src/repo.rs at line 315
FileSetError::RenameNotImplemented(old, new) => {write!(f, "not implemented: rename({}, {})", old, new)} - replacement in src/repo.rs at line 349
Err(FileSetError::RenameNotImplemented(old.to_string(),new.to_string(),))let mut with_slash = old.to_owned();with_slash.push_str("/");let mut files = self.files.lock().unwrap();for f in files.iter_mut() {if f.name == old {f.name = new.to_owned();} else if f.name.starts_with(&with_slash) {let (_, remainder) = f.name.split_at(old.len());let mut new_name = new.to_owned();new_name.push_str(remainder);f.name = new_name;}}Ok(())