@@ -46,6 +46,10 @@ enum Command {
46
46
/// If you instead want to exit successfully in that case, pass this flag.
47
47
#[ clap( long) ]
48
48
allow_noop : bool ,
49
+
50
+ /// Print executed commands.
51
+ #[ clap( long, short = 'v' ) ]
52
+ verbose : bool ,
49
53
} ,
50
54
/// Push changes into the main `rust-lang/rust` repository `branch` of a `rustc` fork under
51
55
/// the given GitHub `username`.
@@ -64,6 +68,10 @@ enum Command {
64
68
65
69
/// Your GitHub usename where the fork is located
66
70
username : String ,
71
+
72
+ /// Print executed commands.
73
+ #[ clap( long, short = 'v' ) ]
74
+ verbose : bool ,
67
75
} ,
68
76
}
69
77
@@ -91,15 +99,16 @@ fn main() -> anyhow::Result<()> {
91
99
}
92
100
}
93
101
Command :: Pull {
102
+ verbose,
94
103
config_path,
95
104
rust_version_path,
96
105
upstream_repo,
97
106
upstream_commit,
98
107
allow_noop,
99
108
} => {
100
109
let ctx = load_context ( & config_path, & rust_version_path) ?;
101
- let josh = get_josh_proxy ( ) ?;
102
- let sync = GitSync :: new ( ctx. clone ( ) , josh) ;
110
+ let josh = get_josh_proxy ( verbose ) ?;
111
+ let sync = GitSync :: new ( ctx. clone ( ) , josh, verbose ) ;
103
112
match sync. rustc_pull ( upstream_repo, upstream_commit) {
104
113
Ok ( result) => {
105
114
if !maybe_create_gh_pr (
@@ -121,6 +130,9 @@ fn main() -> anyhow::Result<()> {
121
130
}
122
131
Err ( RustcPullError :: PullFailed ( error) ) => {
123
132
eprintln ! ( "Pull failure: {error:?}" ) ;
133
+ if !verbose {
134
+ eprintln ! ( "Rerun with `-v` to see executed commands" ) ;
135
+ }
124
136
std:: process:: exit ( 1 ) ;
125
137
}
126
138
}
@@ -130,16 +142,24 @@ fn main() -> anyhow::Result<()> {
130
142
branch,
131
143
config_path,
132
144
rust_version_path,
145
+ verbose,
133
146
} => {
134
147
let ctx = load_context ( & config_path, & rust_version_path) ?;
135
- let josh = get_josh_proxy ( ) ?;
136
- let sync = GitSync :: new ( ctx. clone ( ) , josh) ;
137
- sync. rustc_push ( & username, & branch)
138
- . context ( "cannot perform push" ) ?;
148
+ let josh = get_josh_proxy ( verbose) ?;
149
+ let sync = GitSync :: new ( ctx. clone ( ) , josh, verbose) ;
150
+ if let Err ( error) = sync
151
+ . rustc_push ( & username, & branch)
152
+ . context ( "cannot perform push" )
153
+ {
154
+ if !verbose {
155
+ eprintln ! ( "Rerun with `-v` to see executed commands" ) ;
156
+ }
157
+ return Err ( error) ;
158
+ }
139
159
140
160
// Open PR with `subtree update` title to silence the `no-merges` triagebot check
141
161
let title = format ! ( "{} subtree update" , ctx. config. repo) ;
142
- let head = get_current_head_sha ( ) ?;
162
+ let head = get_current_head_sha ( verbose ) ?;
143
163
144
164
let merge_msg = format ! (
145
165
r#"Subtree update of `{repo}` to https://github.com/{full_repo}/commit/{head}.
@@ -204,9 +224,9 @@ fn maybe_create_gh_pr(repo: &str, title: &str, description: &str) -> anyhow::Res
204
224
}
205
225
}
206
226
207
- fn get_josh_proxy ( ) -> anyhow:: Result < JoshProxy > {
227
+ fn get_josh_proxy ( verbose : bool ) -> anyhow:: Result < JoshProxy > {
208
228
println ! ( "Updating/installing josh-proxy binary..." ) ;
209
- match try_install_josh ( ) {
229
+ match try_install_josh ( verbose ) {
210
230
Some ( proxy) => Ok ( proxy) ,
211
231
None => Err ( anyhow:: anyhow!( "Could not install josh-proxy" ) ) ,
212
232
}
0 commit comments