Skip to content

Commit f48536d

Browse files
committed
WIP
1 parent b9bf0bd commit f48536d

File tree

1 file changed

+81
-7
lines changed

1 file changed

+81
-7
lines changed

src/bootstrap/src/bin/main.rs

Lines changed: 81 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
#![allow(unused)]
12
//! bootstrap, the Rust build system
23
//!
34
//! This is the entry point for the build system used to compile the `rustc`
45
//! compiler. Lots of documentation can be found in the `README.md` file in the
56
//! parent directory, and otherwise documentation can be found throughout the `build`
67
//! directory in each respective module.
78
8-
use std::fs::{self, OpenOptions};
9-
use std::io::{self, BufRead, BufReader, IsTerminal, Write};
10-
use std::str::FromStr;
11-
use std::{env, process};
12-
139
use bootstrap::{
1410
Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, debug, find_recent_config_change_ids,
1511
human_readable_changes, t,
1612
};
1713
use build_helper::ci::CiEnv;
14+
use build_helper::git::get_closest_merge_commit;
15+
use std::fs::{self, OpenOptions};
16+
use std::io::{self, BufRead, BufReader, IsTerminal, Write};
17+
use std::process::Command;
18+
use std::str::FromStr;
19+
use std::{env, process};
1820
#[cfg(feature = "tracing")]
1921
use tracing::instrument;
2022

@@ -34,7 +36,79 @@ fn main() {
3436
debug!("parsing config based on flags");
3537
let config = Config::parse(flags);
3638

37-
let mut build_lock;
39+
let merge_commit1 =
40+
get_closest_merge_commit(Some(&config.src), &config.git_config(), &[]).unwrap();
41+
let merge_commit2 = String::from_utf8(
42+
Command::new("git")
43+
.args([
44+
"rev-list",
45+
&format!("[email protected]"),
46+
"-n1",
47+
"--first-parent",
48+
"HEAD",
49+
])
50+
.output()
51+
.unwrap()
52+
.stdout,
53+
)
54+
.unwrap();
55+
let merge_commit3 = String::from_utf8(
56+
Command::new("git")
57+
.args([
58+
"rev-list",
59+
&format!("[email protected]"),
60+
"-n1",
61+
"--first-parent",
62+
"HEAD^1",
63+
])
64+
.output()
65+
.unwrap()
66+
.stdout,
67+
)
68+
.unwrap();
69+
let merge_commit4 = String::from_utf8(
70+
Command::new("git")
71+
.args([
72+
"rev-list",
73+
&format!("[email protected]"),
74+
"-n1",
75+
"--first-parent",
76+
"HEAD^1",
77+
"--",
78+
"src/llvm-project",
79+
])
80+
.output()
81+
.unwrap()
82+
.stdout,
83+
)
84+
.unwrap();
85+
let current_commit = String::from_utf8(
86+
Command::new("git").arg("rev-parse").arg("HEAD").output().unwrap().stdout,
87+
)
88+
.unwrap();
89+
let git_history = String::from_utf8(
90+
Command::new("git")
91+
.arg("log")
92+
.arg("--oneline")
93+
.arg("-n")
94+
.arg("20")
95+
.arg("--pretty=format:%h %an %ae %s")
96+
.output()
97+
.unwrap()
98+
.stdout,
99+
)
100+
.unwrap();
101+
panic!(
102+
r#"
103+
Merge commit1: {merge_commit1}
104+
Merge commit2: {merge_commit2}
105+
Merge commit3: {merge_commit3}
106+
Merge commit4: {merge_commit4}
107+
HEAD: {current_commit}
108+
{git_history}"#
109+
);
110+
111+
/*let mut build_lock;
38112
let _build_lock_guard;
39113
40114
if !config.bypass_bootstrap_lock {
@@ -145,7 +219,7 @@ fn main() {
145219
let mut file = t!(OpenOptions::new().write(true).truncate(true).open(entry.path()));
146220
t!(file.write_all(lines.join("\n").as_bytes()));
147221
}
148-
}
222+
}*/
149223
}
150224

151225
fn check_version(config: &Config) -> Option<String> {

0 commit comments

Comments
 (0)