pub struct Attribution { /* private fields */ }Expand description
Maps a reverted commit back to the mainline commit that introduced it.
Needed because the obvious labelling — “a revert whose target is a merge” — sees almost nothing in a pull-request workflow. Measured on rust-lang/rust: of 307 unique revert targets, 39 are merges and 267 are ordinary commits, because a revert names the change, not the merge that landed it. Without attribution the proxy undercounts by roughly eight to one.
A struct rather than a bare map so it can carry why a target went unresolved, which is the part that would otherwise be silently lost.
Implementations§
Source§impl Attribution
impl Attribution
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty attribution: every revert is matched by exact oid only, which is the behaviour before attribution existed.
Sourcepub fn insert(&mut self, target: String, introduced_by: String)
pub fn insert(&mut self, target: String, introduced_by: String)
Records that target arrived on the mainline at introduced_by.
Sourcepub fn insert_unresolved(&mut self, target: String)
pub fn insert_unresolved(&mut self, target: String)
Records a target that could not be placed — not an ancestor of the branch tip, or absent from the clone.
Sourcepub fn get(&self, target: &str) -> Option<&str>
pub fn get(&self, target: &str) -> Option<&str>
The mainline commit that introduced target, if known.
Sourcepub fn resolved_count(&self) -> usize
pub fn resolved_count(&self) -> usize
How many targets were placed.
Sourcepub fn unresolved(&self) -> &BTreeSet<String>
pub fn unresolved(&self) -> &BTreeSet<String>
Targets that could not be placed. Non-empty is normal — a revert may target work that never reached this branch — but a large fraction means the corpus or the branch is the wrong one.
Trait Implementations§
Source§impl Clone for Attribution
impl Clone for Attribution
Source§fn clone(&self) -> Attribution
fn clone(&self) -> Attribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Attribution
impl Debug for Attribution
Source§impl Default for Attribution
impl Default for Attribution
Source§fn default() -> Attribution
fn default() -> Attribution
Source§impl PartialEq for Attribution
impl PartialEq for Attribution
Source§fn eq(&self, other: &Attribution) -> bool
fn eq(&self, other: &Attribution) -> bool
self and other values to be equal, and is used by ==.