Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/index.rs Fri Oct 20 08:17:00 2023 +0200 +++ b/rust/hg-core/src/revlog/index.rs Fri Oct 20 08:43:00 2023 +0200 @@ -1142,7 +1142,15 @@ continue; } let parent_seen = &seen[parent.0 as usize]; - if !poison { + if poison { + // this block is logically equivalent to poisoning parent + // and counting it as non interesting if it + // has been seen before (hence counted then as interesting) + if !parent_seen.is_empty() && !parent_seen.is_poisoned() { + interesting -= 1; + } + seen[parent.0 as usize].poison(); + } else { // Without the `interesting` accounting, this block would // be logically equivalent to: parent_seen |= current_seen // The parent counts as interesting if it was not already @@ -1153,14 +1161,6 @@ } else if *parent_seen != current_seen { seen[parent.0 as usize].union(¤t_seen); } - } else { - // this block is logically equivalent to poisoning parent - // and counting it as non interesting if it - // has been seen before (hence counted then as interesting) - if !parent_seen.is_empty() && !parent_seen.is_poisoned() { - interesting -= 1; - } - seen[parent.0 as usize].poison(); } }