comparison rust/hg-core/src/revlog/index.rs @ 51227:e553cd209215

rust-index: avoid double negation in find_gca_candidates()
author Georges Racinet <georges.racinet@octobus.net>
date Fri, 20 Oct 2023 08:43:00 +0200
parents 83091c14058c
children 61a6ef876efd
comparison
equal deleted inserted replaced
51226:83091c14058c 51227:e553cd209215
1140 for parent in self.parents(current_rev)? { 1140 for parent in self.parents(current_rev)? {
1141 if parent == NULL_REVISION { 1141 if parent == NULL_REVISION {
1142 continue; 1142 continue;
1143 } 1143 }
1144 let parent_seen = &seen[parent.0 as usize]; 1144 let parent_seen = &seen[parent.0 as usize];
1145 if !poison { 1145 if poison {
1146 // this block is logically equivalent to poisoning parent
1147 // and counting it as non interesting if it
1148 // has been seen before (hence counted then as interesting)
1149 if !parent_seen.is_empty() && !parent_seen.is_poisoned() {
1150 interesting -= 1;
1151 }
1152 seen[parent.0 as usize].poison();
1153 } else {
1146 // Without the `interesting` accounting, this block would 1154 // Without the `interesting` accounting, this block would
1147 // be logically equivalent to: parent_seen |= current_seen 1155 // be logically equivalent to: parent_seen |= current_seen
1148 // The parent counts as interesting if it was not already 1156 // The parent counts as interesting if it was not already
1149 // known to be an ancestor (would already have counted) 1157 // known to be an ancestor (would already have counted)
1150 if parent_seen.is_empty() { 1158 if parent_seen.is_empty() {
1151 seen[parent.0 as usize] = current_seen.clone(); 1159 seen[parent.0 as usize] = current_seen.clone();
1152 interesting += 1; 1160 interesting += 1;
1153 } else if *parent_seen != current_seen { 1161 } else if *parent_seen != current_seen {
1154 seen[parent.0 as usize].union(&current_seen); 1162 seen[parent.0 as usize].union(&current_seen);
1155 } 1163 }
1156 } else {
1157 // this block is logically equivalent to poisoning parent
1158 // and counting it as non interesting if it
1159 // has been seen before (hence counted then as interesting)
1160 if !parent_seen.is_empty() && !parent_seen.is_poisoned() {
1161 interesting -= 1;
1162 }
1163 seen[parent.0 as usize].poison();
1164 } 1164 }
1165 } 1165 }
1166 1166
1167 current_rev = Revision(current_rev.0 - 1); 1167 current_rev = Revision(current_rev.0 - 1);
1168 } 1168 }