44
55TOOLCHAIN=${TOOLCHAIN:- $(date +% Y-% m-% d)}
66
7- function check_git_fixed_subtree() {
8- if [[ ! -e ./git-fixed-subtree.sh ]]; then
9- echo " Missing git-fixed-subtree.sh. Please run the following commands to download it:"
10- echo " curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/bjorn3/git/tqc-subtree-portable/contrib/subtree/git-subtree.sh -o git-fixed-subtree.sh"
11- echo " chmod u+x git-fixed-subtree.sh"
12- exit 1
13- fi
14- if [[ ! -x ./git-fixed-subtree.sh ]]; then
15- echo " git-fixed-subtree.sh is not executable. Please run the following command to make it executable:"
16- echo " chmod u+x git-fixed-subtree.sh"
17- exit 1
18- fi
19- }
20-
217case $1 in
228 " prepare" )
239 echo " => Installing new nightly"
@@ -38,39 +24,19 @@ case $1 in
3824 git commit -m " Rustup to $( rustc -V) "
3925 ;;
4026 " push" )
41- check_git_fixed_subtree
42-
43- cg_clif=$( pwd)
44- pushd ../rust
45- git pull origin main
4627 branch=sync_cg_clif-$( date +%Y-%m-%d)
47- git checkout -b " $branch "
48- " $cg_clif /git-fixed-subtree.sh" pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/rust-lang/rustc_codegen_cranelift.git main
49- git push -u my " $branch "
50-
51- # immediately merge the merge commit into cg_clif to prevent merge conflicts when syncing
52- # from rust-lang/rust later
53- " $cg_clif /git-fixed-subtree.sh" push --prefix=compiler/rustc_codegen_cranelift/ " $cg_clif " sync_from_rust
54- popd
55- git merge sync_from_rust
28+ rustc-josh-sync push " ${branch} " bjorn3
5629 ;;
5730 " pull" )
58- check_git_fixed_subtree
59-
6031 RUST_VERS=$( curl " https://static.rust-lang.org/dist/$TOOLCHAIN /channel-rust-nightly-git-commit-hash.txt" )
6132 echo " Pulling $RUST_VERS ($TOOLCHAIN )"
6233
63- cg_clif=$( pwd)
64- pushd ../rust
65- git fetch origin main
66- git -c advice.detachedHead=false checkout " $RUST_VERS "
67- " $cg_clif /git-fixed-subtree.sh" push --prefix=compiler/rustc_codegen_cranelift/ " $cg_clif " sync_from_rust
68- popd
69- git merge sync_from_rust -m " Sync from rust $RUST_VERS "
70- git branch -d sync_from_rust
34+ branch=rustc-pull-$( date +%Y-%m-%d)
35+ git checkout -b " ${branch} "
36+ rustc-josh-sync pull --upstream-commit " ${RUST_VERS} "
7137 ;;
7238 * )
7339 echo " Unknown command '$1 '"
74- echo " Usage: ./rustup.sh prepare|commit"
40+ echo " Usage: ./rustup.sh prepare|commit|push|pull "
7541 ;;
7642esac
0 commit comments