From fdb861b95724676a2f1d4e0f3275ed0a8ac0fa96 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 6 Oct 2021 23:28:30 -0700 Subject: [PATCH] backend: remove unused `Commit::is_pruned` (#32) --- lib/protos/store.proto | 2 +- lib/src/backend.rs | 1 - lib/src/commit.rs | 4 - lib/src/commit_builder.rs | 3 - lib/src/git_backend.rs | 6 - lib/src/index.rs | 292 ++++++------------------------------- lib/src/local_backend.rs | 2 - lib/src/repo.rs | 1 - lib/src/store.rs | 1 - lib/tests/test_mut_repo.rs | 4 +- src/commands.rs | 5 - 11 files changed, 50 insertions(+), 271 deletions(-) diff --git a/lib/protos/store.proto b/lib/protos/store.proto index 2604f767a..134624385 100644 --- a/lib/protos/store.proto +++ b/lib/protos/store.proto @@ -57,7 +57,7 @@ message Commit { Signature committer = 7; bool is_open = 8; - bool is_pruned = 9; + bool is_pruned = 9 [deprecated = true]; } message Conflict { diff --git a/lib/src/backend.rs b/lib/src/backend.rs index b401c7a85..2439c6333 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -162,7 +162,6 @@ pub struct Commit { pub author: Signature, pub committer: Signature, pub is_open: bool, - pub is_pruned: bool, } #[derive(Debug, PartialEq, Eq, Clone)] diff --git a/lib/src/commit.rs b/lib/src/commit.rs index c49479a7f..1fc5c223c 100644 --- a/lib/src/commit.rs +++ b/lib/src/commit.rs @@ -124,10 +124,6 @@ impl Commit { self.data.is_open } - pub fn is_pruned(&self) -> bool { - self.data.is_pruned - } - pub fn is_empty(&self) -> bool { let parents = self.parents(); // TODO: Perhaps the root commit should also be considered empty. diff --git a/lib/src/commit_builder.rs b/lib/src/commit_builder.rs index b5289023c..58a48711e 100644 --- a/lib/src/commit_builder.rs +++ b/lib/src/commit_builder.rs @@ -59,7 +59,6 @@ impl CommitBuilder { author: signature.clone(), committer: signature, is_open: false, - is_pruned: false, }; CommitBuilder { store: store.clone(), @@ -76,7 +75,6 @@ impl CommitBuilder { let mut commit = predecessor.store_commit().clone(); commit.predecessors = vec![predecessor.id().clone()]; commit.committer = signature(settings); - commit.is_pruned = false; CommitBuilder { store: store.clone(), commit, @@ -100,7 +98,6 @@ impl CommitBuilder { author: signature.clone(), committer: signature, is_open: true, - is_pruned: false, }; CommitBuilder { store: store.clone(), diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index 003bd5a79..15f3d733f 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -92,7 +92,6 @@ fn signature_to_git(signature: &Signature) -> git2::Signature { fn serialize_note(commit: &Commit) -> String { let mut proto = crate::protos::store::Commit::new(); proto.is_open = commit.is_open; - proto.is_pruned = commit.is_pruned; proto.change_id = commit.change_id.0.to_vec(); for predecessor in &commit.predecessors { proto.predecessors.push(predecessor.0.to_vec()); @@ -106,7 +105,6 @@ fn deserialize_note(commit: &mut Commit, note: &str) { let mut cursor = Cursor::new(bytes); let proto: crate::protos::store::Commit = Message::parse_from_reader(&mut cursor).unwrap(); commit.is_open = proto.is_open; - commit.is_pruned = proto.is_pruned; commit.change_id = ChangeId(proto.change_id); for predecessor in &proto.predecessors { commit.predecessors.push(CommitId(predecessor.clone())); @@ -353,7 +351,6 @@ impl Backend for GitBackend { author, committer, is_open: false, - is_pruned: false, }; let maybe_note = locked_repo @@ -564,7 +561,6 @@ mod tests { assert_eq!(commit.predecessors, vec![]); assert_eq!(commit.root_tree.0.as_slice(), root_tree_id.as_bytes()); assert!(!commit.is_open); - assert!(!commit.is_pruned); assert_eq!(commit.description, "git commit message"); assert_eq!(commit.author.name, "git author"); assert_eq!(commit.author.email, "git.author@example.com"); @@ -641,7 +637,6 @@ mod tests { author: signature.clone(), committer: signature, is_open: false, - is_pruned: false, }; let commit_id = store.write_commit(&commit).unwrap(); let git_refs = git_repo @@ -675,7 +670,6 @@ mod tests { author: signature.clone(), committer: signature, is_open: false, - is_pruned: false, }; let commit_id1 = store.write_commit(&commit1).unwrap(); let mut commit2 = commit1; diff --git a/lib/src/index.rs b/lib/src/index.rs index 9299903b3..358ea8c27 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -153,10 +153,6 @@ impl CommitGraphEntry<'_> { 48 + hash_length } - fn is_pruned(&self) -> bool { - (&self.data[0..]).read_u32::().unwrap() != 0 - } - fn generation_number(&self) -> u32 { (&self.data[4..]).read_u32::().unwrap() } @@ -324,7 +320,6 @@ impl PrefixResolution { struct MutableGraphEntry { commit_id: CommitId, change_id: ChangeId, - is_pruned: bool, generation_number: u32, parent_positions: Vec, predecessor_positions: Vec, @@ -369,7 +364,6 @@ impl MutableIndex { self.add_commit_data( commit.id().clone(), commit.change_id().clone(), - commit.is_pruned(), commit.parent_ids(), commit.predecessor_ids(), ); @@ -379,7 +373,6 @@ impl MutableIndex { &mut self, commit_id: CommitId, change_id: ChangeId, - is_pruned: bool, parent_ids: Vec, predecessor_ids: Vec, ) { @@ -389,7 +382,6 @@ impl MutableIndex { let mut entry = MutableGraphEntry { commit_id, change_id, - is_pruned, generation_number: 0, parent_positions: vec![], predecessor_positions: vec![], @@ -434,7 +426,6 @@ impl MutableIndex { self.add_commit_data( entry.commit_id(), entry.change_id(), - entry.is_pruned(), parent_ids, predecessor_ids, ); @@ -498,7 +489,7 @@ impl MutableIndex { let mut parent_overflow = vec![]; let mut predecessor_overflow = vec![]; for entry in self.graph { - let flags = if entry.is_pruned { 1 } else { 0 }; + let flags = 0; buf.write_u32::(flags).unwrap(); buf.write_u32::(entry.generation_number) @@ -692,8 +683,6 @@ trait IndexSegment { fn segment_resolve_prefix(&self, prefix: &HexPrefix) -> PrefixResolution; - fn segment_is_pruned(&self, local_pos: u32) -> bool; - fn segment_generation_number(&self, local_pos: u32) -> u32; fn segment_commit_id(&self, local_pos: u32) -> CommitId; @@ -725,7 +714,6 @@ impl<'a> CompositeIndex<'a> { let mut max_generation_number = 0; let mut is_head = vec![true; num_commits as usize]; let mut change_ids = HashSet::new(); - let mut num_pruned_commits = 0; for pos in 0..num_commits { let entry = self.entry_by_pos(IndexPosition(pos)); max_generation_number = max(max_generation_number, entry.generation_number()); @@ -735,9 +723,6 @@ impl<'a> CompositeIndex<'a> { for parent_pos in entry.parent_positions() { is_head[parent_pos.0 as usize] = false; } - if entry.is_pruned() { - num_pruned_commits += 1; - } change_ids.insert(entry.change_id()); } let num_heads = is_head.iter().filter(|is_head| **is_head).count() as u32; @@ -762,7 +747,6 @@ impl<'a> CompositeIndex<'a> { num_merges, max_generation_number, num_heads, - num_pruned_commits, num_changes: change_ids.len() as u32, levels, } @@ -989,7 +973,6 @@ pub struct IndexStats { pub num_merges: u32, pub max_generation_number: u32, pub num_heads: u32, - pub num_pruned_commits: u32, pub num_changes: u32, pub levels: Vec, } @@ -1170,11 +1153,6 @@ impl IndexSegment for ReadonlyIndex { } } - fn segment_is_pruned(&self, local_pos: u32) -> bool { - let graph_entry = self.graph_entry(local_pos); - graph_entry.is_pruned() - } - fn segment_generation_number(&self, local_pos: u32) -> u32 { self.graph_entry(local_pos).generation_number() } @@ -1287,10 +1265,6 @@ impl IndexSegment for MutableIndex { } } - fn segment_is_pruned(&self, local_pos: u32) -> bool { - self.graph[local_pos as usize].is_pruned - } - fn segment_generation_number(&self, local_pos: u32) -> u32 { self.graph[local_pos as usize].generation_number } @@ -1376,10 +1350,6 @@ impl<'a> IndexEntry<'a> { self.source.segment_change_id(self.local_pos) } - pub fn is_pruned(&self) -> bool { - self.source.segment_is_pruned(self.local_pos) - } - pub fn num_parents(&self) -> u32 { self.source.segment_num_parents(self.local_pos) } @@ -1620,7 +1590,6 @@ mod tests { assert_eq!(stats.max_generation_number, 0); assert_eq!(stats.num_merges, 0); assert_eq!(stats.num_changes, 0); - assert_eq!(stats.num_pruned_commits, 0); assert_eq!(index.num_commits(), 0); // Cannot find any commits assert!(index.entry_by_id(&CommitId::from_hex("000000")).is_none()); @@ -1635,7 +1604,7 @@ mod tests { let mut index = MutableIndex::full(3); let id_0 = CommitId::from_hex("000000"); let change_id0 = new_change_id(); - index.add_commit_data(id_0.clone(), change_id0.clone(), false, vec![], vec![]); + index.add_commit_data(id_0.clone(), change_id0.clone(), vec![], vec![]); let mut _saved_index = None; let index = if on_disk { _saved_index = Some(index.save_in(temp_dir.path().to_owned()).unwrap()); @@ -1651,7 +1620,6 @@ mod tests { assert_eq!(stats.max_generation_number, 0); assert_eq!(stats.num_merges, 0); assert_eq!(stats.num_changes, 1); - assert_eq!(stats.num_pruned_commits, 0); assert_eq!(index.num_commits(), 1); // Can find only the root commit assert_eq!(index.commit_id_to_pos(&id_0), Some(IndexPosition(0))); @@ -1662,7 +1630,6 @@ mod tests { assert_eq!(entry.pos, IndexPosition(0)); assert_eq!(entry.commit_id(), id_0); assert_eq!(entry.change_id(), change_id0); - assert!(!entry.is_pruned()); assert_eq!(entry.generation_number(), 0); assert_eq!(entry.num_parents(), 0); assert_eq!(entry.parent_positions(), Vec::::new()); @@ -1678,7 +1645,7 @@ mod tests { let mut index = MutableIndex::full(3); let id_0 = CommitId::from_hex("000000"); let id_1 = CommitId::from_hex("111111"); - index.add_commit_data(id_1, new_change_id(), false, vec![id_0], vec![]); + index.add_commit_data(id_1, new_change_id(), vec![id_0], vec![]); } #[test] @@ -1687,7 +1654,7 @@ mod tests { let mut index = MutableIndex::full(3); let id_0 = CommitId::from_hex("000000"); let id_1 = CommitId::from_hex("111111"); - index.add_commit_data(id_1, new_change_id(), false, vec![], vec![id_0]); + index.add_commit_data(id_1, new_change_id(), vec![], vec![id_0]); } #[test_case(false, false; "full in memory")] @@ -1710,21 +1677,9 @@ mod tests { let change_id1 = new_change_id(); let id_2 = CommitId::from_hex("222222"); let change_id2 = change_id1.clone(); - index.add_commit_data(id_0.clone(), change_id0, false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - change_id1.clone(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - change_id2.clone(), - false, - vec![id_0.clone()], - vec![], - ); + index.add_commit_data(id_0.clone(), change_id0, vec![], vec![]); + index.add_commit_data(id_1.clone(), change_id1.clone(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), change_id2.clone(), vec![id_0.clone()], vec![]); // If testing incremental indexing, write the first three commits to one file // now and build the remainder as another segment on top. @@ -1739,24 +1694,16 @@ mod tests { let change_id4 = new_change_id(); let id_5 = CommitId::from_hex("555555"); let change_id5 = change_id3.clone(); - index.add_commit_data( - id_3.clone(), - change_id3.clone(), - true, - vec![id_2.clone()], - vec![], - ); + index.add_commit_data(id_3.clone(), change_id3.clone(), vec![id_2.clone()], vec![]); index.add_commit_data( id_4.clone(), change_id4, - false, vec![id_1.clone()], vec![id_2.clone(), id_3.clone()], ); index.add_commit_data( id_5.clone(), change_id5, - false, vec![id_4.clone(), id_2.clone()], vec![], ); @@ -1775,7 +1722,6 @@ mod tests { assert_eq!(stats.max_generation_number, 3); assert_eq!(stats.num_merges, 1); assert_eq!(stats.num_changes, 4); - assert_eq!(stats.num_pruned_commits, 1); assert_eq!(index.num_commits(), 6); // Can find all the commits let entry_0 = index.entry_by_id(&id_0).unwrap(); @@ -1790,7 +1736,6 @@ mod tests { assert_eq!(entry_1.pos, IndexPosition(1)); assert_eq!(entry_1.commit_id(), id_1); assert_eq!(entry_1.change_id(), change_id1); - assert!(!entry_1.is_pruned()); assert_eq!(entry_1.generation_number(), 1); assert_eq!(entry_1.num_parents(), 1); assert_eq!(entry_1.parent_positions(), vec![IndexPosition(0)]); @@ -1801,14 +1746,12 @@ mod tests { assert_eq!(entry_2.pos, IndexPosition(2)); assert_eq!(entry_2.commit_id(), id_2); assert_eq!(entry_2.change_id(), change_id2); - assert!(!entry_2.is_pruned()); assert_eq!(entry_2.generation_number(), 1); assert_eq!(entry_2.num_parents(), 1); assert_eq!(entry_2.parent_positions(), vec![IndexPosition(0)]); assert_eq!(entry_3.change_id(), change_id3); assert_eq!(entry_3.generation_number(), 2); assert_eq!(entry_3.parent_positions(), vec![IndexPosition(2)]); - assert!(entry_3.is_pruned()); assert_eq!(entry_4.pos, IndexPosition(4)); assert_eq!(entry_4.generation_number(), 2); assert_eq!(entry_4.num_parents(), 1); @@ -1855,40 +1798,15 @@ mod tests { let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); let id_6 = CommitId::from_hex("666666"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_3.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_4.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data(id_5.clone(), new_change_id(), false, vec![id_0], vec![]); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_4.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_5.clone(), new_change_id(), vec![id_0], vec![]); index.add_commit_data( id_6.clone(), new_change_id(), - false, vec![id_1, id_2, id_3, id_4, id_5], vec![], ); @@ -1933,9 +1851,9 @@ mod tests { let id_0 = CommitId::from_hex("000000"); let id_1 = CommitId::from_hex("009999"); let id_2 = CommitId::from_hex("055488"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data(id_1.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data(id_2.clone(), new_change_id(), false, vec![], vec![]); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![], vec![]); // Write the first three commits to one file and build the remainder on top. let initial_file = index.save_in(temp_dir.path().to_owned()).unwrap(); @@ -1944,9 +1862,9 @@ mod tests { let id_3 = CommitId::from_hex("055444"); let id_4 = CommitId::from_hex("055555"); let id_5 = CommitId::from_hex("033333"); - index.add_commit_data(id_3, new_change_id(), false, vec![], vec![]); - index.add_commit_data(id_4, new_change_id(), false, vec![], vec![]); - index.add_commit_data(id_5, new_change_id(), false, vec![], vec![]); + index.add_commit_data(id_3, new_change_id(), vec![], vec![]); + index.add_commit_data(id_4, new_change_id(), vec![], vec![]); + index.add_commit_data(id_5, new_change_id(), vec![], vec![]); // Can find commits given the full hex number assert_eq!( @@ -2007,39 +1925,14 @@ mod tests { let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_3.clone(), - new_change_id(), - false, - vec![id_2.clone()], - vec![], - ); - index.add_commit_data( - id_4.clone(), - new_change_id(), - false, - vec![id_1.clone()], - vec![], - ); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3.clone(), new_change_id(), vec![id_2.clone()], vec![]); + index.add_commit_data(id_4.clone(), new_change_id(), vec![id_1.clone()], vec![]); index.add_commit_data( id_5.clone(), new_change_id(), - false, vec![id_4.clone(), id_2.clone()], vec![], ); @@ -2074,39 +1967,14 @@ mod tests { let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_3.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_4.clone(), - new_change_id(), - false, - vec![id_1.clone()], - vec![], - ); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_4.clone(), new_change_id(), vec![id_1.clone()], vec![]); index.add_commit_data( id_5.clone(), new_change_id(), - false, vec![id_4.clone(), id_2.clone()], vec![], ); @@ -2181,26 +2049,18 @@ mod tests { let id_2 = CommitId::from_hex("222222"); let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data(id_2.clone(), new_change_id(), false, vec![id_0], vec![]); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0], vec![]); index.add_commit_data( id_3.clone(), new_change_id(), - false, vec![id_1.clone(), id_2.clone()], vec![], ); index.add_commit_data( id_4.clone(), new_change_id(), - false, vec![id_1.clone(), id_2.clone()], vec![], ); @@ -2224,27 +2084,19 @@ mod tests { let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data(id_1, new_change_id(), false, vec![id_0.clone()], vec![]); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data(id_3, new_change_id(), false, vec![id_0.clone()], vec![]); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1, new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3, new_change_id(), vec![id_0.clone()], vec![]); index.add_commit_data( id_4.clone(), new_change_id(), - false, vec![id_0.clone(), id_2.clone()], vec![], ); index.add_commit_data( id_5.clone(), new_change_id(), - false, vec![id_0, id_2.clone()], vec![], ); @@ -2270,39 +2122,14 @@ mod tests { let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_3.clone(), - new_change_id(), - false, - vec![id_2.clone()], - vec![], - ); - index.add_commit_data( - id_4.clone(), - new_change_id(), - false, - vec![id_1.clone()], - vec![], - ); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3.clone(), new_change_id(), vec![id_2.clone()], vec![]); + index.add_commit_data(id_4.clone(), new_change_id(), vec![id_1.clone()], vec![]); index.add_commit_data( id_5.clone(), new_change_id(), - false, vec![id_4.clone(), id_2.clone()], vec![], ); @@ -2378,39 +2205,14 @@ mod tests { let id_3 = CommitId::from_hex("333333"); let id_4 = CommitId::from_hex("444444"); let id_5 = CommitId::from_hex("555555"); - index.add_commit_data(id_0.clone(), new_change_id(), false, vec![], vec![]); - index.add_commit_data( - id_1.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_2.clone(), - new_change_id(), - false, - vec![id_0.clone()], - vec![], - ); - index.add_commit_data( - id_3.clone(), - new_change_id(), - false, - vec![id_2.clone()], - vec![], - ); - index.add_commit_data( - id_4.clone(), - new_change_id(), - false, - vec![id_1.clone()], - vec![], - ); + index.add_commit_data(id_0.clone(), new_change_id(), vec![], vec![]); + index.add_commit_data(id_1.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_2.clone(), new_change_id(), vec![id_0.clone()], vec![]); + index.add_commit_data(id_3.clone(), new_change_id(), vec![id_2.clone()], vec![]); + index.add_commit_data(id_4.clone(), new_change_id(), vec![id_1.clone()], vec![]); index.add_commit_data( id_5.clone(), new_change_id(), - false, vec![id_4.clone(), id_2.clone()], vec![], ); diff --git a/lib/src/local_backend.rs b/lib/src/local_backend.rs index 01400f2d1..d938c9478 100644 --- a/lib/src/local_backend.rs +++ b/lib/src/local_backend.rs @@ -253,7 +253,6 @@ pub fn commit_to_proto(commit: &Commit) -> crate::protos::store::Commit { proto.set_author(signature_to_proto(&commit.author)); proto.set_committer(signature_to_proto(&commit.committer)); proto.set_is_open(commit.is_open); - proto.set_is_pruned(commit.is_pruned); proto } @@ -276,7 +275,6 @@ fn commit_from_proto(proto: &crate::protos::store::Commit) -> Commit { author: signature_from_proto(proto.author.get_ref()), committer: signature_from_proto(proto.committer.get_ref()), is_open: proto.is_open, - is_pruned: proto.is_pruned, } } diff --git a/lib/src/repo.rs b/lib/src/repo.rs index 470f989b6..7811cdda3 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -217,7 +217,6 @@ impl ReadonlyRepo { author: signature.clone(), committer: signature, is_open: true, - is_pruned: false, }; let checkout_commit = store.write_commit(checkout_commit); diff --git a/lib/src/store.rs b/lib/src/store.rs index f3ec88873..bd671eb6a 100644 --- a/lib/src/store.rs +++ b/lib/src/store.rs @@ -119,7 +119,6 @@ impl Store { author: signature.clone(), committer: signature, is_open: false, - is_pruned: false, } } diff --git a/lib/tests/test_mut_repo.rs b/lib/tests/test_mut_repo.rs index 772d19f0e..e12aaca72 100644 --- a/lib/tests/test_mut_repo.rs +++ b/lib/tests/test_mut_repo.rs @@ -179,7 +179,7 @@ fn write_conflict(store: &Arc, file_path: &RepoPath) -> ConflictId { #[test_case(false ; "local backend")] // #[test_case(true ; "git backend")] fn test_checkout_previous_not_empty(use_git: bool) { - // Test that MutableRepo::check_out() does not usually prune the previous + // Test that MutableRepo::check_out() does not usually abandon the previous // commit. let settings = testutils::user_settings(); let (_temp_dir, repo) = testutils::init_repo(&settings, use_git); @@ -206,7 +206,7 @@ fn test_checkout_previous_not_empty(use_git: bool) { #[test_case(false ; "local backend")] // #[test_case(true ; "git backend")] fn test_checkout_previous_empty(use_git: bool) { - // Test that MutableRepo::check_out() prunes the previous commit if it was + // Test that MutableRepo::check_out() abandons the previous commit if it was // empty. let settings = testutils::user_settings(); let (_temp_dir, repo) = testutils::init_repo(&settings, use_git); diff --git a/src/commands.rs b/src/commands.rs index 728f50669..59c0f2cb8 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -2733,11 +2733,6 @@ fn cmd_debug( writeln!(ui, "Number of merges: {}", stats.num_merges)?; writeln!(ui, "Max generation number: {}", stats.max_generation_number)?; writeln!(ui, "Number of heads: {}", stats.num_heads)?; - writeln!( - ui, - "Number of abandoned commits: {}", - stats.num_pruned_commits - )?; writeln!(ui, "Number of changes: {}", stats.num_changes)?; writeln!(ui, "Stats per level:")?; for (i, level) in stats.levels.iter().enumerate() {