Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count the beta prerelease number just from master #72993

Merged
merged 1 commit into from
Jun 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,29 +963,15 @@ impl Build {
return s;
}

let beta = output(
Command::new("git").arg("ls-remote").arg("origin").arg("beta").current_dir(&self.src),
);
let beta = beta.trim().split_whitespace().next().unwrap();
let master = output(
Command::new("git").arg("ls-remote").arg("origin").arg("master").current_dir(&self.src),
);
let master = master.trim().split_whitespace().next().unwrap();

// Figure out where the current beta branch started.
let base = output(
Command::new("git").arg("merge-base").arg(beta).arg(master).current_dir(&self.src),
);
let base = base.trim();

// Next figure out how many merge commits happened since we branched off
// beta. That's our beta number!
// Figure out how many merge commits happened since we branched off master.
// That's our beta number!
// (Note that we use a `..` range, not the `...` symmetric difference.)
let count = output(
Command::new("git")
.arg("rev-list")
.arg("--count")
.arg("--merges")
.arg(format!("{}...HEAD", base))
.arg("refs/remotes/origin/master..HEAD")
.current_dir(&self.src),
);
let n = count.trim().parse().unwrap();
Expand Down