Skip to content

Commit 3d57460

Browse files
committed
Sync reviewers from rust-lang/team
1 parent 083c6f2 commit 3d57460

File tree

8 files changed

+684
-574
lines changed

8 files changed

+684
-574
lines changed

Cargo.lock

+417-228
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ handlebars = { version = "4.1.1", features = ["dir_source"] }
1414
walkdir = "2"
1515
regex = "1.5.5"
1616
mailmap = { path = "./mailmap" }
17+
ureq = { version = "2.6.2", features = ["json"] }
18+
unicase = "2.6.0"
1719

1820
[profile.release]
1921
debug = 2

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ To run thanks, you'll need stable Rust.
1212
There is no need to configure anything; thanks will run everything on its own, simply `cargo run
1313
--release` and the site will be placed in `output`.
1414

15+
## Identities (or "help, I'm showing up multiple times")
16+
17+
Thanks aggregates data from commits and PR reviews.
18+
It bases identities on the email addresses from the commits and GitHub usernames from approvals (which it maps to email addresses via rust-lang/team).
19+
It then uses the `.mailmap` in the rust-lang/rust repository to canonicalize the identities.
20+
21+
If you show up multiple times, it's likely that you have contributed under multiple email addresses and haven't added them to the mailmap.
22+
To do this, add yourself to the mailmap `.mailmap` like the example here:
23+
24+
```
25+
26+
27+
28+
```
29+
30+
Use the `DEBUG_EMAILS=1` environment variable locally to display the email address in the output,
31+
which is useful for debugging these missing mailmap entries.
32+
1533
## Refresh time
1634

1735
Thanks is configured to run every night to update the latest statistics.

mailmap/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ categories = ["parsing"]
1111
license = "MIT OR Apache-2.0"
1212

1313
[dependencies]
14+
unicase = "2.6.0"

mailmap/src/lib.rs

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use std::fmt;
2+
use std::hash::Hash;
23
use std::pin::Pin;
34
use std::ptr::NonNull;
45

6+
use unicase::UniCase;
7+
58
#[cfg(test)]
69
mod test;
710

@@ -74,8 +77,17 @@ impl<'a> MapEntry<'a> {
7477

7578
#[derive(Clone, PartialEq, PartialOrd, Ord, Eq, Hash)]
7679
pub struct Author {
77-
pub name: String,
78-
pub email: String,
80+
pub name: UniCase<String>,
81+
pub email: UniCase<String>,
82+
}
83+
84+
impl Author {
85+
pub fn new(name: String, email: String) -> Self {
86+
Self {
87+
name: UniCase::new(name),
88+
email: UniCase::new(email),
89+
}
90+
}
7991
}
8092

8193
impl fmt::Debug for Author {
@@ -105,18 +117,18 @@ impl Mailmap {
105117
let entry = unsafe { entry.to_entry(&self.buffer) };
106118
if let Some(email) = entry.current_email {
107119
if let Some(name) = entry.current_name {
108-
if author.name == name && author.email == email {
109-
return Author {
110-
name: entry.canonical_name.unwrap_or(&author.name).to_owned(),
111-
email: entry.canonical_email.expect("canonical email").to_owned(),
112-
};
120+
if author.name == UniCase::new(name) && author.email == UniCase::new(email) {
121+
return Author::new(
122+
entry.canonical_name.unwrap_or(&author.name).to_owned(),
123+
entry.canonical_email.expect("canonical email").to_owned(),
124+
);
113125
}
114126
} else {
115-
if author.email == email {
116-
return Author {
117-
name: entry.canonical_name.unwrap_or(&author.name).to_owned(),
118-
email: entry.canonical_email.expect("canonical email").to_owned(),
119-
};
127+
if author.email == UniCase::new(email) {
128+
return Author::new(
129+
entry.canonical_name.unwrap_or(&author.name).to_owned(),
130+
entry.canonical_email.expect("canonical email").to_owned(),
131+
);
120132
}
121133
}
122134
}

src/main.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ impl ToAuthor for Author {
3030
.email()
3131
.unwrap_or_else(|| panic!("no email for {}", sig));
3232

33-
Author {
34-
name: name.to_string(),
35-
email: email.to_string(),
36-
}
33+
Author::new(name.to_string(), email.to_string())
3734
}
3835
}
3936

@@ -258,10 +255,10 @@ fn commit_coauthors(commit: &Commit) -> Vec<Author> {
258255
for line in msg.lines().rev() {
259256
if line.starts_with("Co-authored-by") {
260257
if let Some(caps) = RE.captures(line) {
261-
coauthors.push(Author {
262-
name: caps["name"].to_string(),
263-
email: caps["email"].to_string(),
264-
});
258+
coauthors.push(Author::new(
259+
caps["name"].to_string(),
260+
caps["email"].to_string(),
261+
));
265262
}
266263
}
267264
}
@@ -589,14 +586,13 @@ fn main() {
589586
eprintln!("\tcaused by: {}", cause);
590587
cur = cause;
591588
}
592-
std::mem::drop(cur);
589+
std::mem::drop(err);
593590
std::process::exit(1);
594591
}
595592
}
596593

597594
#[derive(Debug)]
598595
struct Submodule {
599-
path: PathBuf,
600596
commit: Oid,
601597
// url
602598
repository: String,
@@ -631,7 +627,6 @@ fn get_submodules(
631627
};
632628
assert_eq!(entry.kind().unwrap(), git2::ObjectType::Commit);
633629
submodules.push(Submodule {
634-
path: path.to_owned(),
635630
commit: entry.id(),
636631
repository: url.to_owned(),
637632
});

0 commit comments

Comments
 (0)