edit in src/repo.rs at line 1
+ use std::cmp::Ordering;
replacement in src/repo.rs at line 99
− let change_store = EagerChangeStore::from_root(&repo_path);
+ let change_store = EagerChangeStore::from_root(repo_path);
replacement in src/repo.rs at line 103
− match env::var("HOME") {
− Ok(home) => {
− Self::load_identities(
− &mut identities,
− &Path::new(&home).join(".config/pijul/identities"),
− )
− .unwrap_or(());
− }
− Err(..) => {}
+ if let Ok(home) = env::var("HOME") {
+ Self::load_identities(
+ &mut identities,
+ &Path::new(&home).join(".config/pijul/identities"),
+ )
+ .unwrap_or(());
replacement in src/repo.rs at line 111
[4.789]→[4.443:474](∅→∅),
[4.819]→[4.443:474](∅→∅) replacement in src/repo.rs at line 116
[4.814]→[4.522:534](∅→∅),
[4.522]→[4.522:534](∅→∅) replacement in src/repo.rs at line 125
[4.1015]→[4.1015:1423](∅→∅) − match fs::read_to_string(dir.join(file?.path()).join("identity.toml")) {
− Ok(content) => {
− let id: Identity = toml::from_str(&content)?;
− identities.insert(
− id.public_key.key,
− format!("{} <{}>", id.display_name, id.email),
− );
− }
− Err(..) => {}
+ if let Ok(content) = fs::read_to_string(dir.join(file?.path()).join("identity.toml")) {
+ let id: Identity = toml::from_str(&content)?;
+ identities.insert(
+ id.public_key.key,
+ format!("{} <{}>", id.display_name, id.email),
+ );
replacement in src/repo.rs at line 133
[4.1447]→[4.1447:1470](∅→∅) replacement in src/repo.rs at line 154
[4.1522]→[4.1522:1770](∅→∅) − match self.identities.get(key) {
− Some(name) => {
− return name.to_string();
− }
− None => {
− return format!("{} <>", key);
− }
− }
+ return self
+ .identities
+ .get(key)
+ .map_or_else(|| format!("{} <>", key), Into::into);
replacement in src/repo.rs at line 161
− if let Some(email) = a.0.get("email") {
− return format!("{} <{}>", name, email);
− }
− return format!("{} <>", name);
+ return format!(
+ "{} <{}>",
+ name,
+ a.0.get("email").map(|e| e.as_str()).unwrap_or("")
+ );
replacement in src/repo.rs at line 172
[4.1008]→[4.1008:1041](∅→∅) − return "<>".to_string();
replacement in src/repo.rs at line 188
[4.1260]→[4.1260:1309](∅→∅) − .map(|a| self.author_string(&a))
+ .map(|a| self.author_string(a))
replacement in src/repo.rs at line 201
[4.1434]→[4.1434:1462](∅→∅) replacement in src/repo.rs at line 205
− let change_store = EagerChangeStore::from_root(&Path::new(&self.path));
+ let change_store = EagerChangeStore::from_root(Path::new(&self.path));
replacement in src/repo.rs at line 208
[4.984]→[4.984:1012](∅→∅) replacement in src/repo.rs at line 212
[4.1076]→[4.1076:1088](∅→∅) replacement in src/repo.rs at line 237
[4.1912]→[4.1912:1935](∅→∅) replacement in src/repo.rs at line 250
− if int_ < int {
− continue;
− } else if int_ > int {
− break;
+ match int_.cmp(int) {
+ Ordering::Less => continue,
+ Ordering::Greater => break,
+ Ordering::Equal => {
+ if let Some((path, _)) = libpijul::fs::find_path(
+ &self.change_store,
+ &*txn,
+ &*self.channel.read(),
+ false,
+ *inode,
+ )? {
+ touched_paths.insert(path);
+ } else {
+ touched_paths.clear();
+ break;
+ }
+ }
edit in src/repo.rs at line 268
− if let Some((path, _)) = libpijul::fs::find_path(
− &self.change_store,
− &*txn,
− &*self.channel.read(),
− false,
− *inode,
− )? {
− touched_paths.insert(path);
− } else {
− touched_paths.clear();
− break;
− }
replacement in src/repo.rs at line 280
[2.1232]→[2.1232:1664](∅→∅) − match last {
− Some(last_path) => {
− // If `last_path` is a prefix (in the path sense) of `path`, skip.
− if last_path.len() < path.len() {
− let (pre_last, post_last) = path.split_at(last_path.len());
− if pre_last == last_path && post_last.starts_with("/") {
− continue;
− }
+ if let Some(last_path) = last {
+ // If `last_path` is a prefix (in the path sense) of `path`, skip.
+ if last_path.len() < path.len() {
+ let (pre_last, post_last) = path.split_at(last_path.len());
+ if pre_last == last_path && post_last.starts_with('/') {
+ continue;
edit in src/repo.rs at line 288
[2.1704]→[2.1704:1729](∅→∅) replacement in src/repo.rs at line 303
[2.2080]→[4.129:152](∅→∅),
[4.2355]→[4.129:152](∅→∅) replacement in src/repo.rs at line 402
[4.817]→[4.5612:5634](∅→∅),
[4.5612]→[4.5612:5634](∅→∅) replacement in src/main.rs at line 39
[4.121]→[3.733:823](∅→∅),
[3.823]→[4.219:239](∅→∅),
[4.219]→[4.219:239](∅→∅) − match cli.marks {
− Some(ref filename) => stream.load_marks(filename).unwrap(),
− None => (),
+ if let Some(ref filename) = cli.marks {
+ stream.load_marks(filename).unwrap();
replacement in src/main.rs at line 69
[4.573]→[3.1190:1280](∅→∅),
[3.1280]→[4.671:691](∅→∅),
[4.671]→[4.671:691](∅→∅) − match cli.marks {
− Some(ref filename) => stream.save_marks(filename).unwrap(),
− None => (),
+ if let Some(ref filename) = cli.marks {
+ stream.save_marks(filename).unwrap();
replacement in src/fast_export.rs at line 25
replacement in src/fast_export.rs at line 40
− pub fn new(branch_name: String) -> FastExportStream {
− return FastExportStream {
+ pub fn new(branch_name: String) -> Self {
+ FastExportStream {
replacement in src/fast_export.rs at line 50
[4.79]→[4.599:610](∅→∅),
[4.6007]→[4.599:610](∅→∅),
[4.599]→[4.599:610](∅→∅) replacement in src/fast_export.rs at line 56
[4.1070]→[4.1070:1970](∅→∅) − match &op {
− FileOp::Modify { fw } => {
− let ct = fw.content.lock().unwrap();
− let content: &[u8] = &*ct;
− let h = sha256::digest(content);
− let mut new_blob = false;
− let blob_mark = *self.blob_marks.entry(h).or_insert_with(|| {
− new_blob = true;
− self.max_blob_mark += 1;
− self.max_blob_mark
− });
− file_marks.insert(fw.name.clone(), blob_mark);
− if new_blob {
− println!("blob");
− println!("mark :{}", blob_mark);
− println!("data {}", content.len());
− std::io::stdout().write_all(content).unwrap();
− println!("");
− }
+ if let FileOp::Modify { fw } = &op {
+ let ct = fw.content.lock().unwrap();
+ let content: &[u8] = &ct;
+ let h = sha256::digest(content);
+ let mut new_blob = false;
+ let blob_mark = *self.blob_marks.entry(h).or_insert_with(|| {
+ new_blob = true;
+ self.max_blob_mark += 1;
+ self.max_blob_mark
+ });
+ file_marks.insert(fw.name.clone(), blob_mark);
+ if new_blob {
+ println!("blob");
+ println!("mark :{}", blob_mark);
+ println!("data {}", content.len());
+ std::io::stdout().write_all(content).unwrap();
+ println!();
edit in src/fast_export.rs at line 74
[4.1988]→[4.1988:2013](∅→∅) replacement in src/fast_export.rs at line 90
[4.893]→[4.557:606](∅→∅),
[4.557]→[4.557:606](∅→∅) − let committer = if c.authors.len() > 0 {
+ let committer = if c.authors.is_empty() {
+ "<>"
+ } else {
edit in src/fast_export.rs at line 94
replacement in src/fast_export.rs at line 102
[4.1010]→[4.894:917](∅→∅),
[4.917]→[4.6530:6676](∅→∅),
[4.6676]→[4.1108:1123](∅→∅),
[4.1108]→[4.1108:1123](∅→∅),
[4.1123]→[4.6677:6700](∅→∅) − match parent {
− Some(p) => match self.commit_marks.get(&p) {
− Some(p_mark) => println!("from :{}", p_mark),
− None => {}
− },
− None => {}
+ if let Some(p) = parent {
+ if let Some(p_mark) = self.commit_marks.get(&p) {
+ println!("from :{}", p_mark);
+ }
replacement in src/fast_export.rs at line 114
[4.2302]→[4.2302:2389](∅→∅) − FileOp::Delete { path } => println!("D \"{}\"", escape_string(&path)),
+ FileOp::Delete { path } => println!("D \"{}\"", escape_string(path)),
replacement in src/fast_export.rs at line 116
[4.2438]→[4.2438:2528](∅→∅) − println!("R \"{}\" \"{}\"", escape_string(&old), escape_string(&new))
+ println!("R \"{}\" \"{}\"", escape_string(old), escape_string(new))
replacement in src/fast_export.rs at line 120
[4.1082]→[4.1082:1104](∅→∅) replacement in src/fast_export.rs at line 126
[4.1265]→[4.1265:1338](∅→∅) − let state = libpijul::Merkle::from_base32(&caps[2].as_bytes())?;
+ let state = libpijul::Merkle::from_base32(caps[2].as_bytes())?;
replacement in src/fast_export.rs at line 150
[4.2225]→[4.2225:2248](∅→∅) replacement in src/fast_export.rs at line 154
[4.2332]→[4.2332:2385](∅→∅) − std::fs::write(&filename, &self.mark_file)?;
+ std::fs::write(filename, &self.mark_file)?;
replacement in src/changestore.rs at line 49
[4.1738]→[4.1738:1778](∅→∅) − if let Some(_) = r.get(h) {
+ if r.get(h).is_some() {
replacement in src/changestore.rs at line 56
[4.1919]→[4.1919:1978](∅→∅) − let p = Change::deserialize(&file_name, Some(h))?;
+ let p = Change::deserialize(file_name, Some(h))?;
replacement in src/changestore.rs at line 83
[4.2693]→[4.2693:2730](∅→∅) − if let Some(t) = r.get(&h) {
+ if let Some(t) = r.get(h) {