File tree Expand file tree Collapse file tree 4 files changed +411
-0
lines changed
library/compiler-builtins Expand file tree Collapse file tree 4 files changed +411
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ resolver = "2"
3
3
members = [
4
4
" builtins-test" ,
5
5
" compiler-builtins" ,
6
+ " crates/josh-sync" ,
6
7
" crates/libm-macros" ,
7
8
" crates/musl-math-sys" ,
8
9
" crates/panic-handler" ,
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " josh-sync"
3
+ edition = " 2024"
4
+ publish = false
5
+
6
+ [dependencies ]
7
+ anyhow = " 1.0.98"
8
+ directories = " 6.0.0"
9
+ xshell = " 0.2.7"
Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+ use std:: process:: exit;
3
+
4
+ use crate :: sync:: { GitSync , RustcPullError } ;
5
+
6
+ mod sync;
7
+
8
+ const USAGE : & str = r#"Utility for synchroniing compiler-builtins with rust-lang/rust
9
+
10
+ Usage:
11
+
12
+ josh-sync rustc-pull
13
+
14
+ josh-sync rustc-push BRANCH GITHUB_USERNAME
15
+ "# ;
16
+
17
+ fn main ( ) -> anyhow:: Result < ( ) > {
18
+ let sync = GitSync :: from_current_dir ( ) ?;
19
+
20
+ // Collect args, then recollect as str refs so we can match on them
21
+ let args: Vec < _ > = env:: args ( ) . collect ( ) ;
22
+ let args: Vec < & str > = args. iter ( ) . map ( |s| s. as_str ( ) ) . collect ( ) ;
23
+
24
+ match args. as_slice ( ) [ 1 ..] {
25
+ [ "rustc-pull" ] => {
26
+ if let Err ( error) = sync. rustc_pull ( None ) {
27
+ match error {
28
+ RustcPullError :: NothingToPull => {
29
+ eprintln ! ( "Nothing to pull" ) ;
30
+ std:: process:: exit ( 2 ) ;
31
+ }
32
+ RustcPullError :: PullFailed ( error) => {
33
+ eprintln ! ( "Pull failure: {error:?}" ) ;
34
+ std:: process:: exit ( 1 ) ;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ [ "rustc-push" , branch, github_username] => {
40
+ sync. rustc_push ( github_username, branch) ?;
41
+ }
42
+ _ => {
43
+ println ! ( "{USAGE}" ) ;
44
+ exit ( 1 ) ;
45
+ }
46
+ }
47
+ Ok ( ( ) )
48
+ }
You can’t perform that action at this time.
0 commit comments